ids = new ArrayList<>();
- ids.add(0);
- param = new CreateUAICensorResourceParam(region,zone,ids);
- param.setProjectId(projectId);
- param.setResourceMemo("demoMemo");
- param.setResourceName("demoName");
- }
-
- @Test
- public void createUAICensorResource() {
- try {
- CreateUAICensorResourceResult result =
- client.createUAICensorResource(param);
- JSONComparator.jsonComparator(result);
- } catch (Exception e) {
- assertNull(e);
- }
- }
-}
\ No newline at end of file
diff --git a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/DeleteUAICensorResourceTest.java b/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/DeleteUAICensorResourceTest.java
deleted file mode 100644
index 9a71c777..00000000
--- a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/DeleteUAICensorResourceTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package cn.ucloud.censor.client;
-
-import cn.ucloud.censor.model.DeleteUAICensorResourceParam;
-import cn.ucloud.censor.model.DeleteUAICensorResourceResult;
-import cn.ucloud.censor.model.ModifyUAICensorResourceMemoParam;
-import cn.ucloud.censor.model.ModifyUAICensorResourceMemoResult;
-import cn.ucloud.censor.pojo.CensorConfig;
-import cn.ucloud.common.pojo.Account;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 14:43
- **/
-public class DeleteUAICensorResourceTest {
-
- private CensorClient client;
-
- private DeleteUAICensorResourceParam param;
-
- @Before
- public void setUp() throws Exception {
- client = new DefaultCensorClient(new CensorConfig(
- new Account(System.getenv("UCloudPrivateKey"),
- System.getenv("UCloudPublicKey"))));
- String projectId = System.getenv("ProjectId");
- String region = "cn-bj2";
- String zone = "cn-bj2-04";
- String resourceId = "uaicensor-aqlfqidb";
- param = new DeleteUAICensorResourceParam(region, zone, resourceId);
- param.setProjectId(projectId);
- }
-
- @Test
- public void deleteUAICensorResource() {
- try {
- DeleteUAICensorResourceResult result =
- client.deleteUAICensorResource(param);
- JSONComparator.jsonComparator(result);
- } catch (Exception e) {
- assertNull(e);
- }
- }
-
-}
\ No newline at end of file
diff --git a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorAvailResourceTypeTest.java b/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorAvailResourceTypeTest.java
deleted file mode 100644
index 6075fb4e..00000000
--- a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorAvailResourceTypeTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.ucloud.censor.client;
-
-import cn.ucloud.censor.model.GetUAICensorAvailResourceTypeParam;
-import cn.ucloud.censor.model.GetUAICensorAvailResourceTypeResult;
-import cn.ucloud.censor.pojo.CensorConfig;
-import cn.ucloud.common.pojo.Account;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertNull;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 10:52
- **/
-public class GetUAICensorAvailResourceTypeTest {
-
- private CensorClient client;
-
- private GetUAICensorAvailResourceTypeParam param;
-
- @Before
- public void setUp() throws Exception {
- client = new DefaultCensorClient(new CensorConfig(
- new Account(System.getenv("UCloudPrivateKey"),
- System.getenv("UCloudPublicKey"))));
- String projectId = System.getenv("ProjectId");
- String region = "cn-bj2";
- String zone = "cn-bj2-04";
- param = new GetUAICensorAvailResourceTypeParam(region,zone);
- param.setProjectId(projectId);
- }
-
- @Test
- public void getUAICensorAvailResourceType() {
- try {
- GetUAICensorAvailResourceTypeResult result =
- client.getUAICensorAvailResourceType(param);
- JSONComparator.jsonComparator(result);
- } catch (Exception e) {
- assertNull(e);
- }
- }
-}
\ No newline at end of file
diff --git a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorResourceListTest.java b/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorResourceListTest.java
deleted file mode 100644
index e6eef4ee..00000000
--- a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorResourceListTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package cn.ucloud.censor.client;
-
-import cn.ucloud.censor.model.GetUAICensorResourceListParam;
-import cn.ucloud.censor.model.GetUAICensorResourceListResult;
-import cn.ucloud.censor.pojo.CensorConfig;
-import cn.ucloud.common.handler.UcloudHandler;
-import cn.ucloud.common.pojo.Account;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertNull;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 14:17
- **/
-public class GetUAICensorResourceListTest {
-
- private CensorClient client;
-
- private GetUAICensorResourceListParam param;
-
- @Before
- public void setUp() throws Exception {
- client = new DefaultCensorClient(new CensorConfig(
- new Account(System.getenv("UCloudPrivateKey"),
- System.getenv("UCloudPublicKey"))));
- String projectId = System.getenv("ProjectId");
- String region = "cn-bj2";
- String zone = "cn-bj2-04";
- param = new GetUAICensorResourceListParam(region, zone);
- param.setProjectId(projectId);
- }
-
- @Test
- public void getUAICensorResourceList() {
- try {
- GetUAICensorResourceListResult result =
- client.getUAICensorResourceList(param);
- JSONComparator.jsonComparator(result);
- } catch (Exception e) {
- assertNull(e);
- }
-
- }
-}
\ No newline at end of file
diff --git a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorResourceMetricInfoTest.java b/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorResourceMetricInfoTest.java
deleted file mode 100644
index a5bff503..00000000
--- a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorResourceMetricInfoTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package cn.ucloud.censor.client;
-
-import cn.ucloud.censor.model.CreateUAICensorResourceResult;
-import cn.ucloud.censor.model.GetUAICensorResourceMetricInfoParam;
-import cn.ucloud.censor.model.GetUAICensorResourceMetricInfoResult;
-import cn.ucloud.censor.pojo.CensorConfig;
-import cn.ucloud.common.pojo.Account;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertNull;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-18 17:33
- **/
-public class GetUAICensorResourceMetricInfoTest {
- private CensorClient client;
-
- private GetUAICensorResourceMetricInfoParam param;
-
- @Before
- public void setUp() throws Exception {
- client = new DefaultCensorClient(new CensorConfig(
- new Account(System.getenv("UCloudPrivateKey"),
- System.getenv("UCloudPublicKey"))));
- String projectId = System.getenv("ProjectId");
- String region = "cn-bj2";
- Long beginTime = 1555557017L;
- Long endTime = 1555578617L;
- String resourceId = "uaicensor-nkh1osfy";
- param = new GetUAICensorResourceMetricInfoParam(region, beginTime, endTime,resourceId);
- param.setProjectId(projectId);
- }
-
- @Test
- public void getUAICensorResourceMetricInfo() {
- try {
- GetUAICensorResourceMetricInfoResult result =
- client.getUAICensorResourceMetricInfo(param);
- JSONComparator.jsonComparator(result);
- } catch (Exception e) {
- assertNull(e);
- }
- }
-}
\ No newline at end of file
diff --git a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorResourceRecordInfoTest.java b/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorResourceRecordInfoTest.java
deleted file mode 100644
index 35161d89..00000000
--- a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/GetUAICensorResourceRecordInfoTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package cn.ucloud.censor.client;
-
-import cn.ucloud.censor.model.GetUAICensorResourceRecordInfoParam;
-import cn.ucloud.censor.model.GetUAICensorResourceRecordInfoResult;
-import cn.ucloud.censor.pojo.CensorConfig;
-import cn.ucloud.common.pojo.Account;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-18 17:07
- **/
-public class GetUAICensorResourceRecordInfoTest {
-
- private CensorClient client;
-
- private GetUAICensorResourceRecordInfoParam param;
-
- @Before
- public void setUp() throws Exception {
- client = new DefaultCensorClient(new CensorConfig(
- new Account(System.getenv("UCloudPrivateKey"),
- System.getenv("UCloudPublicKey"))));
- String projectId = System.getenv("ProjectId");
- String region = "cn-bj2";
- String zone = "cn-bj2-04";
- Long beginTime = 1555557017L;
- Long endTime = 1555638570L;
- param = new GetUAICensorResourceRecordInfoParam(region,zone,beginTime,endTime);
- param.setProjectId(projectId);
- }
-
- @Test
- public void getUAICensorResourceRecordInfo() {
- try {
- GetUAICensorResourceRecordInfoResult result =
- client.getUAICensorResourceRecordInfo(param);
- JSONComparator.jsonComparator(result);
- } catch (Exception e) {
- assertNull(e);
- }
- }
-}
\ No newline at end of file
diff --git a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/JSONComparator.java b/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/JSONComparator.java
deleted file mode 100644
index 50ac3719..00000000
--- a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/JSONComparator.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package cn.ucloud.censor.client;
-
-import cn.ucloud.common.pojo.BaseResponseResult;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.skyscreamer.jsonassert.JSONAssert;
-import org.skyscreamer.jsonassert.JSONCompareMode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.junit.Assert.assertNull;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-03-05 21:32
- **/
-public class JSONComparator {
-
- private static final Logger logger = LoggerFactory.getLogger(JSONComparator.class.getName());
-
- public static void jsonComparator(BaseResponseResult result) {
- try {
- Gson gson = new GsonBuilder().serializeNulls().create();
- logger.info("result 2 json:{}", gson.toJson(result));
- JSONAssert.assertEquals(result.getResponseContent(), gson.toJson(result), JSONCompareMode.LENIENT);
- } catch (Exception e) {
- assertNull(e);
- }
- }
-
-}
diff --git a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/ModifyUAICensorResourceMemoTest.java b/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/ModifyUAICensorResourceMemoTest.java
deleted file mode 100644
index c00d3124..00000000
--- a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/ModifyUAICensorResourceMemoTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package cn.ucloud.censor.client;
-
-import cn.ucloud.censor.model.ModifyUAICensorResourceMemoParam;
-import cn.ucloud.censor.model.ModifyUAICensorResourceMemoResult;
-import cn.ucloud.censor.pojo.CensorConfig;
-import cn.ucloud.common.pojo.Account;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertNull;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 14:27
- **/
-public class ModifyUAICensorResourceMemoTest {
-
- private CensorClient client;
-
- private ModifyUAICensorResourceMemoParam param;
-
- @Before
- public void setUp() throws Exception {
- client = new DefaultCensorClient(new CensorConfig(
- new Account(System.getenv("UCloudPrivateKey"),
- System.getenv("UCloudPublicKey"))));
- String projectId = System.getenv("ProjectId");
- String region = "cn-bj2";
- String zone = "cn-bj2-04";
- String resourceId = "uaicensor-42yuglvf";
- String resourceMemo = "demo";
- param = new ModifyUAICensorResourceMemoParam(region, zone, resourceId,resourceMemo);
- param.setProjectId(projectId);
- }
-
- @Test
- public void modifyUAICensorResourceMemo() {
- try {
- ModifyUAICensorResourceMemoResult result =
- client.modifyUAICensorResourceMemo(param);
- JSONComparator.jsonComparator(result);
- } catch (Exception e) {
- assertNull(e);
- }
- }
-
-}
\ No newline at end of file
diff --git a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/ModifyUAICensorResourceNameTest.java b/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/ModifyUAICensorResourceNameTest.java
deleted file mode 100644
index 122de5bd..00000000
--- a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/ModifyUAICensorResourceNameTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package cn.ucloud.censor.client;
-
-import cn.ucloud.censor.model.ModifyUAICensorResourceNameParam;
-import cn.ucloud.censor.model.ModifyUAICensorResourceNameResult;
-import cn.ucloud.censor.pojo.CensorConfig;
-import cn.ucloud.common.pojo.Account;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertNull;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 14:36
- **/
-public class ModifyUAICensorResourceNameTest {
-
- private CensorClient client;
-
- private ModifyUAICensorResourceNameParam param;
-
- @Before
- public void setUp() throws Exception {
- client = new DefaultCensorClient(new CensorConfig(
- new Account(System.getenv("UCloudPrivateKey"),
- System.getenv("UCloudPublicKey"))));
- String projectId = System.getenv("ProjectId");
- String region = "cn-bj2";
- String zone = "cn-bj2-04";
- String resourceId = "uaicensor-42yuglvf";
- String resourceName = "demoName";
- param = new ModifyUAICensorResourceNameParam(region, zone, resourceId, resourceName);
- param.setProjectId(projectId);
- }
-
- @Test
- public void modifyUAICensorResourceName() {
- try {
- ModifyUAICensorResourceNameResult result =
- client.modifyUAICensorResourceName(param);
- JSONComparator.jsonComparator(result);
- } catch (Exception e) {
- assertNull(e);
- }
- }
-
-}
\ No newline at end of file
diff --git a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/ModifyUAICensorResourceOssInfoTest.java b/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/ModifyUAICensorResourceOssInfoTest.java
deleted file mode 100644
index 8d816d6e..00000000
--- a/ucloud-sdk-java-censor/src/test/java/cn/ucloud/censor/client/ModifyUAICensorResourceOssInfoTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package cn.ucloud.censor.client;
-
-import cn.ucloud.censor.model.ModifyUAICensorResourceOssInfoParam;
-import cn.ucloud.censor.model.ModifyUAICensorResourceOssInfoResult;
-import cn.ucloud.censor.pojo.CensorConfig;
-import cn.ucloud.common.pojo.Account;
-import org.junit.Before;
-import org.junit.Test;
-
-
-import static org.junit.Assert.*;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 15:25
- **/
-public class ModifyUAICensorResourceOssInfoTest {
-
- private CensorClient client;
-
- private ModifyUAICensorResourceOssInfoParam param;
-
- @Before
- public void setUp() throws Exception {
- client = new DefaultCensorClient(new CensorConfig(
- new Account(System.getenv("UCloudPrivateKey"),
- System.getenv("UCloudPublicKey"))));
- String projectId = System.getenv("ProjectId");
- String region = "cn-bj2";
- String zone = "cn-bj2-04";
- String ossPublicKey = "xxx";
- String ossPrivateKey = "xxxxxx";
- String resourceId = "uaicensor-tebnw4ae";
- param = new ModifyUAICensorResourceOssInfoParam(region,zone,resourceId,ossPublicKey,ossPrivateKey);
- param.setProjectId(projectId);
- }
-
- @Test
- public void modifyUAICensorResourceOssInfo() {
- try {
- ModifyUAICensorResourceOssInfoResult result =
- client.modifyUAICensorResourceOssInfo(param);
- JSONComparator.jsonComparator(result);
- } catch (Exception e) {
- assertNull(e);
- }
- }
-
-}
\ No newline at end of file
diff --git a/ucloud-sdk-java-cloudwatch/pom.xml b/ucloud-sdk-java-cloudwatch/pom.xml
new file mode 100644
index 00000000..80c0512e
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/pom.xml
@@ -0,0 +1,49 @@
+
+
+
+ ucloud-sdk-java
+ cn.ucloud
+ 1.2.51-release
+
+
+ 4.0.0
+ ucloud-sdk-java-cloudwatch
+ ucloud-sdk-java
+ 1.2.51-release
+
+
+
+ cn.ucloud
+ ucloud-sdk-java-common
+ 1.2.51-release
+
+
+
+ com.google.code.gson
+ gson
+
+
+
+ commons-codec
+ commons-codec
+
+
+ org.apache.commons
+ commons-lang3
+
+
+
+ junit
+ junit
+ test
+
+
+
+ org.slf4j
+ slf4j-simple
+ provided
+
+
+
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/client/CloudWatchClient.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/client/CloudWatchClient.java
new file mode 100644
index 00000000..130dab35
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/client/CloudWatchClient.java
@@ -0,0 +1,260 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.client;
+
+import cn.ucloud.cloudwatch.models.BindAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.BindAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.CreateAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.CreateAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.CreateAlertStrategyTemplateRequest;
+import cn.ucloud.cloudwatch.models.CreateAlertStrategyTemplateResponse;
+import cn.ucloud.cloudwatch.models.DeleteAlertStrategyTemplateRequest;
+import cn.ucloud.cloudwatch.models.DeleteAlertStrategyTemplateResponse;
+import cn.ucloud.cloudwatch.models.EnableAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.EnableAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.GetProductMetricsRequest;
+import cn.ucloud.cloudwatch.models.GetProductMetricsResponse;
+import cn.ucloud.cloudwatch.models.ListAlertRecordRequest;
+import cn.ucloud.cloudwatch.models.ListAlertRecordResponse;
+import cn.ucloud.cloudwatch.models.ListAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.ListAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.ListAlertStrategyTemplateRequest;
+import cn.ucloud.cloudwatch.models.ListAlertStrategyTemplateResponse;
+import cn.ucloud.cloudwatch.models.ListMonitorProductRequest;
+import cn.ucloud.cloudwatch.models.ListMonitorProductResponse;
+import cn.ucloud.cloudwatch.models.ModifyAlertStrategyRemarkRequest;
+import cn.ucloud.cloudwatch.models.ModifyAlertStrategyRemarkResponse;
+import cn.ucloud.cloudwatch.models.QueryMetricDataSetRequest;
+import cn.ucloud.cloudwatch.models.QueryMetricDataSetResponse;
+import cn.ucloud.cloudwatch.models.QueryMetricDataSummaryRequest;
+import cn.ucloud.cloudwatch.models.QueryMetricDataSummaryResponse;
+import cn.ucloud.cloudwatch.models.UnBindAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.UnBindAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.UpdateAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.UpdateAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.UpdateAlertStrategyTemplateRequest;
+import cn.ucloud.cloudwatch.models.UpdateAlertStrategyTemplateResponse;
+import cn.ucloud.common.client.DefaultClient;
+import cn.ucloud.common.config.Config;
+import cn.ucloud.common.credential.Credential;
+import cn.ucloud.common.exception.UCloudException;
+
+/** This client is used to call actions of **CloudWatch** service */
+public class CloudWatchClient extends DefaultClient implements CloudWatchClientInterface {
+ public CloudWatchClient(Config config, Credential credential) {
+ super(config, credential);
+ }
+
+ /**
+ * BindAlertStrategy - 绑定告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public BindAlertStrategyResponse bindAlertStrategy(BindAlertStrategyRequest request)
+ throws UCloudException {
+ request.setAction("BindAlertStrategy");
+ return (BindAlertStrategyResponse) this.invoke(request, BindAlertStrategyResponse.class);
+ }
+
+ /**
+ * CreateAlertStrategy - 创建告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public CreateAlertStrategyResponse createAlertStrategy(CreateAlertStrategyRequest request)
+ throws UCloudException {
+ request.setAction("CreateAlertStrategy");
+ return (CreateAlertStrategyResponse)
+ this.invoke(request, CreateAlertStrategyResponse.class);
+ }
+
+ /**
+ * CreateAlertStrategyTemplate - 新建条件模板
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public CreateAlertStrategyTemplateResponse createAlertStrategyTemplate(
+ CreateAlertStrategyTemplateRequest request) throws UCloudException {
+ request.setAction("CreateAlertStrategyTemplate");
+ return (CreateAlertStrategyTemplateResponse)
+ this.invoke(request, CreateAlertStrategyTemplateResponse.class);
+ }
+
+ /**
+ * DeleteAlertStrategyTemplate - 删除告警条件模板
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public DeleteAlertStrategyTemplateResponse deleteAlertStrategyTemplate(
+ DeleteAlertStrategyTemplateRequest request) throws UCloudException {
+ request.setAction("DeleteAlertStrategyTemplate");
+ return (DeleteAlertStrategyTemplateResponse)
+ this.invoke(request, DeleteAlertStrategyTemplateResponse.class);
+ }
+
+ /**
+ * EnableAlertStrategy - 是否启用告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public EnableAlertStrategyResponse enableAlertStrategy(EnableAlertStrategyRequest request)
+ throws UCloudException {
+ request.setAction("EnableAlertStrategy");
+ return (EnableAlertStrategyResponse)
+ this.invoke(request, EnableAlertStrategyResponse.class);
+ }
+
+ /**
+ * GetProductMetrics - 获取云产品关联的指标列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public GetProductMetricsResponse getProductMetrics(GetProductMetricsRequest request)
+ throws UCloudException {
+ request.setAction("GetProductMetrics");
+ return (GetProductMetricsResponse) this.invoke(request, GetProductMetricsResponse.class);
+ }
+
+ /**
+ * ListAlertRecord - 告警记录
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ListAlertRecordResponse listAlertRecord(ListAlertRecordRequest request)
+ throws UCloudException {
+ request.setAction("ListAlertRecord");
+ return (ListAlertRecordResponse) this.invoke(request, ListAlertRecordResponse.class);
+ }
+
+ /**
+ * ListAlertStrategy - 获取告警策略列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ListAlertStrategyResponse listAlertStrategy(ListAlertStrategyRequest request)
+ throws UCloudException {
+ request.setAction("ListAlertStrategy");
+ return (ListAlertStrategyResponse) this.invoke(request, ListAlertStrategyResponse.class);
+ }
+
+ /**
+ * ListAlertStrategyTemplate - 条件模板列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ListAlertStrategyTemplateResponse listAlertStrategyTemplate(
+ ListAlertStrategyTemplateRequest request) throws UCloudException {
+ request.setAction("ListAlertStrategyTemplate");
+ return (ListAlertStrategyTemplateResponse)
+ this.invoke(request, ListAlertStrategyTemplateResponse.class);
+ }
+
+ /**
+ * ListMonitorProduct - 获取监控对象类型列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ListMonitorProductResponse listMonitorProduct(ListMonitorProductRequest request)
+ throws UCloudException {
+ request.setAction("ListMonitorProduct");
+ return (ListMonitorProductResponse) this.invoke(request, ListMonitorProductResponse.class);
+ }
+
+ /**
+ * ModifyAlertStrategyRemark - 修改告警策略备注
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ModifyAlertStrategyRemarkResponse modifyAlertStrategyRemark(
+ ModifyAlertStrategyRemarkRequest request) throws UCloudException {
+ request.setAction("ModifyAlertStrategyRemark");
+ return (ModifyAlertStrategyRemarkResponse)
+ this.invoke(request, ModifyAlertStrategyRemarkResponse.class);
+ }
+
+ /**
+ * QueryMetricDataSet - 查询监控指标数据集
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public QueryMetricDataSetResponse queryMetricDataSet(QueryMetricDataSetRequest request)
+ throws UCloudException {
+ request.setAction("QueryMetricDataSet");
+ return (QueryMetricDataSetResponse) this.invoke(request, QueryMetricDataSetResponse.class);
+ }
+
+ /**
+ * QueryMetricDataSummary - 获取资源看图属性列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public QueryMetricDataSummaryResponse queryMetricDataSummary(
+ QueryMetricDataSummaryRequest request) throws UCloudException {
+ request.setAction("QueryMetricDataSummary");
+ return (QueryMetricDataSummaryResponse)
+ this.invoke(request, QueryMetricDataSummaryResponse.class);
+ }
+
+ /**
+ * UnBindAlertStrategy - 解绑告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public UnBindAlertStrategyResponse unBindAlertStrategy(UnBindAlertStrategyRequest request)
+ throws UCloudException {
+ request.setAction("UnBindAlertStrategy");
+ return (UnBindAlertStrategyResponse)
+ this.invoke(request, UnBindAlertStrategyResponse.class);
+ }
+
+ /**
+ * UpdateAlertStrategy - 更新告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public UpdateAlertStrategyResponse updateAlertStrategy(UpdateAlertStrategyRequest request)
+ throws UCloudException {
+ request.setAction("UpdateAlertStrategy");
+ return (UpdateAlertStrategyResponse)
+ this.invoke(request, UpdateAlertStrategyResponse.class);
+ }
+
+ /**
+ * UpdateAlertStrategyTemplate - 编辑条件模板
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public UpdateAlertStrategyTemplateResponse updateAlertStrategyTemplate(
+ UpdateAlertStrategyTemplateRequest request) throws UCloudException {
+ request.setAction("UpdateAlertStrategyTemplate");
+ return (UpdateAlertStrategyTemplateResponse)
+ this.invoke(request, UpdateAlertStrategyTemplateResponse.class);
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/client/CloudWatchClientInterface.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/client/CloudWatchClientInterface.java
new file mode 100644
index 00000000..6fdfdab5
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/client/CloudWatchClientInterface.java
@@ -0,0 +1,197 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.client;
+
+import cn.ucloud.cloudwatch.models.BindAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.BindAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.CreateAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.CreateAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.CreateAlertStrategyTemplateRequest;
+import cn.ucloud.cloudwatch.models.CreateAlertStrategyTemplateResponse;
+import cn.ucloud.cloudwatch.models.DeleteAlertStrategyTemplateRequest;
+import cn.ucloud.cloudwatch.models.DeleteAlertStrategyTemplateResponse;
+import cn.ucloud.cloudwatch.models.EnableAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.EnableAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.GetProductMetricsRequest;
+import cn.ucloud.cloudwatch.models.GetProductMetricsResponse;
+import cn.ucloud.cloudwatch.models.ListAlertRecordRequest;
+import cn.ucloud.cloudwatch.models.ListAlertRecordResponse;
+import cn.ucloud.cloudwatch.models.ListAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.ListAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.ListAlertStrategyTemplateRequest;
+import cn.ucloud.cloudwatch.models.ListAlertStrategyTemplateResponse;
+import cn.ucloud.cloudwatch.models.ListMonitorProductRequest;
+import cn.ucloud.cloudwatch.models.ListMonitorProductResponse;
+import cn.ucloud.cloudwatch.models.ModifyAlertStrategyRemarkRequest;
+import cn.ucloud.cloudwatch.models.ModifyAlertStrategyRemarkResponse;
+import cn.ucloud.cloudwatch.models.QueryMetricDataSetRequest;
+import cn.ucloud.cloudwatch.models.QueryMetricDataSetResponse;
+import cn.ucloud.cloudwatch.models.QueryMetricDataSummaryRequest;
+import cn.ucloud.cloudwatch.models.QueryMetricDataSummaryResponse;
+import cn.ucloud.cloudwatch.models.UnBindAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.UnBindAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.UpdateAlertStrategyRequest;
+import cn.ucloud.cloudwatch.models.UpdateAlertStrategyResponse;
+import cn.ucloud.cloudwatch.models.UpdateAlertStrategyTemplateRequest;
+import cn.ucloud.cloudwatch.models.UpdateAlertStrategyTemplateResponse;
+import cn.ucloud.common.client.Client;
+import cn.ucloud.common.exception.UCloudException;
+
+/** This client is used to call actions of **CloudWatch** service */
+public interface CloudWatchClientInterface extends Client {
+
+ /**
+ * BindAlertStrategy - 绑定告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public BindAlertStrategyResponse bindAlertStrategy(BindAlertStrategyRequest request)
+ throws UCloudException;
+
+ /**
+ * CreateAlertStrategy - 创建告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public CreateAlertStrategyResponse createAlertStrategy(CreateAlertStrategyRequest request)
+ throws UCloudException;
+
+ /**
+ * CreateAlertStrategyTemplate - 新建条件模板
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public CreateAlertStrategyTemplateResponse createAlertStrategyTemplate(
+ CreateAlertStrategyTemplateRequest request) throws UCloudException;
+
+ /**
+ * DeleteAlertStrategyTemplate - 删除告警条件模板
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public DeleteAlertStrategyTemplateResponse deleteAlertStrategyTemplate(
+ DeleteAlertStrategyTemplateRequest request) throws UCloudException;
+
+ /**
+ * EnableAlertStrategy - 是否启用告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public EnableAlertStrategyResponse enableAlertStrategy(EnableAlertStrategyRequest request)
+ throws UCloudException;
+
+ /**
+ * GetProductMetrics - 获取云产品关联的指标列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public GetProductMetricsResponse getProductMetrics(GetProductMetricsRequest request)
+ throws UCloudException;
+
+ /**
+ * ListAlertRecord - 告警记录
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ListAlertRecordResponse listAlertRecord(ListAlertRecordRequest request)
+ throws UCloudException;
+
+ /**
+ * ListAlertStrategy - 获取告警策略列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ListAlertStrategyResponse listAlertStrategy(ListAlertStrategyRequest request)
+ throws UCloudException;
+
+ /**
+ * ListAlertStrategyTemplate - 条件模板列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ListAlertStrategyTemplateResponse listAlertStrategyTemplate(
+ ListAlertStrategyTemplateRequest request) throws UCloudException;
+
+ /**
+ * ListMonitorProduct - 获取监控对象类型列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ListMonitorProductResponse listMonitorProduct(ListMonitorProductRequest request)
+ throws UCloudException;
+
+ /**
+ * ModifyAlertStrategyRemark - 修改告警策略备注
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public ModifyAlertStrategyRemarkResponse modifyAlertStrategyRemark(
+ ModifyAlertStrategyRemarkRequest request) throws UCloudException;
+
+ /**
+ * QueryMetricDataSet - 查询监控指标数据集
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public QueryMetricDataSetResponse queryMetricDataSet(QueryMetricDataSetRequest request)
+ throws UCloudException;
+
+ /**
+ * QueryMetricDataSummary - 获取资源看图属性列表
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public QueryMetricDataSummaryResponse queryMetricDataSummary(
+ QueryMetricDataSummaryRequest request) throws UCloudException;
+
+ /**
+ * UnBindAlertStrategy - 解绑告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public UnBindAlertStrategyResponse unBindAlertStrategy(UnBindAlertStrategyRequest request)
+ throws UCloudException;
+
+ /**
+ * UpdateAlertStrategy - 更新告警策略
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public UpdateAlertStrategyResponse updateAlertStrategy(UpdateAlertStrategyRequest request)
+ throws UCloudException;
+
+ /**
+ * UpdateAlertStrategyTemplate - 编辑条件模板
+ *
+ * @param request Request object
+ * @throws UCloudException Exception
+ */
+ public UpdateAlertStrategyTemplateResponse updateAlertStrategyTemplate(
+ UpdateAlertStrategyTemplateRequest request) throws UCloudException;
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/BindAlertStrategyRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/BindAlertStrategyRequest.java
new file mode 100644
index 00000000..910ec4f2
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/BindAlertStrategyRequest.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class BindAlertStrategyRequest extends Request {
+
+ /** 项目ID */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 告警策略id数组 */
+ @NotEmpty
+ @UCloudParam("AlertStrategyIDs")
+ private List alertStrategyIDs;
+
+ /** 资源数组 */
+ @NotEmpty
+ @UCloudParam("Resources")
+ private List resources;
+
+ /** 产品类型名称 */
+ @NotEmpty
+ @UCloudParam("ProductKey")
+ private String productKey;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public List getAlertStrategyIDs() {
+ return alertStrategyIDs;
+ }
+
+ public void setAlertStrategyIDs(List alertStrategyIDs) {
+ this.alertStrategyIDs = alertStrategyIDs;
+ }
+
+ public List getResources() {
+ return resources;
+ }
+
+ public void setResources(List resources) {
+ this.resources = resources;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/BindAlertStrategyResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/BindAlertStrategyResponse.java
new file mode 100644
index 00000000..e61ddf58
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/BindAlertStrategyResponse.java
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+
+import cn.ucloud.common.response.Response;
+
+public class BindAlertStrategyResponse extends Response {}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyRequest.java
new file mode 100644
index 00000000..7d36af4e
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyRequest.java
@@ -0,0 +1,310 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class CreateAlertStrategyRequest extends Request {
+
+ /**
+ * 项目ID。不填写为默认项目,子帐号必须填写。
+ * 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 告警策略名称。最大长度255个字符 */
+ @NotEmpty
+ @UCloudParam("Name")
+ private String name;
+
+ /** 产品类型。参考ListMonitorProduct获取监控对象类型列表 */
+ @NotEmpty
+ @UCloudParam("ProductKey")
+ private String productKey;
+
+ /** 绑定资源类型 1 资源组 2 资源 */
+ @NotEmpty
+ @UCloudParam("ObjectType")
+ private Integer objectType;
+
+ /** 条件设置方式 1. 手动配置 2.选择模版 */
+ @NotEmpty
+ @UCloudParam("ConfigMode")
+ private Integer configMode;
+
+ /** 绑定资源,对应绑定资源类型ObjectType=2 */
+ @UCloudParam("Resources")
+ private List resources;
+
+ /** 绑定资源组,对应绑定资源类型ObjectType=1 */
+ @UCloudParam("ResourceGroupIDs")
+ private List resourceGroupIDs;
+
+ /** 模板id.对应TemplateId=2 */
+ @UCloudParam("TemplateId")
+ private Integer templateId;
+
+ /** */
+ @UCloudParam("RuleSet")
+ private List ruleSet;
+
+ /** 通知类型 通知组 group 通知人 user */
+ @UCloudParam("NotifyType")
+ private String notifyType;
+
+ /** 通知人id */
+ @UCloudParam("NotifyUserIDs")
+ private List notifyUserIDs;
+
+ /** 通知人组id */
+ @UCloudParam("NotifyGroupIDs")
+ private List notifyGroupIDs;
+
+ /** 通知渠道 短信sms 邮件email 回调webhook */
+ @UCloudParam("NotifyChannelDs")
+ private List notifyChannelDs;
+
+ /** 通知渠道回调webhook 回调语言 中文cn 英文en */
+ @UCloudParam("CallbackLanguage")
+ private String callbackLanguage;
+
+ /** 回调语言url */
+ @UCloudParam("CallbackUrls")
+ private List callbackUrls;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public Integer getObjectType() {
+ return objectType;
+ }
+
+ public void setObjectType(Integer objectType) {
+ this.objectType = objectType;
+ }
+
+ public Integer getConfigMode() {
+ return configMode;
+ }
+
+ public void setConfigMode(Integer configMode) {
+ this.configMode = configMode;
+ }
+
+ public List getResources() {
+ return resources;
+ }
+
+ public void setResources(List resources) {
+ this.resources = resources;
+ }
+
+ public List getResourceGroupIDs() {
+ return resourceGroupIDs;
+ }
+
+ public void setResourceGroupIDs(List resourceGroupIDs) {
+ this.resourceGroupIDs = resourceGroupIDs;
+ }
+
+ public Integer getTemplateId() {
+ return templateId;
+ }
+
+ public void setTemplateId(Integer templateId) {
+ this.templateId = templateId;
+ }
+
+ public List getRuleSet() {
+ return ruleSet;
+ }
+
+ public void setRuleSet(List ruleSet) {
+ this.ruleSet = ruleSet;
+ }
+
+ public String getNotifyType() {
+ return notifyType;
+ }
+
+ public void setNotifyType(String notifyType) {
+ this.notifyType = notifyType;
+ }
+
+ public List getNotifyUserIDs() {
+ return notifyUserIDs;
+ }
+
+ public void setNotifyUserIDs(List notifyUserIDs) {
+ this.notifyUserIDs = notifyUserIDs;
+ }
+
+ public List getNotifyGroupIDs() {
+ return notifyGroupIDs;
+ }
+
+ public void setNotifyGroupIDs(List notifyGroupIDs) {
+ this.notifyGroupIDs = notifyGroupIDs;
+ }
+
+ public List getNotifyChannelDs() {
+ return notifyChannelDs;
+ }
+
+ public void setNotifyChannelDs(List notifyChannelDs) {
+ this.notifyChannelDs = notifyChannelDs;
+ }
+
+ public String getCallbackLanguage() {
+ return callbackLanguage;
+ }
+
+ public void setCallbackLanguage(String callbackLanguage) {
+ this.callbackLanguage = callbackLanguage;
+ }
+
+ public List getCallbackUrls() {
+ return callbackUrls;
+ }
+
+ public void setCallbackUrls(List callbackUrls) {
+ this.callbackUrls = callbackUrls;
+ }
+
+ public static class RuleSet extends Request {
+
+ /** 规则指标ID。参考该类型产品下返回的指标列表GetProductMetrics */
+ @UCloudParam("MetricID")
+ private Integer metricID;
+
+ /** 阈值比较方式。 枚举值比较方式: 1->= 2-<= 3-> 4-< 5-== 6-!= */
+ @UCloudParam("ThresholdCompare")
+ private Integer thresholdCompare;
+
+ /** 触发阈值 */
+ @UCloudParam("ThresholdValue")
+ private Integer thresholdValue;
+
+ /** 触发次数 */
+ @UCloudParam("TriggerCount")
+ private Integer triggerCount;
+
+ /** 触发周期。枚举值:continuous连续 exponent 指数 single 不重复 */
+ @UCloudParam("SendPeriodType")
+ private String sendPeriodType;
+
+ /** 告警等级。枚举值:P0,P1,P2,P3 */
+ @UCloudParam("Level")
+ private String level;
+
+ /** 告警状态。枚举值:0-关闭 1-开启 */
+ @UCloudParam("Status")
+ private Integer status;
+
+ /** 沉默周期(告警周期选择为连续时必填) */
+ @UCloudParam("SendInterval")
+ private Integer sendInterval;
+
+ public Integer getMetricID() {
+ return metricID;
+ }
+
+ public void setMetricID(Integer metricID) {
+ this.metricID = metricID;
+ }
+
+ public Integer getThresholdCompare() {
+ return thresholdCompare;
+ }
+
+ public void setThresholdCompare(Integer thresholdCompare) {
+ this.thresholdCompare = thresholdCompare;
+ }
+
+ public Integer getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Integer thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public Integer getTriggerCount() {
+ return triggerCount;
+ }
+
+ public void setTriggerCount(Integer triggerCount) {
+ this.triggerCount = triggerCount;
+ }
+
+ public String getSendPeriodType() {
+ return sendPeriodType;
+ }
+
+ public void setSendPeriodType(String sendPeriodType) {
+ this.sendPeriodType = sendPeriodType;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public Integer getSendInterval() {
+ return sendInterval;
+ }
+
+ public void setSendInterval(Integer sendInterval) {
+ this.sendInterval = sendInterval;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyResponse.java
new file mode 100644
index 00000000..362e0e77
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyResponse.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+public class CreateAlertStrategyResponse extends Response {
+
+ /** 创建告警策略返回对象 */
+ @SerializedName("Data")
+ private AlertStrategyId data;
+
+ public AlertStrategyId getData() {
+ return data;
+ }
+
+ public void setData(AlertStrategyId data) {
+ this.data = data;
+ }
+
+ public static class AlertStrategyId extends Response {
+
+ /** 告警策略id */
+ @SerializedName("AlertStrategyID")
+ private Integer alertStrategyID;
+
+ public Integer getAlertStrategyID() {
+ return alertStrategyID;
+ }
+
+ public void setAlertStrategyID(Integer alertStrategyID) {
+ this.alertStrategyID = alertStrategyID;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyTemplateRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyTemplateRequest.java
new file mode 100644
index 00000000..5f8ecef8
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyTemplateRequest.java
@@ -0,0 +1,195 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class CreateAlertStrategyTemplateRequest extends Request {
+
+ /**
+ * 项目ID。不填写为默认项目,子帐号必须填写。
+ * 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 告警模板名称。最大长度64个字符 */
+ @NotEmpty
+ @UCloudParam("Name")
+ private String name;
+
+ /** 产品类型。参考ListMonitorProduct获取监控对象类型列表 */
+ @NotEmpty
+ @UCloudParam("ProductKey")
+ private String productKey;
+
+ /** */
+ @UCloudParam("RuleSet")
+ private List ruleSet;
+
+ /** 备注 */
+ @UCloudParam("Remark")
+ private String remark;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public List getRuleSet() {
+ return ruleSet;
+ }
+
+ public void setRuleSet(List ruleSet) {
+ this.ruleSet = ruleSet;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public static class RuleSet extends Request {
+
+ /** 规则指标ID。参考该类型产品下返回的指标列表GetProductMetrics */
+ @NotEmpty
+ @UCloudParam("MetricID")
+ private Integer metricID;
+
+ /** 阈值比较方式。 枚举值比较方式: 1->= 2-<= 3-> 4-< 5-== 6-!= */
+ @NotEmpty
+ @UCloudParam("ThresholdCompare")
+ private Integer thresholdCompare;
+
+ /** 触发阈值 */
+ @NotEmpty
+ @UCloudParam("ThresholdValue")
+ private Integer thresholdValue;
+
+ /** 触发次数 */
+ @NotEmpty
+ @UCloudParam("TriggerCount")
+ private Integer triggerCount;
+
+ /** 触发周期。枚举值:continuous连续 exponent 指数 single 不重复 */
+ @NotEmpty
+ @UCloudParam("SendPeriodType")
+ private String sendPeriodType;
+
+ /** 告警等级。枚举值:P0,P1,P2,P3 */
+ @NotEmpty
+ @UCloudParam("Level")
+ private String level;
+
+ /** 告警状态。枚举值:0-关闭 1-开启 */
+ @NotEmpty
+ @UCloudParam("Status")
+ private Integer status;
+
+ /** 沉默周期(告警周期选择为连续时必填) */
+ @UCloudParam("SendInterval")
+ private Integer sendInterval;
+
+ public Integer getMetricID() {
+ return metricID;
+ }
+
+ public void setMetricID(Integer metricID) {
+ this.metricID = metricID;
+ }
+
+ public Integer getThresholdCompare() {
+ return thresholdCompare;
+ }
+
+ public void setThresholdCompare(Integer thresholdCompare) {
+ this.thresholdCompare = thresholdCompare;
+ }
+
+ public Integer getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Integer thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public Integer getTriggerCount() {
+ return triggerCount;
+ }
+
+ public void setTriggerCount(Integer triggerCount) {
+ this.triggerCount = triggerCount;
+ }
+
+ public String getSendPeriodType() {
+ return sendPeriodType;
+ }
+
+ public void setSendPeriodType(String sendPeriodType) {
+ this.sendPeriodType = sendPeriodType;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public Integer getSendInterval() {
+ return sendInterval;
+ }
+
+ public void setSendInterval(Integer sendInterval) {
+ this.sendInterval = sendInterval;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyTemplateResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyTemplateResponse.java
new file mode 100644
index 00000000..243fee0c
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/CreateAlertStrategyTemplateResponse.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+public class CreateAlertStrategyTemplateResponse extends Response {
+
+ /** 创建告警模板返回对象 */
+ @SerializedName("Data")
+ private AlertTemplate data;
+
+ public AlertTemplate getData() {
+ return data;
+ }
+
+ public void setData(AlertTemplate data) {
+ this.data = data;
+ }
+
+ public static class AlertTemplate extends Response {
+
+ /** 告警模板ID */
+ @SerializedName("TemplateID")
+ private Integer templateID;
+
+ public Integer getTemplateID() {
+ return templateID;
+ }
+
+ public void setTemplateID(Integer templateID) {
+ this.templateID = templateID;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/DeleteAlertStrategyTemplateRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/DeleteAlertStrategyTemplateRequest.java
new file mode 100644
index 00000000..7ac62739
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/DeleteAlertStrategyTemplateRequest.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class DeleteAlertStrategyTemplateRequest extends Request {
+
+ /**
+ * 项目ID。不填写为默认项目,子帐号必须填写。
+ * 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 告警模板ID(支持批量删除) */
+ @NotEmpty
+ @UCloudParam("TemplateID")
+ private List templateID;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public List getTemplateID() {
+ return templateID;
+ }
+
+ public void setTemplateID(List templateID) {
+ this.templateID = templateID;
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/DeleteAlertStrategyTemplateResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/DeleteAlertStrategyTemplateResponse.java
new file mode 100644
index 00000000..8fe1b412
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/DeleteAlertStrategyTemplateResponse.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+public class DeleteAlertStrategyTemplateResponse extends Response {
+
+ /** 删除告警模板返回对象 */
+ @SerializedName("Data")
+ private DelAlertTemplate data;
+
+ public DelAlertTemplate getData() {
+ return data;
+ }
+
+ public void setData(DelAlertTemplate data) {
+ this.data = data;
+ }
+
+ public static class DelAlertTemplate extends Response {
+
+ /** 模板ID */
+ @SerializedName("TemplateID")
+ private List templateID;
+
+ public List getTemplateID() {
+ return templateID;
+ }
+
+ public void setTemplateID(List templateID) {
+ this.templateID = templateID;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/EnableAlertStrategyRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/EnableAlertStrategyRequest.java
new file mode 100644
index 00000000..9e29760a
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/EnableAlertStrategyRequest.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+public class EnableAlertStrategyRequest extends Request {
+
+ /**
+ * 项目ID。不填写为默认项目,子帐号必须填写。
+ * 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 告警策略id */
+ @NotEmpty
+ @UCloudParam("AlertStrategyID")
+ private Integer alertStrategyID;
+
+ /** 启用状态0 停用 1 启用 */
+ @NotEmpty
+ @UCloudParam("Status")
+ private Integer status;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public Integer getAlertStrategyID() {
+ return alertStrategyID;
+ }
+
+ public void setAlertStrategyID(Integer alertStrategyID) {
+ this.alertStrategyID = alertStrategyID;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/EnableAlertStrategyResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/EnableAlertStrategyResponse.java
new file mode 100644
index 00000000..528ac1d1
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/EnableAlertStrategyResponse.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+public class EnableAlertStrategyResponse extends Response {
+
+ /** 返回数据 */
+ @SerializedName("Data")
+ private AlertStrategyId data;
+
+ public AlertStrategyId getData() {
+ return data;
+ }
+
+ public void setData(AlertStrategyId data) {
+ this.data = data;
+ }
+
+ public static class AlertStrategyId extends Response {
+
+ /** 告警策略id */
+ @SerializedName("AlertStrategyID")
+ private Integer alertStrategyID;
+
+ public Integer getAlertStrategyID() {
+ return alertStrategyID;
+ }
+
+ public void setAlertStrategyID(Integer alertStrategyID) {
+ this.alertStrategyID = alertStrategyID;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/GetProductMetricsRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/GetProductMetricsRequest.java
new file mode 100644
index 00000000..29e01511
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/GetProductMetricsRequest.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+public class GetProductMetricsRequest extends Request {
+
+ /** 云产品key 例如 uhost */
+ @NotEmpty
+ @UCloudParam("ProductKey")
+ private String productKey;
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/GetProductMetricsResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/GetProductMetricsResponse.java
new file mode 100644
index 00000000..9683690b
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/GetProductMetricsResponse.java
@@ -0,0 +1,482 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+public class GetProductMetricsResponse extends Response {
+
+ /** 返回数据 */
+ @SerializedName("Data")
+ private GetProductMetricsRespData data;
+
+ public GetProductMetricsRespData getData() {
+ return data;
+ }
+
+ public void setData(GetProductMetricsRespData data) {
+ this.data = data;
+ }
+
+ public static class ConversionRule extends Response {
+
+ /** 来源 */
+ @SerializedName("From")
+ private String from;
+
+ /** 目标 */
+ @SerializedName("To")
+ private String to;
+
+ /** 转换因子 */
+ @SerializedName("ConversionFactor")
+ private Integer conversionFactor;
+
+ public String getFrom() {
+ return from;
+ }
+
+ public void setFrom(String from) {
+ this.from = from;
+ }
+
+ public String getTo() {
+ return to;
+ }
+
+ public void setTo(String to) {
+ this.to = to;
+ }
+
+ public Integer getConversionFactor() {
+ return conversionFactor;
+ }
+
+ public void setConversionFactor(Integer conversionFactor) {
+ this.conversionFactor = conversionFactor;
+ }
+ }
+
+ public static class GetProductMetricsRespData extends Response {
+
+ /** 查询结果总数 */
+ @SerializedName("Total")
+ private Integer total;
+
+ /** 指标列表 */
+ @SerializedName("List")
+ private List list;
+
+ /** 单位转换信息 */
+ @SerializedName("UnitConfigs")
+ private List unitConfigs;
+
+ public Integer getTotal() {
+ return total;
+ }
+
+ public void setTotal(Integer total) {
+ this.total = total;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+
+ public List getUnitConfigs() {
+ return unitConfigs;
+ }
+
+ public void setUnitConfigs(List unitConfigs) {
+ this.unitConfigs = unitConfigs;
+ }
+ }
+
+ public static class Metirc extends Response {
+
+ /** 云产品ID */
+ @SerializedName("ProductType")
+ private Integer productType;
+
+ /** 单位ID */
+ @SerializedName("UnitID")
+ private Integer unitID;
+
+ /** 指标ID */
+ @SerializedName("MetricID")
+ private Integer metricID;
+
+ /** 指标唯一标识 (uhost_cpu_usage) */
+ @SerializedName("Metric")
+ private String metric;
+
+ /** 指标英文名称 */
+ @SerializedName("MetricEnName")
+ private String metricEnName;
+
+ /** 指标中文名称 */
+ @SerializedName("MetricChName")
+ private String metricChName;
+
+ /** 指标英文描述 */
+ @SerializedName("MetricEnDesc")
+ private String metricEnDesc;
+
+ /** 指标中文描述 */
+ @SerializedName("MetricChDesc")
+ private String metricChDesc;
+
+ /** 指标分类/指标组 */
+ @SerializedName("MetricGroup")
+ private String metricGroup;
+
+ /** 上报频率毫秒 */
+ @SerializedName("FrequencyMs")
+ private Integer frequencyMs;
+
+ /** 单位 */
+ @SerializedName("Unit")
+ private MetricUnit unit;
+
+ /** 创建者 */
+ @SerializedName("CreatedBy")
+ private String createdBy;
+
+ /** 创建时间 */
+ @SerializedName("CreatedAt")
+ private String createdAt;
+
+ /** 修改者 */
+ @SerializedName("UpdatedBy")
+ private String updatedBy;
+
+ /** 修改时间 */
+ @SerializedName("UpdatedAt")
+ private String updatedAt;
+
+ public Integer getProductType() {
+ return productType;
+ }
+
+ public void setProductType(Integer productType) {
+ this.productType = productType;
+ }
+
+ public Integer getUnitID() {
+ return unitID;
+ }
+
+ public void setUnitID(Integer unitID) {
+ this.unitID = unitID;
+ }
+
+ public Integer getMetricID() {
+ return metricID;
+ }
+
+ public void setMetricID(Integer metricID) {
+ this.metricID = metricID;
+ }
+
+ public String getMetric() {
+ return metric;
+ }
+
+ public void setMetric(String metric) {
+ this.metric = metric;
+ }
+
+ public String getMetricEnName() {
+ return metricEnName;
+ }
+
+ public void setMetricEnName(String metricEnName) {
+ this.metricEnName = metricEnName;
+ }
+
+ public String getMetricChName() {
+ return metricChName;
+ }
+
+ public void setMetricChName(String metricChName) {
+ this.metricChName = metricChName;
+ }
+
+ public String getMetricEnDesc() {
+ return metricEnDesc;
+ }
+
+ public void setMetricEnDesc(String metricEnDesc) {
+ this.metricEnDesc = metricEnDesc;
+ }
+
+ public String getMetricChDesc() {
+ return metricChDesc;
+ }
+
+ public void setMetricChDesc(String metricChDesc) {
+ this.metricChDesc = metricChDesc;
+ }
+
+ public String getMetricGroup() {
+ return metricGroup;
+ }
+
+ public void setMetricGroup(String metricGroup) {
+ this.metricGroup = metricGroup;
+ }
+
+ public Integer getFrequencyMs() {
+ return frequencyMs;
+ }
+
+ public void setFrequencyMs(Integer frequencyMs) {
+ this.frequencyMs = frequencyMs;
+ }
+
+ public MetricUnit getUnit() {
+ return unit;
+ }
+
+ public void setUnit(MetricUnit unit) {
+ this.unit = unit;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(String createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+ public String getUpdatedAt() {
+ return updatedAt;
+ }
+
+ public void setUpdatedAt(String updatedAt) {
+ this.updatedAt = updatedAt;
+ }
+ }
+
+ public static class MetricUnit extends Response {
+
+ /** 单位id */
+ @SerializedName("UnitID")
+ private Integer unitID;
+
+ /** GroupId */
+ @SerializedName("GroupId")
+ private Integer groupId;
+
+ /** 单位英文名称 */
+ @SerializedName("UnitEnName")
+ private String unitEnName;
+
+ /** 单位中文名称 */
+ @SerializedName("UnitChName")
+ private String unitChName;
+
+ /** 单位描述 */
+ @SerializedName("UnitDesc")
+ private String unitDesc;
+
+ /** 转换因子 */
+ @SerializedName("ConversionFactor")
+ private Integer conversionFactor;
+
+ /** 创建人 */
+ @SerializedName("CreatedBy")
+ private String createdBy;
+
+ /** 修改人 */
+ @SerializedName("UpdatedBy")
+ private String updatedBy;
+
+ /** 创建时间 */
+ @SerializedName("CreatedAt")
+ private String createdAt;
+
+ /** 修改时间 */
+ @SerializedName("UpdatedAt")
+ private String updatedAt;
+
+ /** 删除时间 */
+ @SerializedName("DeletedAt")
+ private Integer deletedAt;
+
+ public Integer getUnitID() {
+ return unitID;
+ }
+
+ public void setUnitID(Integer unitID) {
+ this.unitID = unitID;
+ }
+
+ public Integer getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(Integer groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getUnitEnName() {
+ return unitEnName;
+ }
+
+ public void setUnitEnName(String unitEnName) {
+ this.unitEnName = unitEnName;
+ }
+
+ public String getUnitChName() {
+ return unitChName;
+ }
+
+ public void setUnitChName(String unitChName) {
+ this.unitChName = unitChName;
+ }
+
+ public String getUnitDesc() {
+ return unitDesc;
+ }
+
+ public void setUnitDesc(String unitDesc) {
+ this.unitDesc = unitDesc;
+ }
+
+ public Integer getConversionFactor() {
+ return conversionFactor;
+ }
+
+ public void setConversionFactor(Integer conversionFactor) {
+ this.conversionFactor = conversionFactor;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+ public String getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(String createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ public String getUpdatedAt() {
+ return updatedAt;
+ }
+
+ public void setUpdatedAt(String updatedAt) {
+ this.updatedAt = updatedAt;
+ }
+
+ public Integer getDeletedAt() {
+ return deletedAt;
+ }
+
+ public void setDeletedAt(Integer deletedAt) {
+ this.deletedAt = deletedAt;
+ }
+ }
+
+ public static class MetricUnitConfig extends Response {
+
+ /** 指标中文名列表 */
+ @SerializedName("UnitCnNames")
+ private List unitCnNames;
+
+ /** 指标英文名列表 */
+ @SerializedName("UnitEnNames")
+ private List unitEnNames;
+
+ /** 转换因子 */
+ @SerializedName("ConversionFactor")
+ private Integer conversionFactor;
+
+ /** 转换规则 */
+ @SerializedName("ConversionRules")
+ private List conversionRules;
+
+ public List getUnitCnNames() {
+ return unitCnNames;
+ }
+
+ public void setUnitCnNames(List unitCnNames) {
+ this.unitCnNames = unitCnNames;
+ }
+
+ public List getUnitEnNames() {
+ return unitEnNames;
+ }
+
+ public void setUnitEnNames(List unitEnNames) {
+ this.unitEnNames = unitEnNames;
+ }
+
+ public Integer getConversionFactor() {
+ return conversionFactor;
+ }
+
+ public void setConversionFactor(Integer conversionFactor) {
+ this.conversionFactor = conversionFactor;
+ }
+
+ public List getConversionRules() {
+ return conversionRules;
+ }
+
+ public void setConversionRules(List conversionRules) {
+ this.conversionRules = conversionRules;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertRecordRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertRecordRequest.java
new file mode 100644
index 00000000..e4ebf154
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertRecordRequest.java
@@ -0,0 +1,161 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class ListAlertRecordRequest extends Request {
+
+ /** 项目ID。 */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 开始时间,查询告警记录开始时间(不支持查询距当前时间一年前的数据) */
+ @NotEmpty
+ @UCloudParam("StartAt")
+ private Integer startAt;
+
+ /** 结束时间,查询告警记录结束时间(查询开始时间和结束时间不能超过一个月) */
+ @NotEmpty
+ @UCloudParam("EndAt")
+ private Integer endAt;
+
+ /** 模糊查询(支持资源id模糊搜索) */
+ @UCloudParam("Fuzzy")
+ private String fuzzy;
+
+ /** */
+ @UCloudParam("Filter")
+ private Filter filter;
+
+ /** 排序(默认根据告警发生时间倒序) */
+ @UCloudParam("OrderType")
+ private String orderType;
+
+ /** 查询返回数量,默认值300,最大值:300。 */
+ @UCloudParam("Limit")
+ private Integer limit;
+
+ /** 数据偏移量 (默认0) */
+ @UCloudParam("Offset")
+ private Integer offset;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public Integer getStartAt() {
+ return startAt;
+ }
+
+ public void setStartAt(Integer startAt) {
+ this.startAt = startAt;
+ }
+
+ public Integer getEndAt() {
+ return endAt;
+ }
+
+ public void setEndAt(Integer endAt) {
+ this.endAt = endAt;
+ }
+
+ public String getFuzzy() {
+ return fuzzy;
+ }
+
+ public void setFuzzy(String fuzzy) {
+ this.fuzzy = fuzzy;
+ }
+
+ public Filter getFilter() {
+ return filter;
+ }
+
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ public String getOrderType() {
+ return orderType;
+ }
+
+ public void setOrderType(String orderType) {
+ this.orderType = orderType;
+ }
+
+ public Integer getLimit() {
+ return limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+
+ public Integer getOffset() {
+ return offset;
+ }
+
+ public void setOffset(Integer offset) {
+ this.offset = offset;
+ }
+
+ public static class Filter extends Request {
+
+ /** 产品类型,根据产品类型精确搜索对应的告警记录 */
+ @UCloudParam("ProductTypes")
+ private List productTypes;
+
+ /** 告警级别,根据告警级别精确搜索对应的告警记录 */
+ @UCloudParam("Levels")
+ private List levels;
+
+ /** 告警状态,根据告警状态精确搜索对应的告警记录 */
+ @UCloudParam("Status")
+ private List status;
+
+ public List getProductTypes() {
+ return productTypes;
+ }
+
+ public void setProductTypes(List productTypes) {
+ this.productTypes = productTypes;
+ }
+
+ public List getLevels() {
+ return levels;
+ }
+
+ public void setLevels(List levels) {
+ this.levels = levels;
+ }
+
+ public List getStatus() {
+ return status;
+ }
+
+ public void setStatus(List status) {
+ this.status = status;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertRecordResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertRecordResponse.java
new file mode 100644
index 00000000..38f1a82b
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertRecordResponse.java
@@ -0,0 +1,302 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+public class ListAlertRecordResponse extends Response {
+
+ /** 告警记录集合 */
+ @SerializedName("Data")
+ private List data;
+
+ /** 告警记录总数 */
+ @SerializedName("TotalCount")
+ private Integer totalCount;
+
+ public List getData() {
+ return data;
+ }
+
+ public void setData(List data) {
+ this.data = data;
+ }
+
+ public Integer getTotalCount() {
+ return totalCount;
+ }
+
+ public void setTotalCount(Integer totalCount) {
+ this.totalCount = totalCount;
+ }
+
+ public static class AlertRecord extends Response {
+
+ /** 可用区 */
+ @SerializedName("Region")
+ private String region;
+
+ /** 告警记录RecordID */
+ @SerializedName("RecordID")
+ private Integer recordID;
+
+ /** 项目ProjectID */
+ @SerializedName("ProjectID")
+ private Integer projectID;
+
+ /** 告警记录触发告警策略名称 */
+ @SerializedName("StrategyName")
+ private String strategyName;
+
+ /** 产品类型 */
+ @SerializedName("ProductType")
+ private Integer productType;
+
+ /** 产品类型名称 */
+ @SerializedName("ProductName")
+ private String productName;
+
+ /** 资源id */
+ @SerializedName("ResourceID")
+ private String resourceID;
+
+ /** 指标id */
+ @SerializedName("MetricID")
+ private Integer metricID;
+
+ /** 指标名称 */
+ @SerializedName("MetricName")
+ private String metricName;
+
+ /** 指标单位名称 */
+ @SerializedName("UnitName")
+ private String unitName;
+
+ /** 告警记录触发告警策略Id */
+ @SerializedName("StrategyID")
+ private Integer strategyID;
+
+ /** 告警记录触发告警规则Id */
+ @SerializedName("RuleID")
+ private Integer ruleID;
+
+ /** 告警点tag信息 */
+ @SerializedName("Tag")
+ private List tag;
+
+ /** 告警当前值 */
+ @SerializedName("Value")
+ private Integer value;
+
+ /** 比较符 */
+ @SerializedName("ThresholdCompare")
+ private Integer thresholdCompare;
+
+ /** 告警阈值 */
+ @SerializedName("ThresholdValue")
+ private Integer thresholdValue;
+
+ /** 告警屏蔽规则id(如果配置了屏蔽规则,并且满足条件) */
+ @SerializedName("ShieldRuleID")
+ private Integer shieldRuleID;
+
+ /** 告警等级 */
+ @SerializedName("Level")
+ private String level;
+
+ /** 告警状态 */
+ @SerializedName("Status")
+ private String status;
+
+ /** 告警触发时间 */
+ @SerializedName("StartAt")
+ private Integer startAt;
+
+ /** 告警恢复时间 */
+ @SerializedName("EndAt")
+ private Integer endAt;
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public Integer getRecordID() {
+ return recordID;
+ }
+
+ public void setRecordID(Integer recordID) {
+ this.recordID = recordID;
+ }
+
+ public Integer getProjectID() {
+ return projectID;
+ }
+
+ public void setProjectID(Integer projectID) {
+ this.projectID = projectID;
+ }
+
+ public String getStrategyName() {
+ return strategyName;
+ }
+
+ public void setStrategyName(String strategyName) {
+ this.strategyName = strategyName;
+ }
+
+ public Integer getProductType() {
+ return productType;
+ }
+
+ public void setProductType(Integer productType) {
+ this.productType = productType;
+ }
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public Integer getMetricID() {
+ return metricID;
+ }
+
+ public void setMetricID(Integer metricID) {
+ this.metricID = metricID;
+ }
+
+ public String getMetricName() {
+ return metricName;
+ }
+
+ public void setMetricName(String metricName) {
+ this.metricName = metricName;
+ }
+
+ public String getUnitName() {
+ return unitName;
+ }
+
+ public void setUnitName(String unitName) {
+ this.unitName = unitName;
+ }
+
+ public Integer getStrategyID() {
+ return strategyID;
+ }
+
+ public void setStrategyID(Integer strategyID) {
+ this.strategyID = strategyID;
+ }
+
+ public Integer getRuleID() {
+ return ruleID;
+ }
+
+ public void setRuleID(Integer ruleID) {
+ this.ruleID = ruleID;
+ }
+
+ public List getTag() {
+ return tag;
+ }
+
+ public void setTag(List tag) {
+ this.tag = tag;
+ }
+
+ public Integer getValue() {
+ return value;
+ }
+
+ public void setValue(Integer value) {
+ this.value = value;
+ }
+
+ public Integer getThresholdCompare() {
+ return thresholdCompare;
+ }
+
+ public void setThresholdCompare(Integer thresholdCompare) {
+ this.thresholdCompare = thresholdCompare;
+ }
+
+ public Integer getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Integer thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public Integer getShieldRuleID() {
+ return shieldRuleID;
+ }
+
+ public void setShieldRuleID(Integer shieldRuleID) {
+ this.shieldRuleID = shieldRuleID;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public Integer getStartAt() {
+ return startAt;
+ }
+
+ public void setStartAt(Integer startAt) {
+ this.startAt = startAt;
+ }
+
+ public Integer getEndAt() {
+ return endAt;
+ }
+
+ public void setEndAt(Integer endAt) {
+ this.endAt = endAt;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyRequest.java
new file mode 100644
index 00000000..5d485768
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyRequest.java
@@ -0,0 +1,135 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class ListAlertStrategyRequest extends Request {
+
+ /** 项目ID */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 模糊查询(支持告警策略名称模糊搜索) */
+ @UCloudParam("Fuzzy")
+ private String fuzzy;
+
+ /** */
+ @UCloudParam("Filter")
+ private Filter filter;
+
+ /** 资源id集合,根据资源id返回绑定的告警策略列表 */
+ @UCloudParam("Resources")
+ private List resources;
+
+ /** 查询返回数量,默认值300,最大值:300。 */
+ @UCloudParam("Limit")
+ private Integer limit;
+
+ /** 数据偏移量 (默认0) */
+ @UCloudParam("Offset")
+ private Integer offset;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getFuzzy() {
+ return fuzzy;
+ }
+
+ public void setFuzzy(String fuzzy) {
+ this.fuzzy = fuzzy;
+ }
+
+ public Filter getFilter() {
+ return filter;
+ }
+
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ public List getResources() {
+ return resources;
+ }
+
+ public void setResources(List resources) {
+ this.resources = resources;
+ }
+
+ public Integer getLimit() {
+ return limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+
+ public Integer getOffset() {
+ return offset;
+ }
+
+ public void setOffset(Integer offset) {
+ this.offset = offset;
+ }
+
+ public static class Filter extends Request {
+
+ /** 产品类型,根据产品类型精确搜索对应的告警策略 */
+ @UCloudParam("ProductTypes")
+ private List productTypes;
+
+ /** 告警策略id,根据策略id获取告警策略列表 */
+ @UCloudParam("AlertStrategyIDs")
+ private List alertStrategyIDs;
+
+ /** 告警策略状态,根据告警策略状态精确搜索对应的告警策略 */
+ @UCloudParam("Status")
+ private List status;
+
+ public List getProductTypes() {
+ return productTypes;
+ }
+
+ public void setProductTypes(List productTypes) {
+ this.productTypes = productTypes;
+ }
+
+ public List getAlertStrategyIDs() {
+ return alertStrategyIDs;
+ }
+
+ public void setAlertStrategyIDs(List alertStrategyIDs) {
+ this.alertStrategyIDs = alertStrategyIDs;
+ }
+
+ public List getStatus() {
+ return status;
+ }
+
+ public void setStatus(List status) {
+ this.status = status;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyResponse.java
new file mode 100644
index 00000000..cfce2b0e
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyResponse.java
@@ -0,0 +1,437 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+public class ListAlertStrategyResponse extends Response {
+
+ /** 告警策略集合 */
+ @SerializedName("Data")
+ private List data;
+
+ /** 告警策略总数 */
+ @SerializedName("TotalCount")
+ private Integer totalCount;
+
+ /** 链路ID */
+ @SerializedName("TraceId")
+ private String traceId;
+
+ public List getData() {
+ return data;
+ }
+
+ public void setData(List data) {
+ this.data = data;
+ }
+
+ public Integer getTotalCount() {
+ return totalCount;
+ }
+
+ public void setTotalCount(Integer totalCount) {
+ this.totalCount = totalCount;
+ }
+
+ public String getTraceId() {
+ return traceId;
+ }
+
+ public void setTraceId(String traceId) {
+ this.traceId = traceId;
+ }
+
+ public static class AlertRule extends Response {
+
+ /** 规则ID */
+ @SerializedName("RuleID")
+ private Integer ruleID;
+
+ /** 规则指标ID。参考该类型产品下返回的指标列表GetProductMetrics */
+ @SerializedName("MetricID")
+ private Integer metricID;
+
+ /** 指标名称 */
+ @SerializedName("MetricName")
+ private String metricName;
+
+ /** 阈值比较方式 枚举值比较方式: 1->= 2-<= 3-> 4-< 5-== 6-!= */
+ @SerializedName("ThresholdCompare")
+ private Integer thresholdCompare;
+
+ /** 触发阈值 */
+ @SerializedName("ThresholdValue")
+ private Double thresholdValue;
+
+ /** 触发次数 */
+ @SerializedName("TriggerCount")
+ private Integer triggerCount;
+
+ /** 触发周期。枚举值:continuous连续 exponent 指数 single 不重复 */
+ @SerializedName("SendPeriodType")
+ private String sendPeriodType;
+
+ /** 发送间隔 */
+ @SerializedName("SendInterval")
+ private Integer sendInterval;
+
+ /** 告警等级。枚举值:P0,P1,P2,P3 */
+ @SerializedName("Level")
+ private String level;
+
+ /** 告警状态。枚举值:0-关闭 1-开启 */
+ @SerializedName("Status")
+ private Integer status;
+
+ /** 单位id */
+ @SerializedName("UnitID")
+ private Integer unitID;
+
+ /** 单位名称 */
+ @SerializedName("UnitName")
+ private String unitName;
+
+ public Integer getRuleID() {
+ return ruleID;
+ }
+
+ public void setRuleID(Integer ruleID) {
+ this.ruleID = ruleID;
+ }
+
+ public Integer getMetricID() {
+ return metricID;
+ }
+
+ public void setMetricID(Integer metricID) {
+ this.metricID = metricID;
+ }
+
+ public String getMetricName() {
+ return metricName;
+ }
+
+ public void setMetricName(String metricName) {
+ this.metricName = metricName;
+ }
+
+ public Integer getThresholdCompare() {
+ return thresholdCompare;
+ }
+
+ public void setThresholdCompare(Integer thresholdCompare) {
+ this.thresholdCompare = thresholdCompare;
+ }
+
+ public Double getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Double thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public Integer getTriggerCount() {
+ return triggerCount;
+ }
+
+ public void setTriggerCount(Integer triggerCount) {
+ this.triggerCount = triggerCount;
+ }
+
+ public String getSendPeriodType() {
+ return sendPeriodType;
+ }
+
+ public void setSendPeriodType(String sendPeriodType) {
+ this.sendPeriodType = sendPeriodType;
+ }
+
+ public Integer getSendInterval() {
+ return sendInterval;
+ }
+
+ public void setSendInterval(Integer sendInterval) {
+ this.sendInterval = sendInterval;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public Integer getUnitID() {
+ return unitID;
+ }
+
+ public void setUnitID(Integer unitID) {
+ this.unitID = unitID;
+ }
+
+ public String getUnitName() {
+ return unitName;
+ }
+
+ public void setUnitName(String unitName) {
+ this.unitName = unitName;
+ }
+ }
+
+ public static class AlertStrategy extends Response {
+
+ /** 告警规则集合 */
+ @SerializedName("RuleSet")
+ private List ruleSet;
+
+ /** 告警策略Id */
+ @SerializedName("AlertStrategyID")
+ private Integer alertStrategyID;
+
+ /** 告警策略名称 */
+ @SerializedName("Name")
+ private String name;
+
+ /** 资源类型 */
+ @SerializedName("ProductType")
+ private Integer productType;
+
+ /** 资源类型名称 */
+ @SerializedName("ProductKey")
+ private String productKey;
+
+ /** 告警规则配置类型(基于模板配置、基于手工配置) */
+ @SerializedName("ConfigMode")
+ private Integer configMode;
+
+ /** 模板Id */
+ @SerializedName("TemplateId")
+ private Integer templateId;
+
+ /** 通知方式(通知组:group,通知人:user) */
+ @SerializedName("NotifyType")
+ private String notifyType;
+
+ /** 通知人用户id集合 */
+ @SerializedName("NotifyUserIDs")
+ private List notifyUserIDs;
+
+ /** 通知组id集合 */
+ @SerializedName("NotifyGroupIDs")
+ private List notifyGroupIDs;
+
+ /** 通知渠道('email', 'sms', 'webhook') */
+ @SerializedName("NotifyChannelDs")
+ private List notifyChannelDs;
+
+ /** 回调语言(cn,en) */
+ @SerializedName("CallbackLanguage")
+ private String callbackLanguage;
+
+ /** 回调地址 */
+ @SerializedName("CallbackUrls")
+ private List callbackUrls;
+
+ /** 告警策略状态 */
+ @SerializedName("Status")
+ private Integer status;
+
+ /** 告警策略备注 */
+ @SerializedName("Remark")
+ private String remark;
+
+ /** 创建人 */
+ @SerializedName("CreatedBy")
+ private String createdBy;
+
+ /** 更新人 */
+ @SerializedName("UpdatedBy")
+ private String updatedBy;
+
+ /** 创建时间 */
+ @SerializedName("CreatedAt")
+ private Integer createdAt;
+
+ /** 更新时间 */
+ @SerializedName("UpdatedAt")
+ private Integer updatedAt;
+
+ public List getRuleSet() {
+ return ruleSet;
+ }
+
+ public void setRuleSet(List ruleSet) {
+ this.ruleSet = ruleSet;
+ }
+
+ public Integer getAlertStrategyID() {
+ return alertStrategyID;
+ }
+
+ public void setAlertStrategyID(Integer alertStrategyID) {
+ this.alertStrategyID = alertStrategyID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getProductType() {
+ return productType;
+ }
+
+ public void setProductType(Integer productType) {
+ this.productType = productType;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public Integer getConfigMode() {
+ return configMode;
+ }
+
+ public void setConfigMode(Integer configMode) {
+ this.configMode = configMode;
+ }
+
+ public Integer getTemplateId() {
+ return templateId;
+ }
+
+ public void setTemplateId(Integer templateId) {
+ this.templateId = templateId;
+ }
+
+ public String getNotifyType() {
+ return notifyType;
+ }
+
+ public void setNotifyType(String notifyType) {
+ this.notifyType = notifyType;
+ }
+
+ public List getNotifyUserIDs() {
+ return notifyUserIDs;
+ }
+
+ public void setNotifyUserIDs(List notifyUserIDs) {
+ this.notifyUserIDs = notifyUserIDs;
+ }
+
+ public List getNotifyGroupIDs() {
+ return notifyGroupIDs;
+ }
+
+ public void setNotifyGroupIDs(List notifyGroupIDs) {
+ this.notifyGroupIDs = notifyGroupIDs;
+ }
+
+ public List getNotifyChannelDs() {
+ return notifyChannelDs;
+ }
+
+ public void setNotifyChannelDs(List notifyChannelDs) {
+ this.notifyChannelDs = notifyChannelDs;
+ }
+
+ public String getCallbackLanguage() {
+ return callbackLanguage;
+ }
+
+ public void setCallbackLanguage(String callbackLanguage) {
+ this.callbackLanguage = callbackLanguage;
+ }
+
+ public List getCallbackUrls() {
+ return callbackUrls;
+ }
+
+ public void setCallbackUrls(List callbackUrls) {
+ this.callbackUrls = callbackUrls;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+ public Integer getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(Integer createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ public Integer getUpdatedAt() {
+ return updatedAt;
+ }
+
+ public void setUpdatedAt(Integer updatedAt) {
+ this.updatedAt = updatedAt;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyTemplateRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyTemplateRequest.java
new file mode 100644
index 00000000..3235b2b4
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyTemplateRequest.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class ListAlertStrategyTemplateRequest extends Request {
+
+ /** 项目ID。不填写为默认项目,子帐号必须填写。 请参考GetProjectList接口 */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** */
+ @UCloudParam("Filter")
+ private Filter filter;
+
+ /** 查询返回数量,默认值300,最大值:300。 */
+ @UCloudParam("Limit")
+ private Integer limit;
+
+ /** 数据偏移量 (默认0) */
+ @UCloudParam("Offset")
+ private Integer offset;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public Filter getFilter() {
+ return filter;
+ }
+
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ public Integer getLimit() {
+ return limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+
+ public Integer getOffset() {
+ return offset;
+ }
+
+ public void setOffset(Integer offset) {
+ this.offset = offset;
+ }
+
+ public static class Filter extends Request {
+
+ /** 模板id集合,根据模板id获取告警条件模板列表 */
+ @UCloudParam("TemplateIDs")
+ private List templateIDs;
+
+ public List getTemplateIDs() {
+ return templateIDs;
+ }
+
+ public void setTemplateIDs(List templateIDs) {
+ this.templateIDs = templateIDs;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyTemplateResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyTemplateResponse.java
new file mode 100644
index 00000000..d94e1c8e
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListAlertStrategyTemplateResponse.java
@@ -0,0 +1,281 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+public class ListAlertStrategyTemplateResponse extends Response {
+
+ /** 条件模板列表 */
+ @SerializedName("Data")
+ private List data;
+
+ /** 条件模板总条数 */
+ @SerializedName("TotalCount")
+ private Integer totalCount;
+
+ public List getData() {
+ return data;
+ }
+
+ public void setData(List data) {
+ this.data = data;
+ }
+
+ public Integer getTotalCount() {
+ return totalCount;
+ }
+
+ public void setTotalCount(Integer totalCount) {
+ this.totalCount = totalCount;
+ }
+
+ public static class AlertRule extends Response {
+
+ /** 规则ID */
+ @SerializedName("RuleID")
+ private Integer ruleID;
+
+ /** 规则指标ID。参考该类型产品下返回的指标列表GetProductMetrics */
+ @SerializedName("MetricID")
+ private Integer metricID;
+
+ /** 指标名称 */
+ @SerializedName("MetricName")
+ private String metricName;
+
+ /** 阈值比较方式 枚举值比较方式: 1->= 2-<= 3-> 4-< 5-== 6-!= */
+ @SerializedName("ThresholdCompare")
+ private Integer thresholdCompare;
+
+ /** 触发阈值 */
+ @SerializedName("ThresholdValue")
+ private Double thresholdValue;
+
+ /** 触发次数 */
+ @SerializedName("TriggerCount")
+ private Integer triggerCount;
+
+ /** 触发周期。枚举值:continuous连续 exponent 指数 single 不重复 */
+ @SerializedName("SendPeriodType")
+ private String sendPeriodType;
+
+ /** 发送间隔 */
+ @SerializedName("SendInterval")
+ private Integer sendInterval;
+
+ /** 告警等级。枚举值:P0,P1,P2,P3 */
+ @SerializedName("Level")
+ private String level;
+
+ /** 告警状态。枚举值:0-关闭 1-开启 */
+ @SerializedName("Status")
+ private Integer status;
+
+ /** 单位id */
+ @SerializedName("UnitID")
+ private Integer unitID;
+
+ /** 单位名称 */
+ @SerializedName("UnitName")
+ private String unitName;
+
+ public Integer getRuleID() {
+ return ruleID;
+ }
+
+ public void setRuleID(Integer ruleID) {
+ this.ruleID = ruleID;
+ }
+
+ public Integer getMetricID() {
+ return metricID;
+ }
+
+ public void setMetricID(Integer metricID) {
+ this.metricID = metricID;
+ }
+
+ public String getMetricName() {
+ return metricName;
+ }
+
+ public void setMetricName(String metricName) {
+ this.metricName = metricName;
+ }
+
+ public Integer getThresholdCompare() {
+ return thresholdCompare;
+ }
+
+ public void setThresholdCompare(Integer thresholdCompare) {
+ this.thresholdCompare = thresholdCompare;
+ }
+
+ public Double getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Double thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public Integer getTriggerCount() {
+ return triggerCount;
+ }
+
+ public void setTriggerCount(Integer triggerCount) {
+ this.triggerCount = triggerCount;
+ }
+
+ public String getSendPeriodType() {
+ return sendPeriodType;
+ }
+
+ public void setSendPeriodType(String sendPeriodType) {
+ this.sendPeriodType = sendPeriodType;
+ }
+
+ public Integer getSendInterval() {
+ return sendInterval;
+ }
+
+ public void setSendInterval(Integer sendInterval) {
+ this.sendInterval = sendInterval;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public Integer getUnitID() {
+ return unitID;
+ }
+
+ public void setUnitID(Integer unitID) {
+ this.unitID = unitID;
+ }
+
+ public String getUnitName() {
+ return unitName;
+ }
+
+ public void setUnitName(String unitName) {
+ this.unitName = unitName;
+ }
+ }
+
+ public static class ListAlertTemplate extends Response {
+
+ /** 公司id */
+ @SerializedName("CompanyID")
+ private Integer companyID;
+
+ /** 模板Id */
+ @SerializedName("TemplateID")
+ private Integer templateID;
+
+ /** 告警模板名称 */
+ @SerializedName("Name")
+ private String name;
+
+ /** 产品类型(数值型)。参考ListMonitorProduct获取监控对象类型列表 */
+ @SerializedName("ProductType")
+ private Integer productType;
+
+ /** 产品类型(字符型)。参考ListMonitorProduct获取监控对象类型列表 */
+ @SerializedName("ProductKey")
+ private String productKey;
+
+ /** 告警条件规则 */
+ @SerializedName("RuleSet")
+ private List ruleSet;
+
+ /** 条件模板备注 */
+ @SerializedName("Remark")
+ private String remark;
+
+ public Integer getCompanyID() {
+ return companyID;
+ }
+
+ public void setCompanyID(Integer companyID) {
+ this.companyID = companyID;
+ }
+
+ public Integer getTemplateID() {
+ return templateID;
+ }
+
+ public void setTemplateID(Integer templateID) {
+ this.templateID = templateID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getProductType() {
+ return productType;
+ }
+
+ public void setProductType(Integer productType) {
+ this.productType = productType;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public List getRuleSet() {
+ return ruleSet;
+ }
+
+ public void setRuleSet(List ruleSet) {
+ this.ruleSet = ruleSet;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListMonitorProductRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListMonitorProductRequest.java
new file mode 100644
index 00000000..29c796e3
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListMonitorProductRequest.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.request.Request;
+
+public class ListMonitorProductRequest extends Request {}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListMonitorProductResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListMonitorProductResponse.java
new file mode 100644
index 00000000..d4cff16d
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ListMonitorProductResponse.java
@@ -0,0 +1,185 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+public class ListMonitorProductResponse extends Response {
+
+ /** 返回数据 */
+ @SerializedName("Data")
+ private ListMonitorProduct data;
+
+ /** 链路ID */
+ @SerializedName("TraceId")
+ private String traceId;
+
+ public ListMonitorProduct getData() {
+ return data;
+ }
+
+ public void setData(ListMonitorProduct data) {
+ this.data = data;
+ }
+
+ public String getTraceId() {
+ return traceId;
+ }
+
+ public void setTraceId(String traceId) {
+ this.traceId = traceId;
+ }
+
+ public static class ListMonitorProduct extends Response {
+
+ /** 查询结果总数 */
+ @SerializedName("Total")
+ private Integer total;
+
+ /** 查询结果列表 */
+ @SerializedName("List")
+ private List list;
+
+ public Integer getTotal() {
+ return total;
+ }
+
+ public void setTotal(Integer total) {
+ this.total = total;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+ }
+
+ public static class Product extends Response {
+
+ /** ID */
+ @SerializedName("Id")
+ private Integer id;
+
+ /** 资源类型ID */
+ @SerializedName("ProductType")
+ private Integer productType;
+
+ /** 资源类型唯一key */
+ @SerializedName("ProductKey")
+ private String productKey;
+
+ /** 产品名称 */
+ @SerializedName("ProductName")
+ private String productName;
+
+ /** 产品子名称 */
+ @SerializedName("ProductName1")
+ private String productName1;
+
+ /** 产品中文名称 */
+ @SerializedName("ProductChName")
+ private String productChName;
+
+ /** 产品英文名称 */
+ @SerializedName("ProductEnName")
+ private String productEnName;
+
+ /** {Type: 1|2, Key:string, Name: string}[] -> JSON字符串 */
+ @SerializedName("Metas")
+ private String metas;
+
+ /** 产品分组 */
+ @SerializedName("ProductGroup")
+ private String productGroup;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getProductType() {
+ return productType;
+ }
+
+ public void setProductType(Integer productType) {
+ this.productType = productType;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public String getProductName1() {
+ return productName1;
+ }
+
+ public void setProductName1(String productName1) {
+ this.productName1 = productName1;
+ }
+
+ public String getProductChName() {
+ return productChName;
+ }
+
+ public void setProductChName(String productChName) {
+ this.productChName = productChName;
+ }
+
+ public String getProductEnName() {
+ return productEnName;
+ }
+
+ public void setProductEnName(String productEnName) {
+ this.productEnName = productEnName;
+ }
+
+ public String getMetas() {
+ return metas;
+ }
+
+ public void setMetas(String metas) {
+ this.metas = metas;
+ }
+
+ public String getProductGroup() {
+ return productGroup;
+ }
+
+ public void setProductGroup(String productGroup) {
+ this.productGroup = productGroup;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ModifyAlertStrategyRemarkRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ModifyAlertStrategyRemarkRequest.java
new file mode 100644
index 00000000..e13b444e
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ModifyAlertStrategyRemarkRequest.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+public class ModifyAlertStrategyRemarkRequest extends Request {
+
+ /**
+ * 项目ID。不填写为默认项目,子帐号必须填写。
+ * 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 策略id */
+ @NotEmpty
+ @UCloudParam("AlertStrategyID")
+ private Integer alertStrategyID;
+
+ /** 策略名称 */
+ @NotEmpty
+ @UCloudParam("Name")
+ private String name;
+
+ /** 策略备注 */
+ @UCloudParam("Remark")
+ private String remark;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public Integer getAlertStrategyID() {
+ return alertStrategyID;
+ }
+
+ public void setAlertStrategyID(Integer alertStrategyID) {
+ this.alertStrategyID = alertStrategyID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ModifyAlertStrategyRemarkResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ModifyAlertStrategyRemarkResponse.java
new file mode 100644
index 00000000..38a96f7a
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/ModifyAlertStrategyRemarkResponse.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+public class ModifyAlertStrategyRemarkResponse extends Response {
+
+ /** 返回数据 */
+ @SerializedName("Data")
+ private AlertStrategyId data;
+
+ public AlertStrategyId getData() {
+ return data;
+ }
+
+ public void setData(AlertStrategyId data) {
+ this.data = data;
+ }
+
+ public static class AlertStrategyId extends Response {
+
+ /** 告警策略id */
+ @SerializedName("AlertStrategyID")
+ private Integer alertStrategyID;
+
+ public Integer getAlertStrategyID() {
+ return alertStrategyID;
+ }
+
+ public void setAlertStrategyID(Integer alertStrategyID) {
+ this.alertStrategyID = alertStrategyID;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSetRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSetRequest.java
new file mode 100644
index 00000000..84c987eb
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSetRequest.java
@@ -0,0 +1,197 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class QueryMetricDataSetRequest extends Request {
+
+ /** 地域。 全局产品可不传,其他类型必传。 */
+ @NotEmpty
+ @UCloudParam("Region")
+ private String region;
+
+ /** 项目ID。 */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 资源类型 */
+ @NotEmpty
+ @UCloudParam("ProductKey")
+ private String productKey;
+
+ /** 开始时间 */
+ @NotEmpty
+ @UCloudParam("StartTime")
+ private Integer startTime;
+
+ /** 截止时间 */
+ @NotEmpty
+ @UCloudParam("EndTime")
+ private Integer endTime;
+
+ /** 计算方式,枚举值如下: raw:原始值, max:最大值, min:最小值, avg:平均值, sum:求和 */
+ @NotEmpty
+ @UCloudParam("CalcMethod")
+ private String calcMethod;
+
+ /**
+ * 周期即:数据查询时,后端上报数据点的频率,选择不同的自定义时间范围,对应的周期不同: 0<时间范围<=1h——周期:1分钟/5分钟 1h<时间范围<=3h——周期:1分钟/5分钟/1小时
+ * 3h<时间范围<=24h——周期:5分钟/1小时 1天<时间范围<=30天——周期:1小时/6小时/24小时 需将周期转化为单位为秒的数值,传入参数
+ */
+ @NotEmpty
+ @UCloudParam("Period")
+ private Integer period;
+
+ /** */
+ @UCloudParam("MetricInfos")
+ private List metricInfos;
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public Integer getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(Integer startTime) {
+ this.startTime = startTime;
+ }
+
+ public Integer getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(Integer endTime) {
+ this.endTime = endTime;
+ }
+
+ public String getCalcMethod() {
+ return calcMethod;
+ }
+
+ public void setCalcMethod(String calcMethod) {
+ this.calcMethod = calcMethod;
+ }
+
+ public Integer getPeriod() {
+ return period;
+ }
+
+ public void setPeriod(Integer period) {
+ this.period = period;
+ }
+
+ public List getMetricInfos() {
+ return metricInfos;
+ }
+
+ public void setMetricInfos(List metricInfos) {
+ this.metricInfos = metricInfos;
+ }
+
+ public static class MetricInfos extends Request {
+
+ /** 指标名 */
+ @NotEmpty
+ @UCloudParam("Metric")
+ private String metric;
+
+ /** 指标所属资源id */
+ @NotEmpty
+ @UCloudParam("ResourceId")
+ private String resourceId;
+
+ /** */
+ @UCloudParam("TagList")
+ private List tagList;
+
+ public String getMetric() {
+ return metric;
+ }
+
+ public void setMetric(String metric) {
+ this.metric = metric;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public List getTagList() {
+ return tagList;
+ }
+
+ public void setTagList(List tagList) {
+ this.tagList = tagList;
+ }
+ }
+
+ public static class MetricInfosTagList extends Request {
+
+ /** 要查询指标的Tag的key */
+ @UCloudParam("TagKey")
+ private String tagKey;
+
+ /** 要查询指标的Tag的Value */
+ @UCloudParam("TagValues")
+ private List tagValues;
+
+ public String getTagKey() {
+ return tagKey;
+ }
+
+ public void setTagKey(String tagKey) {
+ this.tagKey = tagKey;
+ }
+
+ public List getTagValues() {
+ return tagValues;
+ }
+
+ public void setTagValues(List tagValues) {
+ this.tagValues = tagValues;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSetResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSetResponse.java
new file mode 100644
index 00000000..0ce5d220
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSetResponse.java
@@ -0,0 +1,171 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+public class QueryMetricDataSetResponse extends Response {
+
+ /** 日志链路id */
+ @SerializedName("TraceId")
+ private String traceId;
+
+ /** QueryMetricDataResp */
+ @SerializedName("Data")
+ private QueryMetricDataResp data;
+
+ public String getTraceId() {
+ return traceId;
+ }
+
+ public void setTraceId(String traceId) {
+ this.traceId = traceId;
+ }
+
+ public QueryMetricDataResp getData() {
+ return data;
+ }
+
+ public void setData(QueryMetricDataResp data) {
+ this.data = data;
+ }
+
+ public static class MetricResult extends Response {
+
+ /** 资源的短id */
+ @SerializedName("ResourceId")
+ private String resourceId;
+
+ /** TagMap是一个对象,key和value均为字符串。 TagMap返回当前series的所有的tag的key和value。 */
+ @SerializedName("TagMap")
+ private Object tagMap;
+
+ /** */
+ @SerializedName("Values")
+ private List values;
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public Object getTagMap() {
+ return tagMap;
+ }
+
+ public void setTagMap(Object tagMap) {
+ this.tagMap = tagMap;
+ }
+
+ public List getValues() {
+ return values;
+ }
+
+ public void setValues(List values) {
+ this.values = values;
+ }
+ }
+
+ public static class MetricSample extends Response {
+
+ /** 时间戳 */
+ @SerializedName("Timestamp")
+ private Integer timestamp;
+
+ /** 样本值 */
+ @SerializedName("Value")
+ private Double value;
+
+ public Integer getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Integer timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public Double getValue() {
+ return value;
+ }
+
+ public void setValue(Double value) {
+ this.value = value;
+ }
+ }
+
+ public static class QueryMetricDataResp extends Response {
+
+ /** 查询的结果集 */
+ @SerializedName("List")
+ private List list;
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+ }
+
+ public static class QueryMetricDataRespItem extends Response {
+
+ /** 指标名 */
+ @SerializedName("Metric")
+ private String metric;
+
+ /**
+ * 指标查询结果的所有tag的key和对应的所有value数组。
+ *
+ * Tags格式为,key为tagkey字符串,value为tagValue的字符串数组。
+ */
+ @SerializedName("Tags")
+ private Object tags;
+
+ /** */
+ @SerializedName("Results")
+ private List results;
+
+ public String getMetric() {
+ return metric;
+ }
+
+ public void setMetric(String metric) {
+ this.metric = metric;
+ }
+
+ public Object getTags() {
+ return tags;
+ }
+
+ public void setTags(Object tags) {
+ this.tags = tags;
+ }
+
+ public List getResults() {
+ return results;
+ }
+
+ public void setResults(List results) {
+ this.results = results;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSummaryRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSummaryRequest.java
new file mode 100644
index 00000000..e4e020fb
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSummaryRequest.java
@@ -0,0 +1,112 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class QueryMetricDataSummaryRequest extends Request {
+
+ /** 地域,全局产品可以不传,其他必传 */
+ @NotEmpty
+ @UCloudParam("Region")
+ private String region;
+
+ /** 项目ID。 */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 产品类型 */
+ @NotEmpty
+ @UCloudParam("ProductKey")
+ private String productKey;
+
+ /** 跳过的数量 */
+ @NotEmpty
+ @UCloudParam("Offset")
+ private Integer offset;
+
+ /** 当前页数据尺寸 */
+ @NotEmpty
+ @UCloudParam("Limit")
+ private Integer limit;
+
+ /** 指定要查询的指标列表,不指定则使用默认的指标集合 */
+ @UCloudParam("Metrics")
+ private List metrics;
+
+ /** 指定要查询的资源ID列表 */
+ @UCloudParam("ResourceIds")
+ private List resourceIds;
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public Integer getOffset() {
+ return offset;
+ }
+
+ public void setOffset(Integer offset) {
+ this.offset = offset;
+ }
+
+ public Integer getLimit() {
+ return limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+
+ public List getMetrics() {
+ return metrics;
+ }
+
+ public void setMetrics(List metrics) {
+ this.metrics = metrics;
+ }
+
+ public List getResourceIds() {
+ return resourceIds;
+ }
+
+ public void setResourceIds(List resourceIds) {
+ this.resourceIds = resourceIds;
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSummaryResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSummaryResponse.java
new file mode 100644
index 00000000..14fee6a4
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/QueryMetricDataSummaryResponse.java
@@ -0,0 +1,326 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+public class QueryMetricDataSummaryResponse extends Response {
+
+ /** 链路id */
+ @SerializedName("TraceId")
+ private String traceId;
+
+ /** 总数 */
+ @SerializedName("TotalCount")
+ private Integer totalCount;
+
+ /** 数据 */
+ @SerializedName("Data")
+ private QueryMetricDataSummaryRespData data;
+
+ public String getTraceId() {
+ return traceId;
+ }
+
+ public void setTraceId(String traceId) {
+ this.traceId = traceId;
+ }
+
+ public Integer getTotalCount() {
+ return totalCount;
+ }
+
+ public void setTotalCount(Integer totalCount) {
+ this.totalCount = totalCount;
+ }
+
+ public QueryMetricDataSummaryRespData getData() {
+ return data;
+ }
+
+ public void setData(QueryMetricDataSummaryRespData data) {
+ this.data = data;
+ }
+
+ public static class MetricSample extends Response {
+
+ /** 时间戳 */
+ @SerializedName("Timestamp")
+ private Integer timestamp;
+
+ /** 样本值 */
+ @SerializedName("Value")
+ private Double value;
+
+ public Integer getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Integer timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public Double getValue() {
+ return value;
+ }
+
+ public void setValue(Double value) {
+ this.value = value;
+ }
+ }
+
+ public static class MetricSingleSample extends Response {
+
+ /** 指标名 */
+ @SerializedName("Metric")
+ private String metric;
+
+ /** 指标的tag的k-v对象 */
+ @SerializedName("Tags")
+ private Object tags;
+
+ /** 指标单个样本点对象 */
+ @SerializedName("Value")
+ private MetricSample value;
+
+ public String getMetric() {
+ return metric;
+ }
+
+ public void setMetric(String metric) {
+ this.metric = metric;
+ }
+
+ public Object getTags() {
+ return tags;
+ }
+
+ public void setTags(Object tags) {
+ this.tags = tags;
+ }
+
+ public MetricSample getValue() {
+ return value;
+ }
+
+ public void setValue(MetricSample value) {
+ this.value = value;
+ }
+ }
+
+ public static class QueryMetricDataSummaryRespData extends Response {
+
+ /** 总数 */
+ @SerializedName("Total")
+ private Integer total;
+
+ /** 结果集 */
+ @SerializedName("List")
+ private List list;
+
+ public Integer getTotal() {
+ return total;
+ }
+
+ public void setTotal(Integer total) {
+ this.total = total;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+ }
+
+ public static class ResourceMonitorItem extends Response {
+
+ /** 指标名 */
+ @SerializedName("Metric")
+ private String metric;
+
+ /** 指标数据数组 */
+ @SerializedName("MetricValues")
+ private List metricValues;
+
+ public String getMetric() {
+ return metric;
+ }
+
+ public void setMetric(String metric) {
+ this.metric = metric;
+ }
+
+ public List getMetricValues() {
+ return metricValues;
+ }
+
+ public void setMetricValues(List metricValues) {
+ this.metricValues = metricValues;
+ }
+ }
+
+ public static class ResourceSummary extends Response {
+
+ /** 地域 */
+ @SerializedName("Region")
+ private String region;
+
+ /** 可用区 */
+ @SerializedName("Zone")
+ private String zone;
+
+ /** 项目id */
+ @SerializedName("ProjectId")
+ private Integer projectId;
+
+ /** 公司id */
+ @SerializedName("CompanyId")
+ private Integer companyId;
+
+ /** 资源id */
+ @SerializedName("ResourceId")
+ private String resourceId;
+
+ /** 资源名称 */
+ @SerializedName("Name")
+ private String name;
+
+ /** 地域中文名 */
+ @SerializedName("RegionCN")
+ private String regionCN;
+
+ /** 可用区中文 */
+ @SerializedName("ZoneCN")
+ private String zoneCN;
+
+ /** 产品类型 */
+ @SerializedName("ProductKey")
+ private String productKey;
+
+ /** 项目id */
+ @SerializedName("OrganizationId")
+ private Integer organizationId;
+
+ /** 资源状态 */
+ @SerializedName("Status")
+ private Integer status;
+
+ /** 资源的各项指标当前值,类型为: map[string][]MetricSingleSample map的key为指标名,value为样本点数组。 */
+ @SerializedName("MonitorAttr")
+ private List monitorAttr;
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public String getZone() {
+ return zone;
+ }
+
+ public void setZone(String zone) {
+ this.zone = zone;
+ }
+
+ public Integer getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(Integer projectId) {
+ this.projectId = projectId;
+ }
+
+ public Integer getCompanyId() {
+ return companyId;
+ }
+
+ public void setCompanyId(Integer companyId) {
+ this.companyId = companyId;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getRegionCN() {
+ return regionCN;
+ }
+
+ public void setRegionCN(String regionCN) {
+ this.regionCN = regionCN;
+ }
+
+ public String getZoneCN() {
+ return zoneCN;
+ }
+
+ public void setZoneCN(String zoneCN) {
+ this.zoneCN = zoneCN;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public Integer getOrganizationId() {
+ return organizationId;
+ }
+
+ public void setOrganizationId(Integer organizationId) {
+ this.organizationId = organizationId;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public List getMonitorAttr() {
+ return monitorAttr;
+ }
+
+ public void setMonitorAttr(List monitorAttr) {
+ this.monitorAttr = monitorAttr;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UnBindAlertStrategyRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UnBindAlertStrategyRequest.java
new file mode 100644
index 00000000..b9368980
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UnBindAlertStrategyRequest.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class UnBindAlertStrategyRequest extends Request {
+
+ /** 项目ID */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 告警策略数组 */
+ @NotEmpty
+ @UCloudParam("AlertStrategyIDs")
+ private List alertStrategyIDs;
+
+ /** 资源数组 */
+ @NotEmpty
+ @UCloudParam("Resources")
+ private List resources;
+
+ /** 产品类型名称 */
+ @NotEmpty
+ @UCloudParam("ProductKey")
+ private String productKey;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public List getAlertStrategyIDs() {
+ return alertStrategyIDs;
+ }
+
+ public void setAlertStrategyIDs(List alertStrategyIDs) {
+ this.alertStrategyIDs = alertStrategyIDs;
+ }
+
+ public List getResources() {
+ return resources;
+ }
+
+ public void setResources(List resources) {
+ this.resources = resources;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UnBindAlertStrategyResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UnBindAlertStrategyResponse.java
new file mode 100644
index 00000000..feee41c0
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UnBindAlertStrategyResponse.java
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+
+import cn.ucloud.common.response.Response;
+
+public class UnBindAlertStrategyResponse extends Response {}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyRequest.java
new file mode 100644
index 00000000..7d154848
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyRequest.java
@@ -0,0 +1,323 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class UpdateAlertStrategyRequest extends Request {
+
+ /**
+ * 项目ID。不填写为默认项目,子帐号必须填写。
+ * 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 告警策略id */
+ @NotEmpty
+ @UCloudParam("AlertStrategyID")
+ private String alertStrategyID;
+
+ /** 告警策略名称。最大长度255个字符 */
+ @NotEmpty
+ @UCloudParam("Name")
+ private String name;
+
+ /** 产品类型。参考ListMonitorProduct获取监控对象类型列表 */
+ @NotEmpty
+ @UCloudParam("ProductKey")
+ private String productKey;
+
+ /** 绑定资源类型 1 资源组 2 资源 */
+ @NotEmpty
+ @UCloudParam("ObjectType")
+ private Integer objectType;
+
+ /** 条件设置方式 1. 手动配置 2.选择模版 */
+ @NotEmpty
+ @UCloudParam("ConfigMode")
+ private Integer configMode;
+
+ /** 绑定资源,对应绑定资源类型ObjectType=2 */
+ @UCloudParam("Resources")
+ private List resources;
+
+ /** 绑定资源组,对应绑定资源类型ObjectType=1 */
+ @UCloudParam("ResourceGroupIDs")
+ private List resourceGroupIDs;
+
+ /** 模板id.对应ConfigMode=2 */
+ @UCloudParam("TemplateId")
+ private Integer templateId;
+
+ /** */
+ @UCloudParam("RuleSet")
+ private List ruleSet;
+
+ /** 通知类型 通知组 group 通知人 user */
+ @UCloudParam("NotifyType")
+ private String notifyType;
+
+ /** 通知人id */
+ @UCloudParam("NotifyUserIDs")
+ private List notifyUserIDs;
+
+ /** 通知人组id */
+ @UCloudParam("NotifyGroupIDs")
+ private List notifyGroupIDs;
+
+ /** 通知渠道 短信sms 邮件email 回调webhook */
+ @UCloudParam("NotifyChannelDs")
+ private List notifyChannelDs;
+
+ /** 通知渠道回调webhook 回调语言 中文cn 英文en */
+ @UCloudParam("CallbackLanguage")
+ private String callbackLanguage;
+
+ /** 回调url */
+ @UCloudParam("CallbackUrls")
+ private List callbackUrls;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getAlertStrategyID() {
+ return alertStrategyID;
+ }
+
+ public void setAlertStrategyID(String alertStrategyID) {
+ this.alertStrategyID = alertStrategyID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public Integer getObjectType() {
+ return objectType;
+ }
+
+ public void setObjectType(Integer objectType) {
+ this.objectType = objectType;
+ }
+
+ public Integer getConfigMode() {
+ return configMode;
+ }
+
+ public void setConfigMode(Integer configMode) {
+ this.configMode = configMode;
+ }
+
+ public List getResources() {
+ return resources;
+ }
+
+ public void setResources(List resources) {
+ this.resources = resources;
+ }
+
+ public List getResourceGroupIDs() {
+ return resourceGroupIDs;
+ }
+
+ public void setResourceGroupIDs(List resourceGroupIDs) {
+ this.resourceGroupIDs = resourceGroupIDs;
+ }
+
+ public Integer getTemplateId() {
+ return templateId;
+ }
+
+ public void setTemplateId(Integer templateId) {
+ this.templateId = templateId;
+ }
+
+ public List getRuleSet() {
+ return ruleSet;
+ }
+
+ public void setRuleSet(List ruleSet) {
+ this.ruleSet = ruleSet;
+ }
+
+ public String getNotifyType() {
+ return notifyType;
+ }
+
+ public void setNotifyType(String notifyType) {
+ this.notifyType = notifyType;
+ }
+
+ public List getNotifyUserIDs() {
+ return notifyUserIDs;
+ }
+
+ public void setNotifyUserIDs(List notifyUserIDs) {
+ this.notifyUserIDs = notifyUserIDs;
+ }
+
+ public List getNotifyGroupIDs() {
+ return notifyGroupIDs;
+ }
+
+ public void setNotifyGroupIDs(List notifyGroupIDs) {
+ this.notifyGroupIDs = notifyGroupIDs;
+ }
+
+ public List getNotifyChannelDs() {
+ return notifyChannelDs;
+ }
+
+ public void setNotifyChannelDs(List notifyChannelDs) {
+ this.notifyChannelDs = notifyChannelDs;
+ }
+
+ public String getCallbackLanguage() {
+ return callbackLanguage;
+ }
+
+ public void setCallbackLanguage(String callbackLanguage) {
+ this.callbackLanguage = callbackLanguage;
+ }
+
+ public List getCallbackUrls() {
+ return callbackUrls;
+ }
+
+ public void setCallbackUrls(List callbackUrls) {
+ this.callbackUrls = callbackUrls;
+ }
+
+ public static class RuleSet extends Request {
+
+ /** 规则指标ID。参考该类型产品下返回的指标列表GetProductMetrics */
+ @UCloudParam("MetricID")
+ private Integer metricID;
+
+ /** 阈值比较方式。 枚举值比较方式: 1->= 2-<= 3-> 4-< 5-== 6-!= */
+ @UCloudParam("ThresholdCompare")
+ private Integer thresholdCompare;
+
+ /** 触发阈值 */
+ @UCloudParam("ThresholdValue")
+ private Integer thresholdValue;
+
+ /** 触发次数 */
+ @UCloudParam("TriggerCount")
+ private Integer triggerCount;
+
+ /** 触发周期。枚举值:continuous连续 exponent 指数 single 不重复 */
+ @UCloudParam("SendPeriodType")
+ private String sendPeriodType;
+
+ /** 告警等级。枚举值:P0,P1,P2,P3 */
+ @UCloudParam("Level")
+ private String level;
+
+ /** 告警状态。枚举值:0-关闭 1-开启 */
+ @UCloudParam("Status")
+ private Integer status;
+
+ /** 沉默周期(告警周期选择为连续时必填) */
+ @UCloudParam("SendInterval")
+ private Integer sendInterval;
+
+ public Integer getMetricID() {
+ return metricID;
+ }
+
+ public void setMetricID(Integer metricID) {
+ this.metricID = metricID;
+ }
+
+ public Integer getThresholdCompare() {
+ return thresholdCompare;
+ }
+
+ public void setThresholdCompare(Integer thresholdCompare) {
+ this.thresholdCompare = thresholdCompare;
+ }
+
+ public Integer getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Integer thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public Integer getTriggerCount() {
+ return triggerCount;
+ }
+
+ public void setTriggerCount(Integer triggerCount) {
+ this.triggerCount = triggerCount;
+ }
+
+ public String getSendPeriodType() {
+ return sendPeriodType;
+ }
+
+ public void setSendPeriodType(String sendPeriodType) {
+ this.sendPeriodType = sendPeriodType;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public Integer getSendInterval() {
+ return sendInterval;
+ }
+
+ public void setSendInterval(Integer sendInterval) {
+ this.sendInterval = sendInterval;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyResponse.java
new file mode 100644
index 00000000..f92a5fee
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyResponse.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+public class UpdateAlertStrategyResponse extends Response {
+
+ /** 更新告警策略返回对象 */
+ @SerializedName("Data")
+ private AlertStrategyId data;
+
+ public AlertStrategyId getData() {
+ return data;
+ }
+
+ public void setData(AlertStrategyId data) {
+ this.data = data;
+ }
+
+ public static class AlertStrategyId extends Response {
+
+ /** 告警策略id */
+ @SerializedName("AlertStrategyID")
+ private Integer alertStrategyID;
+
+ public Integer getAlertStrategyID() {
+ return alertStrategyID;
+ }
+
+ public void setAlertStrategyID(Integer alertStrategyID) {
+ this.alertStrategyID = alertStrategyID;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyTemplateRequest.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyTemplateRequest.java
new file mode 100644
index 00000000..816a4c2e
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyTemplateRequest.java
@@ -0,0 +1,208 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+import cn.ucloud.common.annotation.NotEmpty;
+import cn.ucloud.common.annotation.UCloudParam;
+import cn.ucloud.common.request.Request;
+
+import java.util.List;
+
+public class UpdateAlertStrategyTemplateRequest extends Request {
+
+ /**
+ * 项目ID。不填写为默认项目,子帐号必须填写。
+ * 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)
+ */
+ @NotEmpty
+ @UCloudParam("ProjectId")
+ private String projectId;
+
+ /** 条件模板ID */
+ @NotEmpty
+ @UCloudParam("TemplateID")
+ private Integer templateID;
+
+ /** 告警模板名称。最大长度64个字符 */
+ @NotEmpty
+ @UCloudParam("Name")
+ private String name;
+
+ /** 产品类型。参考ListMonitorProduct获取监控对象类型列表 */
+ @NotEmpty
+ @UCloudParam("ProductKey")
+ private String productKey;
+
+ /** */
+ @UCloudParam("RuleSet")
+ private List ruleSet;
+
+ /** 备注 */
+ @UCloudParam("Remark")
+ private String remark;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public Integer getTemplateID() {
+ return templateID;
+ }
+
+ public void setTemplateID(Integer templateID) {
+ this.templateID = templateID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getProductKey() {
+ return productKey;
+ }
+
+ public void setProductKey(String productKey) {
+ this.productKey = productKey;
+ }
+
+ public List getRuleSet() {
+ return ruleSet;
+ }
+
+ public void setRuleSet(List ruleSet) {
+ this.ruleSet = ruleSet;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public static class RuleSet extends Request {
+
+ /** 规则指标ID。参考该类型产品下返回的指标列表GetProductMetrics */
+ @NotEmpty
+ @UCloudParam("MetricID")
+ private Integer metricID;
+
+ /** 阈值比较方式。 枚举值比较方式: 1->= 2-<= 3-> 4-< 5-== 6-!= */
+ @NotEmpty
+ @UCloudParam("ThresholdCompare")
+ private Integer thresholdCompare;
+
+ /** 触发阈值 */
+ @NotEmpty
+ @UCloudParam("ThresholdValue")
+ private Integer thresholdValue;
+
+ /** 触发次数 */
+ @NotEmpty
+ @UCloudParam("TriggerCount")
+ private Integer triggerCount;
+
+ /** 触发周期。枚举值:continuous连续 exponent 指数 single 不重复 */
+ @NotEmpty
+ @UCloudParam("SendPeriodType")
+ private String sendPeriodType;
+
+ /** 告警等级。枚举值:P0,P1,P2,P3 */
+ @NotEmpty
+ @UCloudParam("Level")
+ private String level;
+
+ /** 告警状态。枚举值:0-关闭 1-开启 */
+ @NotEmpty
+ @UCloudParam("Status")
+ private Integer status;
+
+ /** 沉默周期(告警周期选择为连续时必填) */
+ @UCloudParam("SendInterval")
+ private Integer sendInterval;
+
+ public Integer getMetricID() {
+ return metricID;
+ }
+
+ public void setMetricID(Integer metricID) {
+ this.metricID = metricID;
+ }
+
+ public Integer getThresholdCompare() {
+ return thresholdCompare;
+ }
+
+ public void setThresholdCompare(Integer thresholdCompare) {
+ this.thresholdCompare = thresholdCompare;
+ }
+
+ public Integer getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Integer thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public Integer getTriggerCount() {
+ return triggerCount;
+ }
+
+ public void setTriggerCount(Integer triggerCount) {
+ this.triggerCount = triggerCount;
+ }
+
+ public String getSendPeriodType() {
+ return sendPeriodType;
+ }
+
+ public void setSendPeriodType(String sendPeriodType) {
+ this.sendPeriodType = sendPeriodType;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public Integer getSendInterval() {
+ return sendInterval;
+ }
+
+ public void setSendInterval(Integer sendInterval) {
+ this.sendInterval = sendInterval;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyTemplateResponse.java b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyTemplateResponse.java
new file mode 100644
index 00000000..5426f550
--- /dev/null
+++ b/ucloud-sdk-java-cloudwatch/src/main/java/cn/ucloud/cloudwatch/models/UpdateAlertStrategyTemplateResponse.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.cloudwatch.models;
+
+
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.annotations.SerializedName;
+
+public class UpdateAlertStrategyTemplateResponse extends Response {
+
+ /** 更新条件模板ID */
+ @SerializedName("Data")
+ private AlertTemplate data;
+
+ public AlertTemplate getData() {
+ return data;
+ }
+
+ public void setData(AlertTemplate data) {
+ this.data = data;
+ }
+
+ public static class AlertTemplate extends Response {
+
+ /** 告警模板ID */
+ @SerializedName("TemplateID")
+ private Integer templateID;
+
+ public Integer getTemplateID() {
+ return templateID;
+ }
+
+ public void setTemplateID(Integer templateID) {
+ this.templateID = templateID;
+ }
+ }
+}
diff --git a/ucloud-sdk-java-common/pom.xml b/ucloud-sdk-java-common/pom.xml
old mode 100755
new mode 100644
index 5d386c2d..1aaf4f8b
--- a/ucloud-sdk-java-common/pom.xml
+++ b/ucloud-sdk-java-common/pom.xml
@@ -1,24 +1,21 @@
-
-
+
+
ucloud-sdk-java
cn.ucloud
- 0.8.4.4-release
+ 1.2.51-release
4.0.0
ucloud-sdk-java-common
- 0.8.4.4-release
+ ucloud-sdk-java
+ 1.2.51-release
-
-
- org.hibernate
- hibernate-validator
-
-
org.glassfish
javax.el
@@ -66,6 +63,14 @@
jsonassert
test
+
+
+
+ org.mockito
+ mockito-all
+ 1.10.19
+ test
+
-
\ No newline at end of file
+
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/NotEmpty.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/NotEmpty.java
new file mode 100644
index 00000000..eee8a11a
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/NotEmpty.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** Annotation to mark the field is required */
+@Target({ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface NotEmpty {}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UCloudParam.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UCloudParam.java
new file mode 100644
index 00000000..6064ad8b
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UCloudParam.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** Annotation of UCloud parameters */
+@Target({ElementType.FIELD, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface UCloudParam {
+ String value(); // parameter name
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UcloudMethod.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UcloudMethod.java
deleted file mode 100644
index d3d00091..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UcloudMethod.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package cn.ucloud.common.annotation;
-
-
-import cn.ucloud.common.http.HttpContentType;
-import cn.ucloud.common.http.HttpMethod;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 17:45
- **/
-
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface UcloudMethod {
- HttpMethod method() default HttpMethod.GET;
- HttpContentType contentType() default HttpContentType.APPLICATION_URL_ENCODED;
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UcloudParam.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UcloudParam.java
deleted file mode 100755
index c9ad18dd..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UcloudParam.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package cn.ucloud.common.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @description: 属性和参数映射注解
- * @author: codezhang
- * @date: 2018-09-13 13:28
- **/
-
-
-@Target({ElementType.FIELD,ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface UcloudParam {
- String value();
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UcloudRestParam.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UcloudRestParam.java
deleted file mode 100644
index 9fde39d6..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/annotation/UcloudRestParam.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package cn.ucloud.common.annotation;
-
-import cn.ucloud.common.http.ParamLocation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 17:45
- **/
-
-@Target({ElementType.FIELD, ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface UcloudRestParam {
- String name();
-
- ParamLocation location() default ParamLocation.URL;
-
- boolean signature() default false;
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/Client.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/Client.java
new file mode 100644
index 00000000..7efd9a89
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/Client.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.client;
+
+import cn.ucloud.common.exception.UCloudException;
+import cn.ucloud.common.request.Request;
+import cn.ucloud.common.response.Response;
+
+import java.io.Closeable;
+
+public interface Client extends Closeable {
+ /**
+ * invoke api from request and response
+ *
+ * @param request request object
+ * @param clazz response class
+ * @return response object
+ */
+ Response invoke(Request request, Class extends Response> clazz) throws UCloudException;
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/DefaultClient.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/DefaultClient.java
new file mode 100644
index 00000000..538efa4b
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/DefaultClient.java
@@ -0,0 +1,144 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.client;
+
+import cn.ucloud.common.config.Config;
+import cn.ucloud.common.credential.Credential;
+import cn.ucloud.common.exception.RetCodeException;
+import cn.ucloud.common.exception.UCloudException;
+import cn.ucloud.common.middleware.Context;
+import cn.ucloud.common.middleware.Middleware;
+import cn.ucloud.common.middlewares.CredentialMiddleware;
+import cn.ucloud.common.middlewares.LogMiddleware;
+import cn.ucloud.common.middlewares.ValidationMiddleware;
+import cn.ucloud.common.request.Request;
+import cn.ucloud.common.response.Response;
+import cn.ucloud.common.transport.DefaultTransport;
+import cn.ucloud.common.transport.Transport;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class DefaultClient implements Client {
+ private Transport transport;
+
+ private Config config;
+
+ private Credential credential;
+
+ private final List middlewares;
+
+ public DefaultClient(Config config, Credential credential) {
+ this.setConfig(config);
+ this.setCredential(credential);
+ this.setTransport(
+ new DefaultTransport(
+ this.getConfig().getBaseUrl(), this.getConfig().getUserAgent()));
+ this.middlewares = new ArrayList<>();
+ this.useMiddleware(new ValidationMiddleware());
+ this.useMiddleware(new CredentialMiddleware());
+ this.useMiddleware(new LogMiddleware());
+ }
+
+ @Override
+ public Response invoke(Request request, Class extends Response> clazz)
+ throws UCloudException {
+ Context ctx = new Context();
+ ctx.setConfig(this.getConfig());
+ ctx.setCredential(this.getCredential());
+
+ // resolve request
+ ctx.setRequest(request);
+ for (Middleware middleware : this.middlewares) {
+ ctx.setRequest(middleware.handleRequest(ctx));
+ }
+
+ // do invoking
+ Response response = null;
+ try {
+ response = call(ctx, request, clazz);
+ } catch (UCloudException e) {
+ ctx.setException(e);
+ for (Middleware middleware : this.middlewares) {
+ middleware.handleException(ctx);
+ }
+ throw e;
+ }
+
+ // resolve response
+ ctx.setResponse(response);
+ for (Middleware middleware : this.middlewares) {
+ ctx.setResponse(middleware.handleResponse(ctx));
+ }
+ return ctx.getResponse();
+ }
+
+ private Response call(Context ctx, Request request, Class extends Response> clazz)
+ throws UCloudException {
+ Response response = null;
+ Integer maxRetries = request.loadMaxRetries();
+ for (int i = 0; i <= maxRetries; i++) {
+ // TODO: use backoff retry
+ try {
+ response = this.transport.invoke(ctx.getRequest(), clazz);
+ break;
+ } catch (UCloudException e) {
+ if (i == maxRetries) {
+ throw e;
+ }
+ }
+ }
+
+ // check if return code is not zero, mark it as ucloud server exception
+ if (response != null && response.getRetCode() != 0) {
+ throw new RetCodeException(
+ response.getRetCode(), response.getMessage(), response.getRequestId());
+ }
+ return response;
+ }
+
+ public void useMiddleware(Middleware middleware) {
+ this.middlewares.add(middleware);
+ }
+
+ public void setTransport(Transport transport) {
+ this.transport = transport;
+ }
+
+ public Transport getTransport() {
+ return transport;
+ }
+
+ public Config getConfig() {
+ return config;
+ }
+
+ public void setConfig(Config config) {
+ this.config = config;
+ }
+
+ public Credential getCredential() {
+ return credential;
+ }
+
+ public void setCredential(Credential credential) {
+ this.credential = credential;
+ }
+
+ @Override
+ public void close() throws IOException {
+ this.transport.close();
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/DefaultUcloudClient.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/DefaultUcloudClient.java
deleted file mode 100755
index 7a47ec37..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/DefaultUcloudClient.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package cn.ucloud.common.client;
-
-import cn.ucloud.common.handler.UcloudHandler;
-import cn.ucloud.common.http.UcloudHttp;
-import cn.ucloud.common.http.UcloudHttpImpl;
-import cn.ucloud.common.model.GetProjectListParam;
-import cn.ucloud.common.model.GetProjectListResult;
-import cn.ucloud.common.model.GetRegionParam;
-import cn.ucloud.common.model.GetRegionResult;
-import cn.ucloud.common.pojo.BaseRequestParam;
-import cn.ucloud.common.pojo.BaseResponseResult;
-import cn.ucloud.common.pojo.UcloudConfig;
-
-/**
- * @description: 默认的ucloud基础服务client
- * @author: codezhang
- * @date: 2018-11-13 13:52
- **/
-
-public class DefaultUcloudClient implements UcloudClient {
- protected UcloudConfig config;
-
- public DefaultUcloudClient(UcloudConfig config) {
- this.config = config;
- }
-
- @Override
- public GetRegionResult getRegion() throws Exception {
- UcloudHttp http = new UcloudHttpImpl(GetRegionResult.class);
- return (GetRegionResult) http.doPost(new GetRegionParam(), config, null);
- }
-
- @Override
- public void getRegion(UcloudHandler handler, Boolean... asyncFlag) {
- UcloudHttp http = new UcloudHttpImpl(GetRegionResult.class);
- try {
- http.doPost(new GetRegionParam(), config, handler, asyncFlag);
- } catch (Exception e) {
- }
- }
-
- @Override
- public GetProjectListResult getProjectList() throws Exception {
- UcloudHttp http = new UcloudHttpImpl(GetProjectListResult.class);
- return (GetProjectListResult) http.doPost(new GetProjectListParam(), config, null);
- }
-
- @Override
- public void getProjectList(UcloudHandler handler, Boolean... asyncFlag) {
- UcloudHttp http = new UcloudHttpImpl(GetProjectListResult.class);
- try {
- http.doPost(new GetProjectListParam(), config, handler, asyncFlag);
- } catch (Exception e) {
- }
- }
-
- @Override
- public BaseResponseResult doAction(BaseRequestParam param,
- Class extends BaseResponseResult> clazz) throws Exception {
- UcloudHttp http = new UcloudHttpImpl(clazz);
- return (BaseResponseResult) http.doPost(param, config, null);
- }
-
- @Override
- public void doAction(BaseRequestParam param, Class extends BaseResponseResult> clazz,
- UcloudHandler extends BaseResponseResult> handler, Boolean... asyncFlag) {
- UcloudHttp http = new UcloudHttpImpl(clazz);
- try {
- http.doPost(param, config, handler, asyncFlag);
- } catch (Exception e) {
- }
- }
-
-
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/UcloudClient.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/UcloudClient.java
deleted file mode 100755
index 168cec40..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/client/UcloudClient.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package cn.ucloud.common.client;
-
-
-import cn.ucloud.common.handler.UcloudHandler;
-import cn.ucloud.common.model.GetProjectListResult;
-import cn.ucloud.common.model.GetRegionResult;
-import cn.ucloud.common.pojo.BaseRequestParam;
-import cn.ucloud.common.pojo.BaseResponseResult;
-
-/**
- * @description: ucloud基础服务client
- * @author: codezhang
- * @date: 2018-09-13 11:01
- **/
-
-public interface UcloudClient {
-
- /**
- * 获取地域信息-GetRegion
- *
- * @return {@link GetRegionResult} 结果对象
- * @throws Exception 出错抛出异常
- */
- GetRegionResult getRegion() throws Exception;
-
- /**
- * 获取地域信息-GetRegion (回调)
- *
- * @param handler {@link UcloudHandler}回调callback
- * @param asyncFlag 是否异步
- */
- void getRegion(UcloudHandler handler, Boolean... asyncFlag);
-
-
- /**
- * 获取项目列表-GetProjectList
- *
- * @return {@link GetProjectListResult} 结果对象
- * @throws Exception 出错抛出异常
- */
- GetProjectListResult getProjectList() throws Exception;
-
-
- /**
- * 获取项目列表-GetProjectList (回调)
- *
- * @param handler {@link UcloudHandler}回调callback
- * @param asyncFlag 是否异步
- */
- void getProjectList(UcloudHandler handler, Boolean... asyncFlag);
-
-
- /**
- * 适用于调用所有接口
- *
- * @param param 请求参数
- * @param clazz 结果对象类
- * @return 结果对象
- * @throws Exception
- */
- BaseResponseResult doAction(BaseRequestParam param, Class extends BaseResponseResult> clazz) throws Exception;
-
-
- /**
- * 适用于调用所有接口,回调方式
- *
- * @param param 请求参数
- * @param clazz 结果对象类
- * @param handler 回调接口
- * @param asyncFlag 是否异步
- */
- void doAction(BaseRequestParam param,
- Class extends BaseResponseResult> clazz,
- UcloudHandler extends BaseResponseResult> handler,
- Boolean... asyncFlag);
-
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/config/Config.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/config/Config.java
new file mode 100644
index 00000000..3aac023b
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/config/Config.java
@@ -0,0 +1,99 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.config;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Config {
+
+ /** Region */
+ private String region;
+
+ /** Project id */
+ private String projectId;
+
+ /** Base url */
+ private String baseUrl = "https://api.ucloud.cn";
+
+ /** User agent */
+ private String userAgent;
+
+ /** Timeout */
+ private Integer timeout = 30;
+
+ /** Max retries count */
+ private Integer maxRetries = 0;
+
+ /** Logger */
+ private Logger logger = LoggerFactory.getLogger("cn.ucloud");
+
+ public Config() {}
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ public void setBaseUrl(String baseUrl) {
+ this.baseUrl = baseUrl;
+ }
+
+ public String getUserAgent() {
+ return userAgent;
+ }
+
+ public void setUserAgent(String userAgent) {
+ this.userAgent = userAgent;
+ }
+
+ public Integer getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(Integer timeout) {
+ this.timeout = timeout;
+ }
+
+ public Integer getMaxRetries() {
+ return maxRetries;
+ }
+
+ public void setMaxRetries(Integer maxRetries) {
+ this.maxRetries = maxRetries;
+ }
+
+ public Logger getLogger() {
+ return logger;
+ }
+
+ public void setLogger(Logger logger) {
+ this.logger = logger;
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/credential/Credential.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/credential/Credential.java
new file mode 100644
index 00000000..171eb392
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/credential/Credential.java
@@ -0,0 +1,112 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.credential;
+
+import cn.ucloud.common.exception.UCloudException;
+import cn.ucloud.common.request.Request;
+
+import org.apache.commons.codec.digest.DigestUtils;
+
+import java.io.UnsupportedEncodingException;
+import java.security.NoSuchAlgorithmException;
+import java.text.DecimalFormat;
+import java.util.Arrays;
+import java.util.Map;
+
+/** Credential is an object to represent the credential information */
+public class Credential {
+
+ private String privateKey;
+
+ private String publicKey;
+
+ /**
+ * Credential constructor
+ *
+ * @param publicKey Public Key
+ * @param privateKey
+ */
+ public Credential(String publicKey, String privateKey) {
+ this.privateKey = privateKey;
+ this.publicKey = publicKey;
+ }
+
+ public String verifyAc(Request request) throws UCloudException {
+ Map params = request.encode();
+ params.put("PublicKey", this.publicKey);
+ String[] keys = params.keySet().toArray(new String[0]);
+ Arrays.sort(keys);
+
+ DecimalFormat df = new DecimalFormat("#");
+ df.setMaximumFractionDigits(Integer.MAX_VALUE);
+ String s = "";
+ for (String key : keys) {
+ s = s.concat(key);
+ Object value = params.get(key);
+ String valueStr;
+ if (value instanceof Double || value instanceof Float) {
+ // If the type is double or float, we need to trim the tailing zeros
+ // to be consistent with the json decoder.
+ valueStr = df.format(value);
+ } else {
+ valueStr = value.toString();
+ }
+ s = s.concat(valueStr);
+ }
+ s = s.concat(this.privateKey);
+
+ try {
+ return sha1(s);
+ } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+ throw new UCloudException("sha1 error", e);
+ }
+ }
+
+ public Request sign(Request request) throws UCloudException {
+ request.setPublicKey(this.publicKey);
+ request.setSignature(verifyAc(request));
+ return request;
+ }
+
+ public String getPrivateKey() {
+ return privateKey;
+ }
+
+ public void setPrivateKey(String privateKey) {
+ this.privateKey = privateKey;
+ }
+
+ public String getPublicKey() {
+ return publicKey;
+ }
+
+ public void setPublicKey(String publicKey) {
+ this.publicKey = publicKey;
+ }
+
+ private String sha1(String s) throws NoSuchAlgorithmException, UnsupportedEncodingException {
+ return formatBytes2HexString(DigestUtils.sha1(s));
+ }
+
+ public String formatBytes2HexString(byte[] data) {
+ if (data == null || data.length == 0) {
+ return "";
+ }
+ StringBuilder sb = new StringBuilder();
+ for (byte b : data) {
+ sb.append(String.format("%02x", b));
+ }
+ return sb.toString();
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/HttpException.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/HttpException.java
deleted file mode 100755
index 1b60fb9a..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/HttpException.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package cn.ucloud.common.exception;
-
-/**
- * @description:
- * @author: codezhang
- * @date: 2018-09-14 14:11
- **/
-
-public class HttpException extends Exception{
-
-
- public HttpException(String message) {
- super(message);
- }
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/InterfaceException.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/InterfaceException.java
deleted file mode 100755
index 008e478e..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/InterfaceException.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package cn.ucloud.common.exception;
-
-/**
- * @description:
- * @author: codezhang
- * @date: 2018-09-19 17:20
- **/
-
-public class InterfaceException extends Exception {
- public InterfaceException(String message) {
- super(message);
- }
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/RetCodeException.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/RetCodeException.java
new file mode 100644
index 00000000..c759d9d5
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/RetCodeException.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.exception;
+
+/** RetCodeException is the exception of a logic exception returned by remote service */
+public class RetCodeException extends UCloudException {
+
+ private final Integer retCode;
+
+ private final String requestId;
+
+ /**
+ * @param retCode RetCode of response
+ * @param message Message to describe what happened
+ * @param requestId Request ID is the unique identifier of invoking lifycycle
+ */
+ public RetCodeException(Integer retCode, String message, String requestId) {
+ super(String.format("[%s] %d: %s", requestId, retCode, message));
+ this.retCode = retCode;
+ this.requestId = requestId;
+ }
+
+ public Integer getRetCode() {
+ return retCode;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/TransportException.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/TransportException.java
new file mode 100644
index 00000000..b17c81dd
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/TransportException.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.exception;
+
+public class TransportException extends UCloudException {
+
+ /**
+ * Transport exception occurs when the transport has been invoking
+ *
+ * @param message Message of transport exception
+ * @param cause The origin exception caused by
+ */
+ public TransportException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/UCloudException.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/UCloudException.java
new file mode 100644
index 00000000..3618dbb9
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/UCloudException.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.exception;
+
+/** UCloudException is the base-class of all the exception throw by SDK */
+public class UCloudException extends Exception {
+
+ public UCloudException(String message) {
+ super(message);
+ }
+
+ public UCloudException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/ValidatorException.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/ValidatorException.java
old mode 100755
new mode 100644
index b64fe617..d21e23fb
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/ValidatorException.java
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/exception/ValidatorException.java
@@ -1,13 +1,20 @@
-package cn.ucloud.common.exception;
-
/**
- * @description: 自定义校验异常
- * @author: codezhang
- * @date: 2018-09-13 11:43
- **/
-
-public class ValidatorException extends Exception {
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.exception;
+/** ValidatorException is the exception of parameters validator */
+public class ValidatorException extends UCloudException {
public ValidatorException(String message) {
super(message);
}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/handler/UcloudHandler.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/handler/UcloudHandler.java
deleted file mode 100755
index 5fa20cbc..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/handler/UcloudHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package cn.ucloud.common.handler;
-
-import cn.ucloud.common.pojo.BaseResponseResult;
-
-/**
- * @description:
- * @author: codezhang
- * @date: 2018-09-14 10:12
- **/
-public interface UcloudHandler {
- /**
- * 成功请求 处理函数
- *
- * @param result 请求结果
- * @return 任意返回数据
- */
- Object success(R result);
-
- /**
- * 失败请求 处理函数
- *
- * @param result 请求结果
- * @return 任意返回数据
- */
- Object failed(R result);
-
- /**
- * 请求发生错误 处理函数
- *
- * @param e 异常
- * @return 任意返回数据
- */
- Object error(Exception e);
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/Http.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/Http.java
deleted file mode 100644
index 7f20675c..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/Http.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package cn.ucloud.common.http;
-
-import cn.ucloud.common.exception.HttpException;
-import cn.ucloud.common.handler.UcloudHandler;
-import cn.ucloud.common.pojo.BaseResponseResult;
-import com.google.gson.Gson;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.util.EntityUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 23:13
- **/
-public class Http {
-
- private Class extends BaseResponseResult> resultClass;
-
- private boolean enableLog = false;
-
- public Http(Class extends BaseResponseResult> resultClass) {
- this.resultClass = resultClass;
- }
-
- public Http(Class extends BaseResponseResult> resultClass, boolean enableLog) {
- this.resultClass = resultClass;
- this.enableLog = enableLog;
- }
-
- private static final Logger logger = LoggerFactory.getLogger(Http.class);
-
- private static final String SDK_VERSION = "0.8.4.4-release";
-
- private static final String USER_AGENT;
-
- private static CloseableHttpClient closeableHttpClient = HttpClients.createDefault();
-
- static {
- String runTimeVersion = System.getProperty("java.runtime.version");
- runTimeVersion = (runTimeVersion == null || runTimeVersion.isEmpty()) ? "UnKnown RuntimeVersion" : runTimeVersion;
-
- USER_AGENT = String.format("JAVA_%s/JAVA-SDK/%s", runTimeVersion, SDK_VERSION);
- }
-
- public static void setHttpClient(CloseableHttpClient httpClient) {
- if (httpClient != null) {
- closeableHttpClient = httpClient;
- }
- }
-
- public BaseResponseResult doHttp(HttpUriRequest request, UcloudHandler handler, Boolean async) throws Exception {
- CloseableHttpResponse response = null;
- BaseResponseResult responseResult = null;
- request.addHeader("User-Agent", USER_AGENT);
-
- if (enableLog && request instanceof HttpPost) {
- String uriInfo = request.getURI().toString();
- String headerInfo = new Gson().toJson(request.getAllHeaders());
- String bodyInfo = EntityUtils.toString(((HttpPost) request).getEntity());
- logger.info("http POST request: \n" +
- "\tURI:{}\n" +
- "\tBody:{}\n" +
- "\tHeaders:{}",
- uriInfo,
- bodyInfo,
- headerInfo);
- } else if (enableLog && request instanceof HttpGet) {
- String uriInfo = request.getURI().toString();
- String headerInfo = new Gson().toJson(request.getAllHeaders());
- logger.info("http GET request: \n" +
- "\tURI:{}\n" +
- "\tHeaders:{}",
- uriInfo,
- headerInfo);
- }
-
- try {
- response = closeableHttpClient.execute(request);
- if (response != null) {
- // 正常响应
- String content = EntityUtils.toString(response.getEntity(), "UTF-8");
- if (enableLog) {
- logger.info("response content:{}", content);
- }
- if (statusOK(response)) {
- Gson gson = new Gson();
- responseResult = gson.fromJson(content, resultClass);
- responseResult.setResponseContent(content);
- if (handler != null) {
- handlerResult(handler, responseResult);
- }
- } else {
- // 非200则认为是个异常
- handlerException(handler, new HttpException(content), async);
- }
- } else {
- handlerException(handler, new NullPointerException("response is null"), async);
- }
- } catch (Exception e) {
- handlerException(handler, e, async);
- } finally {
- try {
- if (response != null) {
- response.close();
- }
- } catch (IOException e) {
- if (enableLog) {
- logger.error("response close error:{}", e.getMessage());
- }
- }
- }
- return responseResult;
- }
-
- public static void closeHttpClient() throws IOException {
- closeableHttpClient.close();
- }
-
- private void handlerResult(UcloudHandler handler, BaseResponseResult result) {
- if (result.getRetCode() != 0) {
- handler.failed(result);
- } else {
- handler.success(result);
- }
- }
-
- private boolean statusOK(CloseableHttpResponse response) {
- boolean ok = false;
- if (response != null) {
- ok = response.getStatusLine().getStatusCode() == 200;
- }
- return ok;
- }
-
- private void handlerException(UcloudHandler handler, Exception e, Boolean async) throws Exception {
- if (handler == null) {
- if (async != null) {
- if (enableLog) {
- logger.error("handler is null and async is not null,but get an error:{}", e.getMessage());
- }
- } else {
- throw e;
- }
- } else {
- handler.error(e);
- }
- }
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/HttpContentType.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/HttpContentType.java
deleted file mode 100644
index 15245d12..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/HttpContentType.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package cn.ucloud.common.http;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 19:37
- **/
-public enum HttpContentType {
- APPLICATION_URL_ENCODED, MULTIPART_FORM_DATA, APPLICATION_JSON, APPLICATION_XML
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/HttpMethod.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/HttpMethod.java
deleted file mode 100644
index 4420baa7..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/HttpMethod.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package cn.ucloud.common.http;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 18:15
- **/
-public enum HttpMethod {
- GET, POST, DELETE, PUT
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/ParamLocation.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/ParamLocation.java
deleted file mode 100644
index 58f3508f..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/ParamLocation.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package cn.ucloud.common.http;
-
-/**
- * @Description : 参数位置
- * @Author : codezhang
- * @Date : 2019-04-17 17:46
- **/
-public enum ParamLocation {
- PATH, URL, BODY, HEADER
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudHttp.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudHttp.java
deleted file mode 100755
index 6a0806d8..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudHttp.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package cn.ucloud.common.http;
-
-import cn.ucloud.common.pojo.BaseRequestParam;
-import cn.ucloud.common.handler.UcloudHandler;
-import cn.ucloud.common.pojo.UcloudConfig;
-
-/**
- * @description:
- * @author: codezhang
- * @date: 2018-09-14 11:39
- **/
-
-public interface UcloudHttp {
- /**
- * http get 请求
- *
- * @param param 请求参数对象
- * @param config 请求环境配置信息
- * @param handler 请求结果处理器
- * @param asyncFlag 异步标记位 默认true,请求处理器不为NULL时候有效
- * @return 同步时,返回请求到的数据结果
- * @throws Exception 同步非回调时,有异常则抛出异常
- */
- Object doGet(BaseRequestParam param, UcloudConfig config, UcloudHandler handler, Boolean... asyncFlag) throws Exception;
-
-
- /**
- * http post 请求
- *
- * @param param 请求参数对象
- * @param config 请求环境配置信息
- * @param handler 请求结果处理器
- * @param asyncFlag 异步标记位 默认true,请求处理器不为NULL时候有效
- * @return 同步时,返回请求到的数据结果
- * @throws Exception 同步非回调时,有异常则抛出异常
- */
- Object doPost(BaseRequestParam param, UcloudConfig config, UcloudHandler handler, Boolean... asyncFlag) throws Exception;
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudHttpImpl.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudHttpImpl.java
deleted file mode 100755
index 86daf105..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudHttpImpl.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package cn.ucloud.common.http;
-
-import cn.ucloud.common.handler.UcloudHandler;
-import cn.ucloud.common.pojo.BaseRequestParam;
-import cn.ucloud.common.pojo.BaseResponseResult;
-import cn.ucloud.common.pojo.UcloudConfig;
-import cn.ucloud.common.util.ParamConstructor;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.protocol.HTTP;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.nio.charset.StandardCharsets;
-
-/**
- * @description: UcloudHttp实现类
- * @author: codezhang
- * @date: 2018-09-14 11:53
- **/
-
-public class UcloudHttpImpl implements UcloudHttp {
-
-
- private Class extends BaseResponseResult> resultClass;
-
- public UcloudHttpImpl(Class extends BaseResponseResult> resultClass) {
- this.resultClass = resultClass;
- }
-
- private static Logger logger = LoggerFactory.getLogger(UcloudHttpImpl.class.getName());
-
- @Override
- public Object doGet(BaseRequestParam param,
- UcloudConfig config,
- UcloudHandler handler,
- Boolean... asyncFlag) throws Exception {
- BaseResponseResult result = null;
- try {
- String httpGetParamString = ParamConstructor.getHttpGetParamString(param, config.getAccount());
- final HttpGet get = new HttpGet(config.getApiServerAddr() + "?" + httpGetParamString);
- Http http = new Http(resultClass,config.isEnableLog());
- result = http.doHttp(get, handler, async(asyncFlag));
- } catch (Exception e) {
- handlerException(handler, e, async(asyncFlag));
- }
- return result;
- }
-
- @Override
- public Object doPost(BaseRequestParam param, UcloudConfig config,
- UcloudHandler handler, Boolean... asyncFlag) throws Exception {
- BaseResponseResult result = null;
- try {
- String httpPostParamString = ParamConstructor.getHttpPostParamString(param, config.getAccount());
- HttpPost post = new HttpPost(config.getApiServerAddr());
- //application/json
- post.setHeader(HTTP.CONTENT_TYPE, "application/json");
- //post
- StringEntity entity = new StringEntity(httpPostParamString, StandardCharsets.UTF_8);
- entity.setContentType("application/json");
- post.setEntity(entity);
- Http http = new Http(resultClass,config.isEnableLog());
- result = http.doHttp(post, handler, async(asyncFlag));
- } catch (Exception e) {
- handlerException(handler, e, async(asyncFlag));
- }
- return result;
- }
-
- private void handlerException(UcloudHandler handler, Exception e, Boolean async) throws Exception {
- if (handler == null) {
- if (async != null) {
- logger.error("handler is null and async is not null,but get an error:{}", e.getMessage());
- } else {
- throw e;
- }
- } else {
- handler.error(e);
- }
- }
-
- private Boolean async(Boolean... asyncFlag) {
- Boolean async = null;
- if (asyncFlag != null && asyncFlag.length > 0) {
- async = asyncFlag[0];
- }
- return async;
- }
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudRestHttp.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudRestHttp.java
deleted file mode 100644
index 24621c03..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudRestHttp.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package cn.ucloud.common.http;
-
-import cn.ucloud.common.handler.UcloudHandler;
-import cn.ucloud.common.pojo.BaseRestRequestParam;
-import cn.ucloud.common.pojo.UcloudConfig;
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 17:08
- **/
-public interface UcloudRestHttp {
- /**
- * http get 请求
- *
- * @param param 请求参数对象
- * @param config 请求环境配置信息
- * @param handler 请求结果处理器
- * @param restURL 请求地址
- * @param asyncFlag 异步标记位 默认true,请求处理器不为NULL时候有效
- * @return 同步时,返回请求到的数据结果
- * @throws Exception 同步非回调时,有异常则抛出异常
- */
- Object doGet(BaseRestRequestParam param, UcloudConfig config, String restURL,
- UcloudHandler handler, Boolean... asyncFlag) throws Exception;
-
-
- /**
- * http post 请求
- *
- * @param param 请求参数对象
- * @param config 请求环境配置信息
- * @param handler 请求结果处理器
- * @param restURL 请求地址
- * @param asyncFlag 异步标记位 默认true,请求处理器不为NULL时候有效
- * @return 同步时,返回请求到的数据结果
- * @throws Exception 同步非回调时,有异常则抛出异常
- */
- Object doPost(BaseRestRequestParam param, UcloudConfig config, String restURL,
- UcloudHandler handler, Boolean... asyncFlag) throws Exception;
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudRestHttpImpl.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudRestHttpImpl.java
deleted file mode 100644
index 77fb540c..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/http/UcloudRestHttpImpl.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package cn.ucloud.common.http;
-
-import cn.ucloud.common.handler.UcloudHandler;
-import cn.ucloud.common.pojo.BaseResponseResult;
-import cn.ucloud.common.pojo.BaseRestRequestParam;
-import cn.ucloud.common.pojo.UcloudConfig;
-import cn.ucloud.common.util.RestParamConstructor;
-import org.apache.http.Header;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-
-/**
- * @Description :
- * @Author : codezhang
- * @Date : 2019-04-17 17:41
- **/
-public class UcloudRestHttpImpl implements UcloudRestHttp {
-
- private Class extends BaseResponseResult> resultClass;
-
- public UcloudRestHttpImpl(Class extends BaseResponseResult> resultClass) {
- this.resultClass = resultClass;
- }
-
- private static Logger logger = LoggerFactory.getLogger(UcloudRestHttpImpl.class.getName());
-
- @Override
- public Object doGet(BaseRestRequestParam param, UcloudConfig config, String restURL,
- UcloudHandler handler, Boolean... asyncFlag) throws Exception {
- BaseResponseResult result = null;
- try {
- RestParamConstructor constructor = new RestParamConstructor(config.getAccount(), param);
- List headerList = constructor.getHeaders();
- Header[] headers = new Header[headerList.size()];
- headers = headerList.toArray(headers);
- String restHttpURLParamString = constructor.getRestHttpURLParamString();
- HttpGet get = new HttpGet(String.format("%s?%s", restURL, restHttpURLParamString));
- get.setHeaders(headers);
- Http http = new Http(resultClass,config.isEnableLog());
- result = http.doHttp(get, handler, async(asyncFlag));
- } catch (Exception e) {
- handlerException(handler, e, async(asyncFlag));
- }
- return result;
- }
-
- @Override
- public Object doPost(BaseRestRequestParam param, UcloudConfig config, String restURL,
- UcloudHandler handler, Boolean... asyncFlag) throws Exception {
- BaseResponseResult result = null;
- try {
- HttpPost post = new HttpPost(restURL);
- RestParamConstructor constructor = new RestParamConstructor(config.getAccount(), param);
- List headerList = constructor.getHeaders();
- Header[] headers = new Header[headerList.size()];
- headers = headerList.toArray(headers);
- HttpEntity entity = constructor.getEntity();
- post.setEntity(entity);
- post.setHeaders(headers);
- Http http = new Http(resultClass,config.isEnableLog());
- result = http.doHttp(post, handler, async(asyncFlag));
- } catch (Exception e) {
- handlerException(handler, e, async(asyncFlag));
- }
- return result;
- }
-
- private Boolean async(Boolean... asyncFlag) {
- Boolean async = null;
- if (asyncFlag != null && asyncFlag.length > 0) {
- async = asyncFlag[0];
- }
- return async;
- }
-
- private void handlerException(UcloudHandler handler, Exception e, Boolean async) throws Exception {
- if (handler == null) {
- if (async != null) {
- logger.error("handler is null and async is not null,but get an error:{}", e.getMessage());
- } else {
- throw e;
- }
- } else {
- handler.error(e);
- }
- }
-
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middleware/BaseMiddleware.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middleware/BaseMiddleware.java
new file mode 100644
index 00000000..401360e1
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middleware/BaseMiddleware.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.middleware;
+
+import cn.ucloud.common.exception.UCloudException;
+import cn.ucloud.common.request.Request;
+import cn.ucloud.common.response.Response;
+
+public abstract class BaseMiddleware implements Middleware {
+
+ @Override
+ public Request handleRequest(Context context) throws UCloudException {
+ return context.getRequest();
+ }
+
+ @Override
+ public Response handleResponse(Context context) throws UCloudException {
+ return context.getResponse();
+ }
+
+ @Override
+ public void handleException(Context context) throws UCloudException {}
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middleware/Context.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middleware/Context.java
new file mode 100644
index 00000000..7bf5fcac
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middleware/Context.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.middleware;
+
+import cn.ucloud.common.config.Config;
+import cn.ucloud.common.credential.Credential;
+import cn.ucloud.common.request.Request;
+import cn.ucloud.common.response.Response;
+
+public class Context {
+
+ private Config config;
+
+ private Credential credential;
+
+ private Request request;
+
+ private Response response;
+
+ private Exception exception;
+
+ public Config getConfig() {
+ return config;
+ }
+
+ public void setConfig(Config config) {
+ this.config = config;
+ }
+
+ public Credential getCredential() {
+ return credential;
+ }
+
+ public void setCredential(Credential credential) {
+ this.credential = credential;
+ }
+
+ public Request getRequest() {
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+
+ public Response getResponse() {
+ return response;
+ }
+
+ public void setResponse(Response response) {
+ this.response = response;
+ }
+
+ public Exception getException() {
+ return exception;
+ }
+
+ public void setException(Exception exception) {
+ this.exception = exception;
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middleware/Middleware.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middleware/Middleware.java
new file mode 100644
index 00000000..a746a228
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middleware/Middleware.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.middleware;
+
+import cn.ucloud.common.exception.UCloudException;
+import cn.ucloud.common.request.Request;
+import cn.ucloud.common.response.Response;
+
+public interface Middleware {
+ /**
+ * Handle the context includes request object
+ *
+ * @param context Context of invoking lifecycle
+ * @return request object that modified
+ * @throws UCloudException the exception during invoking
+ */
+ Request handleRequest(Context context) throws UCloudException;
+
+ /**
+ * Handle the context includes response object
+ *
+ * @param context Context of invoking lifecycle
+ * @return response object that modified
+ * @throws UCloudException the exception during invoking
+ */
+ Response handleResponse(Context context) throws UCloudException;
+
+ /**
+ * Handle the context includes exception object
+ *
+ * @param context Context of invoking lifecycle
+ * @throws UCloudException the exception during invoking
+ */
+ void handleException(Context context) throws UCloudException;
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middlewares/CredentialMiddleware.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middlewares/CredentialMiddleware.java
new file mode 100644
index 00000000..8e1db0b1
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middlewares/CredentialMiddleware.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.middlewares;
+
+import cn.ucloud.common.credential.Credential;
+import cn.ucloud.common.exception.UCloudException;
+import cn.ucloud.common.middleware.BaseMiddleware;
+import cn.ucloud.common.middleware.Context;
+import cn.ucloud.common.middleware.Middleware;
+import cn.ucloud.common.request.Request;
+
+/** CredentialMiddleware is the middleware to calculate signature and inject into request */
+public class CredentialMiddleware extends BaseMiddleware implements Middleware {
+
+ @Override
+ public Request handleRequest(Context context) throws UCloudException {
+ Credential cred = context.getCredential();
+ Request request = context.getRequest();
+ return cred.sign(request);
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middlewares/LogMiddleware.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middlewares/LogMiddleware.java
new file mode 100644
index 00000000..51f7b093
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middlewares/LogMiddleware.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.middlewares;
+
+import cn.ucloud.common.exception.UCloudException;
+import cn.ucloud.common.middleware.BaseMiddleware;
+import cn.ucloud.common.middleware.Context;
+import cn.ucloud.common.middleware.Middleware;
+import cn.ucloud.common.request.Request;
+import cn.ucloud.common.response.Response;
+
+import com.google.gson.Gson;
+
+import org.slf4j.Logger;
+
+/** LogMiddleware is the middleware to print logs */
+public class LogMiddleware extends BaseMiddleware implements Middleware {
+
+ @Override
+ public Request handleRequest(Context context) throws UCloudException {
+ Logger logger = context.getConfig().getLogger();
+ logger.info(new Gson().toJson(context.getRequest().encode()));
+ return super.handleRequest(context);
+ }
+
+ @Override
+ public Response handleResponse(Context context) throws UCloudException {
+ Logger logger = context.getConfig().getLogger();
+ logger.info(
+ String.format(
+ "[%s] %s",
+ context.getResponse().getRequestId(),
+ new Gson().toJson(context.getResponse())));
+ return super.handleResponse(context);
+ }
+
+ @Override
+ public void handleException(Context context) throws UCloudException {
+ Logger logger = context.getConfig().getLogger();
+ logger.error(new Gson().toJson(context.getException().getMessage()));
+ super.handleException(context);
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middlewares/ValidationMiddleware.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middlewares/ValidationMiddleware.java
new file mode 100644
index 00000000..88459a48
--- /dev/null
+++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/middlewares/ValidationMiddleware.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2021 UCloud Technology Co., Ltd.
+ *
+ *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.ucloud.common.middlewares;
+
+import cn.ucloud.common.config.Config;
+import cn.ucloud.common.exception.UCloudException;
+import cn.ucloud.common.middleware.BaseMiddleware;
+import cn.ucloud.common.middleware.Context;
+import cn.ucloud.common.middleware.Middleware;
+import cn.ucloud.common.request.Request;
+
+/** ValidationMiddleware is a middleware to inject common configuration */
+public class ValidationMiddleware extends BaseMiddleware implements Middleware {
+
+ @Override
+ public Request handleRequest(Context context) throws UCloudException {
+ Config config = context.getConfig();
+ Request request = context.getRequest();
+ if (request.loadMaxRetries() == null) {
+ request.withMaxRetries(config.getMaxRetries());
+ }
+ if (request.loadTimeout() == null) {
+ request.withTimeout(config.getTimeout() * 1000);
+ }
+ if (request.getRegion() == null) {
+ request.setRegion(config.getRegion());
+ }
+ if (request.getProjectId() == null) {
+ request.setProjectId(config.getProjectId());
+ }
+ return request;
+ }
+}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/model/GetProjectListParam.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/model/GetProjectListParam.java
deleted file mode 100755
index 01a13ebc..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/model/GetProjectListParam.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package cn.ucloud.common.model;
-
-import cn.ucloud.common.pojo.BaseRequestParam;
-
-/**
- * @description: 获取项目列表 参数类
- * @author: codezhang
- * @date: 2018-11-13 15:19
- **/
-
-public class GetProjectListParam extends BaseRequestParam {
- public GetProjectListParam() {
- super("GetProjectList");
- }
-}
diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/model/GetProjectListResult.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/model/GetProjectListResult.java
deleted file mode 100755
index a1b60071..00000000
--- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/model/GetProjectListResult.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package cn.ucloud.common.model;
-
-import cn.ucloud.common.pojo.BaseResponseResult;
-import com.google.gson.annotations.SerializedName;
-
-import java.util.List;
-
-/**
- * @description: 获取项目列表 结果类
- * @author: codezhang
- * @date: 2018-11-13 15:20
- **/
-
-public class GetProjectListResult extends BaseResponseResult {
-
- public static class Project {
-
- /**
- * 创建时间 时间戳
- */
- @SerializedName("CreateTime")
- private Integer createTime;
-
- /**
- * 是否是默认的项目
- */
- @SerializedName("IsDefault")
- private Boolean isDefault;
-
- /**
- * 成员数目
- */
- @SerializedName("MemberCount")
- private Integer memberCount;
-
- /**
- * 父项目ID
- */
- @SerializedName("ParentId")
- private String parentId;
-
- /**
- * 父项目名称
- */
- @SerializedName("ParentName")
- private String parentName;
-
-
- /**
- * 项目ID
- */
- @SerializedName("ProjectId")
- private String projectId;
-
- /**
- * 项目名称
- */
- @SerializedName("ProjectName")
- private String projectName;
-
- /**
- * 资源数目
- */
- @SerializedName("ResourceCount")
- private Integer resourceCount;
-
-
- public Integer getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Integer createTime) {
- this.createTime = createTime;
- }
-
- public Boolean getDefault() {
- return isDefault;
- }
-
- public void setDefault(Boolean aDefault) {
- isDefault = aDefault;
- }
-
- public Integer getMemberCount() {
- return memberCount;
- }
-
- public void setMemberCount(Integer memberCount) {
- this.memberCount = memberCount;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
- }
-
- public String getParentName() {
- return parentName;
- }
-
- public void setParentName(String parentName) {
- this.parentName = parentName;
- }
-
- public String getProjectId() {
- return projectId;
- }
-
- public void setProjectId(String projectId) {
- this.projectId = projectId;
- }
-
- public String getProjectName() {
- return projectName;
- }
-
- public void setProjectName(String projectName) {
- this.projectName = projectName;
- }
-
- public Integer getResourceCount() {
- return resourceCount;
- }
-
- public void setResourceCount(Integer resourceCount) {
- this.resourceCount = resourceCount;
- }
-
- @Override
- public String toString() {
- return "Project{" +
- "createTime=" + createTime +
- ", isDefault=" + isDefault +
- ", memberCount=" + memberCount +
- ", parentId='" + parentId + '\'' +
- ", parentName='" + parentName + '\'' +
- ", projectId='" + projectId + '\'' +
- ", projectName='" + projectName + '\'' +
- ", resourceCount=" + resourceCount +
- '}';
- }
- }
-
- /**
- * 项目列表
- */
- @SerializedName("ProjectSet")
- private List