Просмотр исходного кода

Support input parameter ClientToken for CreateAutoProvisioningGroup.

sdk-team 5 лет назад
Родитель
Сommit
f75ad9a460

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+2021-01-06 Version: patch
+- Support input parameter ClientToken for CreateAutoProvisioningGroup.
+
 2021-01-06 Version: patch
 - Add API.
 

+ 3 - 0
ecs/include/alibabacloud/ecs/model/CreateAutoProvisioningGroupRequest.h

@@ -112,6 +112,8 @@ namespace AlibabaCloud
 				void setMaxSpotPrice(float maxSpotPrice);
 				bool getLaunchConfigurationPasswordInherit()const;
 				void setLaunchConfigurationPasswordInherit(bool launchConfigurationPasswordInherit);
+				std::string getClientToken()const;
+				void setClientToken(const std::string& clientToken);
 				std::string getLaunchConfigurationSecurityGroupId()const;
 				void setLaunchConfigurationSecurityGroupId(const std::string& launchConfigurationSecurityGroupId);
 				std::string getDescription()const;
@@ -195,6 +197,7 @@ namespace AlibabaCloud
 				std::string launchConfigurationHostName_;
 				float maxSpotPrice_;
 				bool launchConfigurationPasswordInherit_;
+				std::string clientToken_;
 				std::string launchConfigurationSecurityGroupId_;
 				std::string description_;
 				bool terminateInstancesWithExpiration_;

+ 11 - 0
ecs/include/alibabacloud/ecs/model/CreateAutoProvisioningGroupResult.h

@@ -32,17 +32,28 @@ namespace AlibabaCloud
 			class ALIBABACLOUD_ECS_EXPORT CreateAutoProvisioningGroupResult : public ServiceResult
 			{
 			public:
+				struct LaunchResult
+				{
+					std::string zoneId;
+					std::string errorMsg;
+					std::string errorCode;
+					std::string instanceType;
+					std::vector<std::string> instanceIds;
+					std::string spotStrategy;
+				};
 
 
 				CreateAutoProvisioningGroupResult();
 				explicit CreateAutoProvisioningGroupResult(const std::string &payload);
 				~CreateAutoProvisioningGroupResult();
 				std::string getAutoProvisioningGroupId()const;
+				std::vector<LaunchResult> getLaunchResults()const;
 
 			protected:
 				void parse(const std::string &payload);
 			private:
 				std::string autoProvisioningGroupId_;
+				std::vector<LaunchResult> launchResults_;
 
 			};
 		}

+ 11 - 0
ecs/src/model/CreateAutoProvisioningGroupRequest.cc

@@ -279,6 +279,17 @@ void CreateAutoProvisioningGroupRequest::setLaunchConfigurationPasswordInherit(b
 	setParameter("LaunchConfigurationPasswordInherit", launchConfigurationPasswordInherit ? "true" : "false");
 }
 
+std::string CreateAutoProvisioningGroupRequest::getClientToken()const
+{
+	return clientToken_;
+}
+
+void CreateAutoProvisioningGroupRequest::setClientToken(const std::string& clientToken)
+{
+	clientToken_ = clientToken;
+	setParameter("ClientToken", clientToken);
+}
+
 std::string CreateAutoProvisioningGroupRequest::getLaunchConfigurationSecurityGroupId()const
 {
 	return launchConfigurationSecurityGroupId_;

+ 24 - 0
ecs/src/model/CreateAutoProvisioningGroupResult.cc

@@ -39,6 +39,25 @@ void CreateAutoProvisioningGroupResult::parse(const std::string &payload)
 	Json::Value value;
 	reader.parse(payload, value);
 	setRequestId(value["RequestId"].asString());
+	auto allLaunchResultsNode = value["LaunchResults"]["LaunchResult"];
+	for (auto valueLaunchResultsLaunchResult : allLaunchResultsNode)
+	{
+		LaunchResult launchResultsObject;
+		if(!valueLaunchResultsLaunchResult["SpotStrategy"].isNull())
+			launchResultsObject.spotStrategy = valueLaunchResultsLaunchResult["SpotStrategy"].asString();
+		if(!valueLaunchResultsLaunchResult["InstanceType"].isNull())
+			launchResultsObject.instanceType = valueLaunchResultsLaunchResult["InstanceType"].asString();
+		if(!valueLaunchResultsLaunchResult["ZoneId"].isNull())
+			launchResultsObject.zoneId = valueLaunchResultsLaunchResult["ZoneId"].asString();
+		if(!valueLaunchResultsLaunchResult["ErrorCode"].isNull())
+			launchResultsObject.errorCode = valueLaunchResultsLaunchResult["ErrorCode"].asString();
+		if(!valueLaunchResultsLaunchResult["ErrorMsg"].isNull())
+			launchResultsObject.errorMsg = valueLaunchResultsLaunchResult["ErrorMsg"].asString();
+		auto allInstanceIds = value["InstanceIds"]["InstanceId"];
+		for (auto value : allInstanceIds)
+			launchResultsObject.instanceIds.push_back(value.asString());
+		launchResults_.push_back(launchResultsObject);
+	}
 	if(!value["AutoProvisioningGroupId"].isNull())
 		autoProvisioningGroupId_ = value["AutoProvisioningGroupId"].asString();
 
@@ -49,3 +68,8 @@ std::string CreateAutoProvisioningGroupResult::getAutoProvisioningGroupId()const
 	return autoProvisioningGroupId_;
 }
 
+std::vector<CreateAutoProvisioningGroupResult::LaunchResult> CreateAutoProvisioningGroupResult::getLaunchResults()const
+{
+	return launchResults_;
+}
+