GetDeploymentGroup unicodeCpp Example
#include <CkRestW.h>
#include <CkAuthAwsW.h>
#include <CkJsonObjectW.h>
#include <CkStringBuilderW.h>
void ChilkatSample(void)
{
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkRestW rest;
bool success;
CkAuthAwsW authAws;
authAws.put_AccessKey(L"AWS_ACCESS_KEY");
authAws.put_SecretKey(L"AWS_SECRET_KEY");
// Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
authAws.put_Region(L"us-west-2");
authAws.put_ServiceName(L"codedeploy");
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
rest.SetAuthAws(authAws);
// URL: https://codedeploy.us-west-2.amazonaws.com/
// Use the same region as specified above.
success = rest.Connect(L"codedeploy.us-west-2.amazonaws.com",443,true,true);
if (success != true) {
wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
wprintf(L"%s\n",rest.lastErrorText());
return;
}
// The following code creates the JSON request body.
// The JSON created by this code is shown below.
// Use this online tool to generate code from sample JSON:
// Generate Code to Create JSON
CkJsonObjectW json;
json.UpdateString(L"applicationName",L"string");
json.UpdateString(L"deploymentGroupName",L"string");
// The JSON request body created by the above code:
// {
// "applicationName": "string",
// "deploymentGroupName": "string"
// }
rest.AddHeader(L"Content-Type",L"application/x-amz-json-1.1");
rest.AddHeader(L"X-Amz-Target",L"CodeDeploy_20141006.GetDeploymentGroup");
CkStringBuilderW sbRequestBody;
json.EmitSb(sbRequestBody);
CkStringBuilderW sbResponseBody;
success = rest.FullRequestSb(L"POST",L"/",sbRequestBody,sbResponseBody);
if (success != true) {
wprintf(L"%s\n",rest.lastErrorText());
return;
}
int respStatusCode = rest.get_ResponseStatusCode();
wprintf(L"response status code = %d\n",respStatusCode);
if (respStatusCode != 200) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",rest.responseHeader());
wprintf(L"Response Body:\n");
wprintf(L"%s\n",sbResponseBody.getAsString());
return;
}
CkJsonObjectW jResp;
jResp.LoadSb(sbResponseBody);
// The following code parses the JSON response.
// A sample JSON response is shown below the sample code.
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
// See this example explaining how this memory should be used: const char * functions.
const wchar_t *name = 0;
const wchar_t *strVal = 0;
const wchar_t *hook = 0;
const wchar_t *v_Type = 0;
const wchar_t *Value = 0;
int j;
int count_j;
const wchar_t *clusterName = 0;
const wchar_t *serviceName = 0;
const wchar_t *triggerName = 0;
const wchar_t *triggerTargetArn = 0;
int Enabled = jResp.IntOf(L"deploymentGroupInfo.alarmConfiguration.enabled");
int IgnorePollAlarmFailure = jResp.IntOf(L"deploymentGroupInfo.alarmConfiguration.ignorePollAlarmFailure");
const wchar_t *ApplicationName = jResp.stringOf(L"deploymentGroupInfo.applicationName");
int AutoRollbackConfigurationEnabled = jResp.IntOf(L"deploymentGroupInfo.autoRollbackConfiguration.enabled");
const wchar_t *ActionOnTimeout = jResp.stringOf(L"deploymentGroupInfo.blueGreenDeploymentConfiguration.deploymentReadyOption.actionOnTimeout");
int WaitTimeInMinutes = jResp.IntOf(L"deploymentGroupInfo.blueGreenDeploymentConfiguration.deploymentReadyOption.waitTimeInMinutes");
const wchar_t *Action = jResp.stringOf(L"deploymentGroupInfo.blueGreenDeploymentConfiguration.greenFleetProvisioningOption.action");
const wchar_t *TerminateBlueInstancesOnDeploymentSuccessAction = jResp.stringOf(L"deploymentGroupInfo.blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.action");
int TerminationWaitTimeInMinutes = jResp.IntOf(L"deploymentGroupInfo.blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.terminationWaitTimeInMinutes");
const wchar_t *ComputePlatform = jResp.stringOf(L"deploymentGroupInfo.computePlatform");
const wchar_t *DeploymentConfigName = jResp.stringOf(L"deploymentGroupInfo.deploymentConfigName");
const wchar_t *DeploymentGroupId = jResp.stringOf(L"deploymentGroupInfo.deploymentGroupId");
const wchar_t *DeploymentGroupName = jResp.stringOf(L"deploymentGroupInfo.deploymentGroupName");
const wchar_t *DeploymentOption = jResp.stringOf(L"deploymentGroupInfo.deploymentStyle.deploymentOption");
const wchar_t *DeploymentType = jResp.stringOf(L"deploymentGroupInfo.deploymentStyle.deploymentType");
int CreateTime = jResp.IntOf(L"deploymentGroupInfo.lastAttemptedDeployment.createTime");
const wchar_t *DeploymentId = jResp.stringOf(L"deploymentGroupInfo.lastAttemptedDeployment.deploymentId");
int EndTime = jResp.IntOf(L"deploymentGroupInfo.lastAttemptedDeployment.endTime");
const wchar_t *Status = jResp.stringOf(L"deploymentGroupInfo.lastAttemptedDeployment.status");
int LastSuccessfulDeploymentCreateTime = jResp.IntOf(L"deploymentGroupInfo.lastSuccessfulDeployment.createTime");
const wchar_t *LastSuccessfulDeploymentDeploymentId = jResp.stringOf(L"deploymentGroupInfo.lastSuccessfulDeployment.deploymentId");
int LastSuccessfulDeploymentEndTime = jResp.IntOf(L"deploymentGroupInfo.lastSuccessfulDeployment.endTime");
const wchar_t *LastSuccessfulDeploymentStatus = jResp.stringOf(L"deploymentGroupInfo.lastSuccessfulDeployment.status");
const wchar_t *OutdatedInstancesStrategy = jResp.stringOf(L"deploymentGroupInfo.outdatedInstancesStrategy");
const wchar_t *ServiceRoleArn = jResp.stringOf(L"deploymentGroupInfo.serviceRoleArn");
const wchar_t *Content = jResp.stringOf(L"deploymentGroupInfo.targetRevision.appSpecContent.content");
const wchar_t *Sha256 = jResp.stringOf(L"deploymentGroupInfo.targetRevision.appSpecContent.sha256");
const wchar_t *CommitId = jResp.stringOf(L"deploymentGroupInfo.targetRevision.gitHubLocation.commitId");
const wchar_t *Repository = jResp.stringOf(L"deploymentGroupInfo.targetRevision.gitHubLocation.repository");
const wchar_t *RevisionType = jResp.stringOf(L"deploymentGroupInfo.targetRevision.revisionType");
const wchar_t *Bucket = jResp.stringOf(L"deploymentGroupInfo.targetRevision.s3Location.bucket");
const wchar_t *BundleType = jResp.stringOf(L"deploymentGroupInfo.targetRevision.s3Location.bundleType");
const wchar_t *ETag = jResp.stringOf(L"deploymentGroupInfo.targetRevision.s3Location.eTag");
const wchar_t *Key = jResp.stringOf(L"deploymentGroupInfo.targetRevision.s3Location.key");
const wchar_t *Version = jResp.stringOf(L"deploymentGroupInfo.targetRevision.s3Location.version");
const wchar_t *StringContent = jResp.stringOf(L"deploymentGroupInfo.targetRevision.string.content");
const wchar_t *StringSha256 = jResp.stringOf(L"deploymentGroupInfo.targetRevision.string.sha256");
int i = 0;
int count_i = jResp.SizeOfArray(L"deploymentGroupInfo.alarmConfiguration.alarms");
while (i < count_i) {
jResp.put_I(i);
name = jResp.stringOf(L"deploymentGroupInfo.alarmConfiguration.alarms[i].name");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.autoRollbackConfiguration.events");
while (i < count_i) {
jResp.put_I(i);
strVal = jResp.stringOf(L"deploymentGroupInfo.autoRollbackConfiguration.events[i]");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.autoScalingGroups");
while (i < count_i) {
jResp.put_I(i);
hook = jResp.stringOf(L"deploymentGroupInfo.autoScalingGroups[i].hook");
name = jResp.stringOf(L"deploymentGroupInfo.autoScalingGroups[i].name");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.ec2TagFilters");
while (i < count_i) {
jResp.put_I(i);
Key = jResp.stringOf(L"deploymentGroupInfo.ec2TagFilters[i].Key");
v_Type = jResp.stringOf(L"deploymentGroupInfo.ec2TagFilters[i].Type");
Value = jResp.stringOf(L"deploymentGroupInfo.ec2TagFilters[i].Value");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.ec2TagSet.ec2TagSetList");
while (i < count_i) {
jResp.put_I(i);
j = 0;
count_j = jResp.SizeOfArray(L"deploymentGroupInfo.ec2TagSet.ec2TagSetList[i]");
while (j < count_j) {
jResp.put_J(j);
Key = jResp.stringOf(L"deploymentGroupInfo.ec2TagSet.ec2TagSetList[i][j].Key");
v_Type = jResp.stringOf(L"deploymentGroupInfo.ec2TagSet.ec2TagSetList[i][j].Type");
Value = jResp.stringOf(L"deploymentGroupInfo.ec2TagSet.ec2TagSetList[i][j].Value");
j = j + 1;
}
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.ecsServices");
while (i < count_i) {
jResp.put_I(i);
clusterName = jResp.stringOf(L"deploymentGroupInfo.ecsServices[i].clusterName");
serviceName = jResp.stringOf(L"deploymentGroupInfo.ecsServices[i].serviceName");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.loadBalancerInfo.elbInfoList");
while (i < count_i) {
jResp.put_I(i);
name = jResp.stringOf(L"deploymentGroupInfo.loadBalancerInfo.elbInfoList[i].name");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.loadBalancerInfo.targetGroupInfoList");
while (i < count_i) {
jResp.put_I(i);
name = jResp.stringOf(L"deploymentGroupInfo.loadBalancerInfo.targetGroupInfoList[i].name");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList");
while (i < count_i) {
jResp.put_I(i);
j = 0;
count_j = jResp.SizeOfArray(L"deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].prodTrafficRoute.listenerArns");
while (j < count_j) {
jResp.put_J(j);
strVal = jResp.stringOf(L"deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].prodTrafficRoute.listenerArns[j]");
j = j + 1;
}
j = 0;
count_j = jResp.SizeOfArray(L"deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].targetGroups");
while (j < count_j) {
jResp.put_J(j);
name = jResp.stringOf(L"deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].targetGroups[j].name");
j = j + 1;
}
j = 0;
count_j = jResp.SizeOfArray(L"deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].testTrafficRoute.listenerArns");
while (j < count_j) {
jResp.put_J(j);
strVal = jResp.stringOf(L"deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].testTrafficRoute.listenerArns[j]");
j = j + 1;
}
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.onPremisesInstanceTagFilters");
while (i < count_i) {
jResp.put_I(i);
Key = jResp.stringOf(L"deploymentGroupInfo.onPremisesInstanceTagFilters[i].Key");
v_Type = jResp.stringOf(L"deploymentGroupInfo.onPremisesInstanceTagFilters[i].Type");
Value = jResp.stringOf(L"deploymentGroupInfo.onPremisesInstanceTagFilters[i].Value");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.onPremisesTagSet.onPremisesTagSetList");
while (i < count_i) {
jResp.put_I(i);
j = 0;
count_j = jResp.SizeOfArray(L"deploymentGroupInfo.onPremisesTagSet.onPremisesTagSetList[i]");
while (j < count_j) {
jResp.put_J(j);
Key = jResp.stringOf(L"deploymentGroupInfo.onPremisesTagSet.onPremisesTagSetList[i][j].Key");
v_Type = jResp.stringOf(L"deploymentGroupInfo.onPremisesTagSet.onPremisesTagSetList[i][j].Type");
Value = jResp.stringOf(L"deploymentGroupInfo.onPremisesTagSet.onPremisesTagSetList[i][j].Value");
j = j + 1;
}
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"deploymentGroupInfo.triggerConfigurations");
while (i < count_i) {
jResp.put_I(i);
triggerName = jResp.stringOf(L"deploymentGroupInfo.triggerConfigurations[i].triggerName");
triggerTargetArn = jResp.stringOf(L"deploymentGroupInfo.triggerConfigurations[i].triggerTargetArn");
j = 0;
count_j = jResp.SizeOfArray(L"deploymentGroupInfo.triggerConfigurations[i].triggerEvents");
while (j < count_j) {
jResp.put_J(j);
strVal = jResp.stringOf(L"deploymentGroupInfo.triggerConfigurations[i].triggerEvents[j]");
j = j + 1;
}
i = i + 1;
}
// A sample JSON response body parsed by the above code:
// {
// "deploymentGroupInfo": {
// "alarmConfiguration": {
// "alarms": [
// {
// "name": "string"
// }
// ],
// "enabled": boolean,
// "ignorePollAlarmFailure": boolean
// },
// "applicationName": "string",
// "autoRollbackConfiguration": {
// "enabled": boolean,
// "events": [
// "string"
// ]
// },
// "autoScalingGroups": [
// {
// "hook": "string",
// "name": "string"
// }
// ],
// "blueGreenDeploymentConfiguration": {
// "deploymentReadyOption": {
// "actionOnTimeout": "string",
// "waitTimeInMinutes": number
// },
// "greenFleetProvisioningOption": {
// "action": "string"
// },
// "terminateBlueInstancesOnDeploymentSuccess": {
// "action": "string",
// "terminationWaitTimeInMinutes": number
// }
// },
// "computePlatform": "string",
// "deploymentConfigName": "string",
// "deploymentGroupId": "string",
// "deploymentGroupName": "string",
// "deploymentStyle": {
// "deploymentOption": "string",
// "deploymentType": "string"
// },
// "ec2TagFilters": [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ],
// "ec2TagSet": {
// "ec2TagSetList": [
// [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ]
// ]
// },
// "ecsServices": [
// {
// "clusterName": "string",
// "serviceName": "string"
// }
// ],
// "lastAttemptedDeployment": {
// "createTime": number,
// "deploymentId": "string",
// "endTime": number,
// "status": "string"
// },
// "lastSuccessfulDeployment": {
// "createTime": number,
// "deploymentId": "string",
// "endTime": number,
// "status": "string"
// },
// "loadBalancerInfo": {
// "elbInfoList": [
// {
// "name": "string"
// }
// ],
// "targetGroupInfoList": [
// {
// "name": "string"
// }
// ],
// "targetGroupPairInfoList": [
// {
// "prodTrafficRoute": {
// "listenerArns": [
// "string"
// ]
// },
// "targetGroups": [
// {
// "name": "string"
// }
// ],
// "testTrafficRoute": {
// "listenerArns": [
// "string"
// ]
// }
// }
// ]
// },
// "onPremisesInstanceTagFilters": [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ],
// "onPremisesTagSet": {
// "onPremisesTagSetList": [
// [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ]
// ]
// },
// "outdatedInstancesStrategy": "string",
// "serviceRoleArn": "string",
// "targetRevision": {
// "appSpecContent": {
// "content": "string",
// "sha256": "string"
// },
// "gitHubLocation": {
// "commitId": "string",
// "repository": "string"
// },
// "revisionType": "string",
// "s3Location": {
// "bucket": "string",
// "bundleType": "string",
// "eTag": "string",
// "key": "string",
// "version": "string"
// },
// "string": {
// "content": "string",
// "sha256": "string"
// }
// },
// "triggerConfigurations": [
// {
// "triggerEvents": [
// "string"
// ],
// "triggerName": "string",
// "triggerTargetArn": "string"
// }
// ]
// }
// }
}