GetImagePipeline unicodeCpp Example
#include <CkRestW.h>
#include <CkAuthAwsW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.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"imagebuilder");
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
rest.SetAuthAws(authAws);
// URL: https://imagebuilder.us-west-2.amazonaws.com/
// Use the same region as specified above.
success = rest.Connect(L"imagebuilder.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;
}
rest.AddHeader(L"Content-Type",L"application/x-amz-json-1.1");
rest.AddHeader(L"X-Amz-Target",L"GetImagePipeline");
CkStringBuilderW sbResponseBody;
success = rest.FullRequestNoBodySb(L"GET",L"/GetImagePipeline",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 *Arn = jResp.stringOf(L"imagePipeline.arn");
const wchar_t *ContainerRecipeArn = jResp.stringOf(L"imagePipeline.containerRecipeArn");
const wchar_t *DateCreated = jResp.stringOf(L"imagePipeline.dateCreated");
const wchar_t *DateLastRun = jResp.stringOf(L"imagePipeline.dateLastRun");
const wchar_t *DateNextRun = jResp.stringOf(L"imagePipeline.dateNextRun");
const wchar_t *DateUpdated = jResp.stringOf(L"imagePipeline.dateUpdated");
const wchar_t *Description = jResp.stringOf(L"imagePipeline.description");
const wchar_t *DistributionConfigurationArn = jResp.stringOf(L"imagePipeline.distributionConfigurationArn");
int EnhancedImageMetadataEnabled = jResp.IntOf(L"imagePipeline.enhancedImageMetadataEnabled");
const wchar_t *ImageRecipeArn = jResp.stringOf(L"imagePipeline.imageRecipeArn");
int ImageTestsEnabled = jResp.IntOf(L"imagePipeline.imageTestsConfiguration.imageTestsEnabled");
int TimeoutMinutes = jResp.IntOf(L"imagePipeline.imageTestsConfiguration.timeoutMinutes");
const wchar_t *InfrastructureConfigurationArn = jResp.stringOf(L"imagePipeline.infrastructureConfigurationArn");
const wchar_t *Name = jResp.stringOf(L"imagePipeline.name");
const wchar_t *Platform = jResp.stringOf(L"imagePipeline.platform");
const wchar_t *PipelineExecutionStartCondition = jResp.stringOf(L"imagePipeline.schedule.pipelineExecutionStartCondition");
const wchar_t *ScheduleExpression = jResp.stringOf(L"imagePipeline.schedule.scheduleExpression");
const wchar_t *Timezone = jResp.stringOf(L"imagePipeline.schedule.timezone");
const wchar_t *Status = jResp.stringOf(L"imagePipeline.status");
const wchar_t *v_String = jResp.stringOf(L"imagePipeline.tags.string");
const wchar_t *requestId = jResp.stringOf(L"requestId");
// A sample JSON response body parsed by the above code:
// {
// "imagePipeline": {
// "arn": "string",
// "containerRecipeArn": "string",
// "dateCreated": "string",
// "dateLastRun": "string",
// "dateNextRun": "string",
// "dateUpdated": "string",
// "description": "string",
// "distributionConfigurationArn": "string",
// "enhancedImageMetadataEnabled": boolean,
// "imageRecipeArn": "string",
// "imageTestsConfiguration": {
// "imageTestsEnabled": boolean,
// "timeoutMinutes": number
// },
// "infrastructureConfigurationArn": "string",
// "name": "string",
// "platform": "string",
// "schedule": {
// "pipelineExecutionStartCondition": "string",
// "scheduleExpression": "string",
// "timezone": "string"
// },
// "status": "string",
// "tags": {
// "string": "string"
// }
// },
// "requestId": "string"
// }
}