GetDeployment unicodeC Example
#include <C_CkRestW.h>
#include <C_CkAuthAwsW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkStringBuilderW.h>
void ChilkatSample(void)
{
HCkRestW rest;
BOOL success;
HCkAuthAwsW authAws;
HCkJsonObjectW json;
HCkStringBuilderW sbRequestBody;
HCkStringBuilderW sbResponseBody;
int respStatusCode;
HCkJsonObjectW jResp;
const wchar_t *strVal;
const wchar_t *name;
int j;
int count_j;
const wchar_t *v_Type;
const wchar_t *Value;
const wchar_t *AdditionalDeploymentStatusInfo;
const wchar_t *ApplicationName;
int Enabled;
const wchar_t *ActionOnTimeout;
int WaitTimeInMinutes;
const wchar_t *Action;
const wchar_t *TerminateBlueInstancesOnDeploymentSuccessAction;
int TerminationWaitTimeInMinutes;
int CompleteTime;
const wchar_t *ComputePlatform;
int CreateTime;
const wchar_t *Creator;
const wchar_t *DeploymentConfigName;
const wchar_t *DeploymentGroupName;
const wchar_t *DeploymentId;
int Failed;
int InProgress;
int Pending;
int Ready;
int Skipped;
int Succeeded;
const wchar_t *DeploymentOption;
const wchar_t *DeploymentType;
const wchar_t *Description;
const wchar_t *Code;
const wchar_t *Message;
const wchar_t *ExternalId;
const wchar_t *FileExistsBehavior;
int IgnoreApplicationStopFailures;
int InstanceTerminationWaitTimeStarted;
const wchar_t *Content;
const wchar_t *Sha256;
const wchar_t *CommitId;
const wchar_t *Repository;
const wchar_t *RevisionType;
const wchar_t *Bucket;
const wchar_t *BundleType;
const wchar_t *ETag;
const wchar_t *Key;
const wchar_t *Version;
const wchar_t *StringContent;
const wchar_t *StringSha256;
const wchar_t *AutoUpdateOutdatedInstancesRootDeploymentId;
const wchar_t *AppSpecContentContent;
const wchar_t *AppSpecContentSha256;
const wchar_t *GitHubLocationCommitId;
const wchar_t *GitHubLocationRepository;
const wchar_t *RevisionRevisionType;
const wchar_t *S3LocationBucket;
const wchar_t *S3LocationBundleType;
const wchar_t *S3LocationETag;
const wchar_t *S3LocationKey;
const wchar_t *S3LocationVersion;
const wchar_t *RollbackDeploymentId;
const wchar_t *RollbackMessage;
const wchar_t *RollbackTriggeringDeploymentId;
int StartTime;
const wchar_t *Status;
int UpdateOutdatedInstancesOnly;
int i;
int count_i;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
rest = CkRestW_Create();
authAws = CkAuthAwsW_Create();
CkAuthAwsW_putAccessKey(authAws,L"AWS_ACCESS_KEY");
CkAuthAwsW_putSecretKey(authAws,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.)
CkAuthAwsW_putRegion(authAws,L"us-west-2");
CkAuthAwsW_putServiceName(authAws,L"codedeploy");
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
CkRestW_SetAuthAws(rest,authAws);
// URL: https://codedeploy.us-west-2.amazonaws.com/
// Use the same region as specified above.
success = CkRestW_Connect(rest,L"codedeploy.us-west-2.amazonaws.com",443,TRUE,TRUE);
if (success != TRUE) {
wprintf(L"ConnectFailReason: %d\n",CkRestW_getConnectFailReason(rest));
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
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
json = CkJsonObjectW_Create();
CkJsonObjectW_UpdateString(json,L"deploymentId",L"string");
// The JSON request body created by the above code:
// {
// "deploymentId": "string"
// }
CkRestW_AddHeader(rest,L"Content-Type",L"application/x-amz-json-1.1");
CkRestW_AddHeader(rest,L"X-Amz-Target",L"CodeDeploy_20141006.GetDeployment");
sbRequestBody = CkStringBuilderW_Create();
CkJsonObjectW_EmitSb(json,sbRequestBody);
sbResponseBody = CkStringBuilderW_Create();
success = CkRestW_FullRequestSb(rest,L"POST",L"/",sbRequestBody,sbResponseBody);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
respStatusCode = CkRestW_getResponseStatusCode(rest);
wprintf(L"response status code = %d\n",respStatusCode);
if (respStatusCode != 200) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkRestW_responseHeader(rest));
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkStringBuilderW_getAsString(sbResponseBody));
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
jResp = CkJsonObjectW_Create();
CkJsonObjectW_LoadSb(jResp,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.
AdditionalDeploymentStatusInfo = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.additionalDeploymentStatusInfo");
ApplicationName = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.applicationName");
Enabled = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.autoRollbackConfiguration.enabled");
ActionOnTimeout = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.blueGreenDeploymentConfiguration.deploymentReadyOption.actionOnTimeout");
WaitTimeInMinutes = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.blueGreenDeploymentConfiguration.deploymentReadyOption.waitTimeInMinutes");
Action = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.blueGreenDeploymentConfiguration.greenFleetProvisioningOption.action");
TerminateBlueInstancesOnDeploymentSuccessAction = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.action");
TerminationWaitTimeInMinutes = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.terminationWaitTimeInMinutes");
CompleteTime = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.completeTime");
ComputePlatform = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.computePlatform");
CreateTime = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.createTime");
Creator = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.creator");
DeploymentConfigName = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.deploymentConfigName");
DeploymentGroupName = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.deploymentGroupName");
DeploymentId = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.deploymentId");
Failed = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.deploymentOverview.Failed");
InProgress = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.deploymentOverview.InProgress");
Pending = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.deploymentOverview.Pending");
Ready = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.deploymentOverview.Ready");
Skipped = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.deploymentOverview.Skipped");
Succeeded = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.deploymentOverview.Succeeded");
DeploymentOption = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.deploymentStyle.deploymentOption");
DeploymentType = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.deploymentStyle.deploymentType");
Description = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.description");
Code = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.errorInformation.code");
Message = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.errorInformation.message");
ExternalId = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.externalId");
FileExistsBehavior = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.fileExistsBehavior");
IgnoreApplicationStopFailures = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.ignoreApplicationStopFailures");
InstanceTerminationWaitTimeStarted = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.instanceTerminationWaitTimeStarted");
Content = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.appSpecContent.content");
Sha256 = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.appSpecContent.sha256");
CommitId = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.gitHubLocation.commitId");
Repository = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.gitHubLocation.repository");
RevisionType = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.revisionType");
Bucket = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.s3Location.bucket");
BundleType = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.s3Location.bundleType");
ETag = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.s3Location.eTag");
Key = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.s3Location.key");
Version = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.s3Location.version");
StringContent = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.string.content");
StringSha256 = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.previousRevision.string.sha256");
AutoUpdateOutdatedInstancesRootDeploymentId = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.relatedDeployments.autoUpdateOutdatedInstancesRootDeploymentId");
AppSpecContentContent = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.appSpecContent.content");
AppSpecContentSha256 = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.appSpecContent.sha256");
GitHubLocationCommitId = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.gitHubLocation.commitId");
GitHubLocationRepository = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.gitHubLocation.repository");
RevisionRevisionType = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.revisionType");
S3LocationBucket = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.s3Location.bucket");
S3LocationBundleType = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.s3Location.bundleType");
S3LocationETag = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.s3Location.eTag");
S3LocationKey = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.s3Location.key");
S3LocationVersion = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.s3Location.version");
StringContent = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.string.content");
StringSha256 = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.revision.string.sha256");
RollbackDeploymentId = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.rollbackInfo.rollbackDeploymentId");
RollbackMessage = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.rollbackInfo.rollbackMessage");
RollbackTriggeringDeploymentId = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.rollbackInfo.rollbackTriggeringDeploymentId");
StartTime = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.startTime");
Status = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.status");
UpdateOutdatedInstancesOnly = CkJsonObjectW_IntOf(jResp,L"deploymentInfo.updateOutdatedInstancesOnly");
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.autoRollbackConfiguration.events");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
strVal = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.autoRollbackConfiguration.events[i]");
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.deploymentStatusMessages");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
strVal = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.deploymentStatusMessages[i]");
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.loadBalancerInfo.elbInfoList");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
name = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.loadBalancerInfo.elbInfoList[i].name");
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.loadBalancerInfo.targetGroupInfoList");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
name = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.loadBalancerInfo.targetGroupInfoList[i].name");
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.loadBalancerInfo.targetGroupPairInfoList");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].prodTrafficRoute.listenerArns");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
strVal = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].prodTrafficRoute.listenerArns[j]");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].targetGroups");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
name = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].targetGroups[j].name");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].testTrafficRoute.listenerArns");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
strVal = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].testTrafficRoute.listenerArns[j]");
j = j + 1;
}
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.relatedDeployments.autoUpdateOutdatedInstancesDeploymentIds");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
strVal = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.relatedDeployments.autoUpdateOutdatedInstancesDeploymentIds[i]");
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.targetInstances.autoScalingGroups");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
strVal = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.targetInstances.autoScalingGroups[i]");
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList[i]");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
Key = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList[i][j].Key");
v_Type = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList[i][j].Type");
Value = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList[i][j].Value");
j = j + 1;
}
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"deploymentInfo.targetInstances.tagFilters");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
Key = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.targetInstances.tagFilters[i].Key");
v_Type = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.targetInstances.tagFilters[i].Type");
Value = CkJsonObjectW_stringOf(jResp,L"deploymentInfo.targetInstances.tagFilters[i].Value");
i = i + 1;
}
// A sample JSON response body parsed by the above code:
// {
// "deploymentInfo": {
// "additionalDeploymentStatusInfo": "string",
// "applicationName": "string",
// "autoRollbackConfiguration": {
// "enabled": boolean,
// "events": [
// "string"
// ]
// },
// "blueGreenDeploymentConfiguration": {
// "deploymentReadyOption": {
// "actionOnTimeout": "string",
// "waitTimeInMinutes": number
// },
// "greenFleetProvisioningOption": {
// "action": "string"
// },
// "terminateBlueInstancesOnDeploymentSuccess": {
// "action": "string",
// "terminationWaitTimeInMinutes": number
// }
// },
// "completeTime": number,
// "computePlatform": "string",
// "createTime": number,
// "creator": "string",
// "deploymentConfigName": "string",
// "deploymentGroupName": "string",
// "deploymentId": "string",
// "deploymentOverview": {
// "Failed": number,
// "InProgress": number,
// "Pending": number,
// "Ready": number,
// "Skipped": number,
// "Succeeded": number
// },
// "deploymentStatusMessages": [
// "string"
// ],
// "deploymentStyle": {
// "deploymentOption": "string",
// "deploymentType": "string"
// },
// "description": "string",
// "errorInformation": {
// "code": "string",
// "message": "string"
// },
// "externalId": "string",
// "fileExistsBehavior": "string",
// "ignoreApplicationStopFailures": boolean,
// "instanceTerminationWaitTimeStarted": boolean,
// "loadBalancerInfo": {
// "elbInfoList": [
// {
// "name": "string"
// }
// ],
// "targetGroupInfoList": [
// {
// "name": "string"
// }
// ],
// "targetGroupPairInfoList": [
// {
// "prodTrafficRoute": {
// "listenerArns": [
// "string"
// ]
// },
// "targetGroups": [
// {
// "name": "string"
// }
// ],
// "testTrafficRoute": {
// "listenerArns": [
// "string"
// ]
// }
// }
// ]
// },
// "previousRevision": {
// "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"
// }
// },
// "relatedDeployments": {
// "autoUpdateOutdatedInstancesDeploymentIds": [
// "string"
// ],
// "autoUpdateOutdatedInstancesRootDeploymentId": "string"
// },
// "revision": {
// "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"
// }
// },
// "rollbackInfo": {
// "rollbackDeploymentId": "string",
// "rollbackMessage": "string",
// "rollbackTriggeringDeploymentId": "string"
// },
// "startTime": number,
// "status": "string",
// "targetInstances": {
// "autoScalingGroups": [
// "string"
// ],
// "ec2TagSet": {
// "ec2TagSetList": [
// [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ]
// ]
// },
// "tagFilters": [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ]
// },
// "updateOutdatedInstancesOnly": boolean
// }
// }
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
}