Chilkat Online Tools

GetImage C Example

EC2 Image Builder

#include <C_CkRest.h>
#include <C_CkAuthAws.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>

void ChilkatSample(void)
    {
    HCkRest rest;
    BOOL success;
    HCkAuthAws authAws;
    HCkStringBuilder sbResponseBody;
    int respStatusCode;
    HCkJsonObject jResp;
    const char *componentArn;
    int j;
    int count_j;
    const char *name;
    int k;
    int count_k;
    const char *strVal;
    const char *deviceName;
    int DeleteOnTermination;
    int ebsEncrypted;
    int Iops;
    const char *ebsKmsKeyId;
    const char *SnapshotId;
    int Throughput;
    int VolumeSize;
    const char *VolumeType;
    const char *noDevice;
    const char *virtualName;
    const char *AmiTagsString;
    const char *amiDistributionConfigurationDescription;
    const char *amiDistributionConfigurationKmsKeyId;
    const char *amiDistributionConfigurationName;
    const char *containerDistributionConfigurationDescription;
    const char *TargetRepositoryRepositoryName;
    const char *TargetRepositoryService;
    const char *region;
    const char *DiskImageFormat;
    const char *RoleName;
    const char *S3Bucket;
    const char *S3Prefix;
    const char *accountId;
    int enabled;
    const char *LaunchTemplateId;
    const char *LaunchTemplateName;
    const char *LaunchTemplateVersion;
    int maxParallelLaunches;
    int TargetResourceCount;
    const char *launchTemplateId;
    int setDefaultVersion;
    int ebsDeleteOnTermination;
    int ebsIops;
    const char *ebsSnapshotId;
    int ebsThroughput;
    int ebsVolumeSize;
    const char *ebsVolumeType;
    const char *description;
    const char *image;
    const char *stateReason;
    const char *stateStatus;
    const char *Arn;
    const char *BuildType;
    const char *ContainerRecipeArn;
    const char *ContainerType;
    const char *DateCreated;
    const char *Description;
    const char *DockerfileTemplateData;
    int Encrypted;
    const char *Image;
    const char *KmsKeyId;
    const char *Name;
    const char *Owner;
    const char *ParentImage;
    const char *Platform;
    const char *v_String;
    const char *RepositoryName;
    const char *Service;
    const char *Version;
    const char *WorkingDirectory;
    const char *imageDateCreated;
    const char *DistributionConfigurationArn;
    const char *DistributionConfigurationDateCreated;
    const char *DateUpdated;
    const char *DistributionConfigurationDescription;
    const char *DistributionConfigurationName;
    const char *TagsString;
    int TimeoutMinutes;
    int EnhancedImageMetadataEnabled;
    int UninstallAfterBuild;
    const char *UserDataOverride;
    const char *ImageRecipeArn;
    const char *ImageRecipeDateCreated;
    const char *ImageRecipeDescription;
    const char *ImageRecipeName;
    const char *ImageRecipeOwner;
    const char *ImageRecipeParentImage;
    const char *ImageRecipePlatform;
    const char *v_Type;
    const char *ImageRecipeVersion;
    const char *ImageRecipeWorkingDirectory;
    int ImageTestsEnabled;
    int ImageTestsConfigurationTimeoutMinutes;
    const char *InfrastructureConfigurationArn;
    const char *InfrastructureConfigurationDateCreated;
    const char *InfrastructureConfigurationDateUpdated;
    const char *InfrastructureConfigurationDescription;
    int HttpPutResponseHopLimit;
    const char *HttpTokens;
    const char *InstanceProfileName;
    const char *KeyPair;
    const char *S3BucketName;
    const char *S3KeyPrefix;
    const char *InfrastructureConfigurationName;
    const char *ResourceTagsString;
    const char *SnsTopicArn;
    const char *SubnetId;
    int TerminateInstanceOnFailure;
    const char *imageName;
    const char *OsVersion;
    const char *imagePlatform;
    const char *SourcePipelineArn;
    const char *SourcePipelineName;
    const char *Reason;
    const char *Status;
    const char *imageType;
    const char *imageVersion;
    const char *requestId;
    int i;
    int count_i;

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    rest = CkRest_Create();

    authAws = CkAuthAws_Create();
    CkAuthAws_putAccessKey(authAws,"AWS_ACCESS_KEY");
    CkAuthAws_putSecretKey(authAws,"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.)
    CkAuthAws_putRegion(authAws,"us-west-2");
    CkAuthAws_putServiceName(authAws,"imagebuilder");
    // SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
    CkRest_SetAuthAws(rest,authAws);

    // URL: https://imagebuilder.us-west-2.amazonaws.com/
    // Use the same region as specified above.
    success = CkRest_Connect(rest,"imagebuilder.us-west-2.amazonaws.com",443,TRUE,TRUE);
    if (success != TRUE) {
        printf("ConnectFailReason: %d\n",CkRest_getConnectFailReason(rest));
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        CkAuthAws_Dispose(authAws);
        return;
    }

    CkRest_AddHeader(rest,"Content-Type","application/x-amz-json-1.1");
    CkRest_AddHeader(rest,"X-Amz-Target","GetImage");

    sbResponseBody = CkStringBuilder_Create();
    success = CkRest_FullRequestNoBodySb(rest,"GET","/GetImage",sbResponseBody);
    if (success != TRUE) {
        printf("%s\n",CkRest_lastErrorText(rest));
        CkRest_Dispose(rest);
        CkAuthAws_Dispose(authAws);
        CkStringBuilder_Dispose(sbResponseBody);
        return;
    }

    respStatusCode = CkRest_getResponseStatusCode(rest);
    printf("response status code = %d\n",respStatusCode);
    if (respStatusCode != 200) {
        printf("Response Header:\n");
        printf("%s\n",CkRest_responseHeader(rest));
        printf("Response Body:\n");
        printf("%s\n",CkStringBuilder_getAsString(sbResponseBody));
        CkRest_Dispose(rest);
        CkAuthAws_Dispose(authAws);
        CkStringBuilder_Dispose(sbResponseBody);
        return;
    }

    jResp = CkJsonObject_Create();
    CkJsonObject_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.

    Arn = CkJsonObject_stringOf(jResp,"image.arn");
    BuildType = CkJsonObject_stringOf(jResp,"image.buildType");
    ContainerRecipeArn = CkJsonObject_stringOf(jResp,"image.containerRecipe.arn");
    ContainerType = CkJsonObject_stringOf(jResp,"image.containerRecipe.containerType");
    DateCreated = CkJsonObject_stringOf(jResp,"image.containerRecipe.dateCreated");
    Description = CkJsonObject_stringOf(jResp,"image.containerRecipe.description");
    DockerfileTemplateData = CkJsonObject_stringOf(jResp,"image.containerRecipe.dockerfileTemplateData");
    Encrypted = CkJsonObject_IntOf(jResp,"image.containerRecipe.encrypted");
    Image = CkJsonObject_stringOf(jResp,"image.containerRecipe.instanceConfiguration.image");
    KmsKeyId = CkJsonObject_stringOf(jResp,"image.containerRecipe.kmsKeyId");
    Name = CkJsonObject_stringOf(jResp,"image.containerRecipe.name");
    Owner = CkJsonObject_stringOf(jResp,"image.containerRecipe.owner");
    ParentImage = CkJsonObject_stringOf(jResp,"image.containerRecipe.parentImage");
    Platform = CkJsonObject_stringOf(jResp,"image.containerRecipe.platform");
    v_String = CkJsonObject_stringOf(jResp,"image.containerRecipe.tags.string");
    RepositoryName = CkJsonObject_stringOf(jResp,"image.containerRecipe.targetRepository.repositoryName");
    Service = CkJsonObject_stringOf(jResp,"image.containerRecipe.targetRepository.service");
    Version = CkJsonObject_stringOf(jResp,"image.containerRecipe.version");
    WorkingDirectory = CkJsonObject_stringOf(jResp,"image.containerRecipe.workingDirectory");
    imageDateCreated = CkJsonObject_stringOf(jResp,"image.dateCreated");
    DistributionConfigurationArn = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.arn");
    DistributionConfigurationDateCreated = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.dateCreated");
    DateUpdated = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.dateUpdated");
    DistributionConfigurationDescription = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.description");
    DistributionConfigurationName = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.name");
    TagsString = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.tags.string");
    TimeoutMinutes = CkJsonObject_IntOf(jResp,"image.distributionConfiguration.timeoutMinutes");
    EnhancedImageMetadataEnabled = CkJsonObject_IntOf(jResp,"image.enhancedImageMetadataEnabled");
    UninstallAfterBuild = CkJsonObject_IntOf(jResp,"image.imageRecipe.additionalInstanceConfiguration.systemsManagerAgent.uninstallAfterBuild");
    UserDataOverride = CkJsonObject_stringOf(jResp,"image.imageRecipe.additionalInstanceConfiguration.userDataOverride");
    ImageRecipeArn = CkJsonObject_stringOf(jResp,"image.imageRecipe.arn");
    ImageRecipeDateCreated = CkJsonObject_stringOf(jResp,"image.imageRecipe.dateCreated");
    ImageRecipeDescription = CkJsonObject_stringOf(jResp,"image.imageRecipe.description");
    ImageRecipeName = CkJsonObject_stringOf(jResp,"image.imageRecipe.name");
    ImageRecipeOwner = CkJsonObject_stringOf(jResp,"image.imageRecipe.owner");
    ImageRecipeParentImage = CkJsonObject_stringOf(jResp,"image.imageRecipe.parentImage");
    ImageRecipePlatform = CkJsonObject_stringOf(jResp,"image.imageRecipe.platform");
    TagsString = CkJsonObject_stringOf(jResp,"image.imageRecipe.tags.string");
    v_Type = CkJsonObject_stringOf(jResp,"image.imageRecipe.type");
    ImageRecipeVersion = CkJsonObject_stringOf(jResp,"image.imageRecipe.version");
    ImageRecipeWorkingDirectory = CkJsonObject_stringOf(jResp,"image.imageRecipe.workingDirectory");
    ImageTestsEnabled = CkJsonObject_IntOf(jResp,"image.imageTestsConfiguration.imageTestsEnabled");
    ImageTestsConfigurationTimeoutMinutes = CkJsonObject_IntOf(jResp,"image.imageTestsConfiguration.timeoutMinutes");
    InfrastructureConfigurationArn = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.arn");
    InfrastructureConfigurationDateCreated = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.dateCreated");
    InfrastructureConfigurationDateUpdated = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.dateUpdated");
    InfrastructureConfigurationDescription = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.description");
    HttpPutResponseHopLimit = CkJsonObject_IntOf(jResp,"image.infrastructureConfiguration.instanceMetadataOptions.httpPutResponseHopLimit");
    HttpTokens = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.instanceMetadataOptions.httpTokens");
    InstanceProfileName = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.instanceProfileName");
    KeyPair = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.keyPair");
    S3BucketName = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.logging.s3Logs.s3BucketName");
    S3KeyPrefix = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.logging.s3Logs.s3KeyPrefix");
    InfrastructureConfigurationName = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.name");
    ResourceTagsString = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.resourceTags.string");
    SnsTopicArn = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.snsTopicArn");
    SubnetId = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.subnetId");
    TagsString = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.tags.string");
    TerminateInstanceOnFailure = CkJsonObject_IntOf(jResp,"image.infrastructureConfiguration.terminateInstanceOnFailure");
    imageName = CkJsonObject_stringOf(jResp,"image.name");
    OsVersion = CkJsonObject_stringOf(jResp,"image.osVersion");
    imagePlatform = CkJsonObject_stringOf(jResp,"image.platform");
    SourcePipelineArn = CkJsonObject_stringOf(jResp,"image.sourcePipelineArn");
    SourcePipelineName = CkJsonObject_stringOf(jResp,"image.sourcePipelineName");
    Reason = CkJsonObject_stringOf(jResp,"image.state.reason");
    Status = CkJsonObject_stringOf(jResp,"image.state.status");
    TagsString = CkJsonObject_stringOf(jResp,"image.tags.string");
    imageType = CkJsonObject_stringOf(jResp,"image.type");
    imageVersion = CkJsonObject_stringOf(jResp,"image.version");
    requestId = CkJsonObject_stringOf(jResp,"requestId");
    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"image.containerRecipe.components");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        componentArn = CkJsonObject_stringOf(jResp,"image.containerRecipe.components[i].componentArn");
        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.containerRecipe.components[i].parameters");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            name = CkJsonObject_stringOf(jResp,"image.containerRecipe.components[i].parameters[j].name");
            k = 0;
            count_k = CkJsonObject_SizeOfArray(jResp,"image.containerRecipe.components[i].parameters[j].value");
            while (k < count_k) {
                CkJsonObject_putK(jResp,k);
                strVal = CkJsonObject_stringOf(jResp,"image.containerRecipe.components[i].parameters[j].value[k]");
                k = k + 1;
            }

            j = j + 1;
        }

        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        deviceName = CkJsonObject_stringOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].deviceName");
        DeleteOnTermination = CkJsonObject_IntOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.deleteOnTermination");
        ebsEncrypted = CkJsonObject_IntOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.encrypted");
        Iops = CkJsonObject_IntOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.iops");
        ebsKmsKeyId = CkJsonObject_stringOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.kmsKeyId");
        SnapshotId = CkJsonObject_stringOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.snapshotId");
        Throughput = CkJsonObject_IntOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.throughput");
        VolumeSize = CkJsonObject_IntOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.volumeSize");
        VolumeType = CkJsonObject_stringOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.volumeType");
        noDevice = CkJsonObject_stringOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].noDevice");
        virtualName = CkJsonObject_stringOf(jResp,"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].virtualName");
        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        AmiTagsString = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.amiTags.string");
        amiDistributionConfigurationDescription = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.description");
        amiDistributionConfigurationKmsKeyId = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.kmsKeyId");
        amiDistributionConfigurationName = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.name");
        containerDistributionConfigurationDescription = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.description");
        TargetRepositoryRepositoryName = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.targetRepository.repositoryName");
        TargetRepositoryService = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.targetRepository.service");
        region = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].region");
        DiskImageFormat = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].s3ExportConfiguration.diskImageFormat");
        RoleName = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].s3ExportConfiguration.roleName");
        S3Bucket = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].s3ExportConfiguration.s3Bucket");
        S3Prefix = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].s3ExportConfiguration.s3Prefix");
        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationalUnitArns");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            strVal = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationalUnitArns[j]");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationArns");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            strVal = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationArns[j]");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userGroups");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            strVal = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userGroups[j]");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userIds");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            strVal = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userIds[j]");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.targetAccountIds");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            strVal = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.targetAccountIds[j]");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.containerTags");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            strVal = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.containerTags[j]");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions[i].fastLaunchConfigurations");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            accountId = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].accountId");
            enabled = CkJsonObject_IntOf(jResp,"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].enabled");
            LaunchTemplateId = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].launchTemplate.launchTemplateId");
            LaunchTemplateName = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].launchTemplate.launchTemplateName");
            LaunchTemplateVersion = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].launchTemplate.launchTemplateVersion");
            maxParallelLaunches = CkJsonObject_IntOf(jResp,"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].maxParallelLaunches");
            TargetResourceCount = CkJsonObject_IntOf(jResp,"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].snapshotConfiguration.targetResourceCount");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions[i].launchTemplateConfigurations");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            accountId = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].launchTemplateConfigurations[j].accountId");
            launchTemplateId = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].launchTemplateConfigurations[j].launchTemplateId");
            setDefaultVersion = CkJsonObject_IntOf(jResp,"image.distributionConfiguration.distributions[i].launchTemplateConfigurations[j].setDefaultVersion");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.distributionConfiguration.distributions[i].licenseConfigurationArns");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            strVal = CkJsonObject_stringOf(jResp,"image.distributionConfiguration.distributions[i].licenseConfigurationArns[j]");
            j = j + 1;
        }

        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"image.imageRecipe.blockDeviceMappings");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        deviceName = CkJsonObject_stringOf(jResp,"image.imageRecipe.blockDeviceMappings[i].deviceName");
        ebsDeleteOnTermination = CkJsonObject_IntOf(jResp,"image.imageRecipe.blockDeviceMappings[i].ebs.deleteOnTermination");
        ebsEncrypted = CkJsonObject_IntOf(jResp,"image.imageRecipe.blockDeviceMappings[i].ebs.encrypted");
        ebsIops = CkJsonObject_IntOf(jResp,"image.imageRecipe.blockDeviceMappings[i].ebs.iops");
        ebsKmsKeyId = CkJsonObject_stringOf(jResp,"image.imageRecipe.blockDeviceMappings[i].ebs.kmsKeyId");
        ebsSnapshotId = CkJsonObject_stringOf(jResp,"image.imageRecipe.blockDeviceMappings[i].ebs.snapshotId");
        ebsThroughput = CkJsonObject_IntOf(jResp,"image.imageRecipe.blockDeviceMappings[i].ebs.throughput");
        ebsVolumeSize = CkJsonObject_IntOf(jResp,"image.imageRecipe.blockDeviceMappings[i].ebs.volumeSize");
        ebsVolumeType = CkJsonObject_stringOf(jResp,"image.imageRecipe.blockDeviceMappings[i].ebs.volumeType");
        noDevice = CkJsonObject_stringOf(jResp,"image.imageRecipe.blockDeviceMappings[i].noDevice");
        virtualName = CkJsonObject_stringOf(jResp,"image.imageRecipe.blockDeviceMappings[i].virtualName");
        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"image.imageRecipe.components");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        componentArn = CkJsonObject_stringOf(jResp,"image.imageRecipe.components[i].componentArn");
        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.imageRecipe.components[i].parameters");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            name = CkJsonObject_stringOf(jResp,"image.imageRecipe.components[i].parameters[j].name");
            k = 0;
            count_k = CkJsonObject_SizeOfArray(jResp,"image.imageRecipe.components[i].parameters[j].value");
            while (k < count_k) {
                CkJsonObject_putK(jResp,k);
                strVal = CkJsonObject_stringOf(jResp,"image.imageRecipe.components[i].parameters[j].value[k]");
                k = k + 1;
            }

            j = j + 1;
        }

        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"image.infrastructureConfiguration.instanceTypes");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        strVal = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.instanceTypes[i]");
        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"image.infrastructureConfiguration.securityGroupIds");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        strVal = CkJsonObject_stringOf(jResp,"image.infrastructureConfiguration.securityGroupIds[i]");
        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"image.outputResources.amis");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        accountId = CkJsonObject_stringOf(jResp,"image.outputResources.amis[i].accountId");
        description = CkJsonObject_stringOf(jResp,"image.outputResources.amis[i].description");
        image = CkJsonObject_stringOf(jResp,"image.outputResources.amis[i].image");
        name = CkJsonObject_stringOf(jResp,"image.outputResources.amis[i].name");
        region = CkJsonObject_stringOf(jResp,"image.outputResources.amis[i].region");
        stateReason = CkJsonObject_stringOf(jResp,"image.outputResources.amis[i].state.reason");
        stateStatus = CkJsonObject_stringOf(jResp,"image.outputResources.amis[i].state.status");
        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"image.outputResources.containers");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        region = CkJsonObject_stringOf(jResp,"image.outputResources.containers[i].region");
        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"image.outputResources.containers[i].imageUris");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            strVal = CkJsonObject_stringOf(jResp,"image.outputResources.containers[i].imageUris[j]");
            j = j + 1;
        }

        i = i + 1;
    }

    // A sample JSON response body parsed by the above code:

    // {
    //   "image": {
    //     "arn": "string",
    //     "buildType": "string",
    //     "containerRecipe": {
    //       "arn": "string",
    //       "components": [
    //         {
    //           "componentArn": "string",
    //           "parameters": [
    //             {
    //               "name": "string",
    //               "value": [
    //                 "string"
    //               ]
    //             }
    //           ]
    //         }
    //       ],
    //       "containerType": "string",
    //       "dateCreated": "string",
    //       "description": "string",
    //       "dockerfileTemplateData": "string",
    //       "encrypted": boolean,
    //       "instanceConfiguration": {
    //         "blockDeviceMappings": [
    //           {
    //             "deviceName": "string",
    //             "ebs": {
    //               "deleteOnTermination": boolean,
    //               "encrypted": boolean,
    //               "iops": number,
    //               "kmsKeyId": "string",
    //               "snapshotId": "string",
    //               "throughput": number,
    //               "volumeSize": number,
    //               "volumeType": "string"
    //             },
    //             "noDevice": "string",
    //             "virtualName": "string"
    //           }
    //         ],
    //         "image": "string"
    //       },
    //       "kmsKeyId": "string",
    //       "name": "string",
    //       "owner": "string",
    //       "parentImage": "string",
    //       "platform": "string",
    //       "tags": {
    //         "string": "string"
    //       },
    //       "targetRepository": {
    //         "repositoryName": "string",
    //         "service": "string"
    //       },
    //       "version": "string",
    //       "workingDirectory": "string"
    //     },
    //     "dateCreated": "string",
    //     "distributionConfiguration": {
    //       "arn": "string",
    //       "dateCreated": "string",
    //       "dateUpdated": "string",
    //       "description": "string",
    //       "distributions": [
    //         {
    //           "amiDistributionConfiguration": {
    //             "amiTags": {
    //               "string": "string"
    //             },
    //             "description": "string",
    //             "kmsKeyId": "string",
    //             "launchPermission": {
    //               "organizationalUnitArns": [
    //                 "string"
    //               ],
    //               "organizationArns": [
    //                 "string"
    //               ],
    //               "userGroups": [
    //                 "string"
    //               ],
    //               "userIds": [
    //                 "string"
    //               ]
    //             },
    //             "name": "string",
    //             "targetAccountIds": [
    //               "string"
    //             ]
    //           },
    //           "containerDistributionConfiguration": {
    //             "containerTags": [
    //               "string"
    //             ],
    //             "description": "string",
    //             "targetRepository": {
    //               "repositoryName": "string",
    //               "service": "string"
    //             }
    //           },
    //           "fastLaunchConfigurations": [
    //             {
    //               "accountId": "string",
    //               "enabled": boolean,
    //               "launchTemplate": {
    //                 "launchTemplateId": "string",
    //                 "launchTemplateName": "string",
    //                 "launchTemplateVersion": "string"
    //               },
    //               "maxParallelLaunches": number,
    //               "snapshotConfiguration": {
    //                 "targetResourceCount": number
    //               }
    //             }
    //           ],
    //           "launchTemplateConfigurations": [
    //             {
    //               "accountId": "string",
    //               "launchTemplateId": "string",
    //               "setDefaultVersion": boolean
    //             }
    //           ],
    //           "licenseConfigurationArns": [
    //             "string"
    //           ],
    //           "region": "string",
    //           "s3ExportConfiguration": {
    //             "diskImageFormat": "string",
    //             "roleName": "string",
    //             "s3Bucket": "string",
    //             "s3Prefix": "string"
    //           }
    //         }
    //       ],
    //       "name": "string",
    //       "tags": {
    //         "string": "string"
    //       },
    //       "timeoutMinutes": number
    //     },
    //     "enhancedImageMetadataEnabled": boolean,
    //     "imageRecipe": {
    //       "additionalInstanceConfiguration": {
    //         "systemsManagerAgent": {
    //           "uninstallAfterBuild": boolean
    //         },
    //         "userDataOverride": "string"
    //       },
    //       "arn": "string",
    //       "blockDeviceMappings": [
    //         {
    //           "deviceName": "string",
    //           "ebs": {
    //             "deleteOnTermination": boolean,
    //             "encrypted": boolean,
    //             "iops": number,
    //             "kmsKeyId": "string",
    //             "snapshotId": "string",
    //             "throughput": number,
    //             "volumeSize": number,
    //             "volumeType": "string"
    //           },
    //           "noDevice": "string",
    //           "virtualName": "string"
    //         }
    //       ],
    //       "components": [
    //         {
    //           "componentArn": "string",
    //           "parameters": [
    //             {
    //               "name": "string",
    //               "value": [
    //                 "string"
    //               ]
    //             }
    //           ]
    //         }
    //       ],
    //       "dateCreated": "string",
    //       "description": "string",
    //       "name": "string",
    //       "owner": "string",
    //       "parentImage": "string",
    //       "platform": "string",
    //       "tags": {
    //         "string": "string"
    //       },
    //       "type": "string",
    //       "version": "string",
    //       "workingDirectory": "string"
    //     },
    //     "imageTestsConfiguration": {
    //       "imageTestsEnabled": boolean,
    //       "timeoutMinutes": number
    //     },
    //     "infrastructureConfiguration": {
    //       "arn": "string",
    //       "dateCreated": "string",
    //       "dateUpdated": "string",
    //       "description": "string",
    //       "instanceMetadataOptions": {
    //         "httpPutResponseHopLimit": number,
    //         "httpTokens": "string"
    //       },
    //       "instanceProfileName": "string",
    //       "instanceTypes": [
    //         "string"
    //       ],
    //       "keyPair": "string",
    //       "logging": {
    //         "s3Logs": {
    //           "s3BucketName": "string",
    //           "s3KeyPrefix": "string"
    //         }
    //       },
    //       "name": "string",
    //       "resourceTags": {
    //         "string": "string"
    //       },
    //       "securityGroupIds": [
    //         "string"
    //       ],
    //       "snsTopicArn": "string",
    //       "subnetId": "string",
    //       "tags": {
    //         "string": "string"
    //       },
    //       "terminateInstanceOnFailure": boolean
    //     },
    //     "name": "string",
    //     "osVersion": "string",
    //     "outputResources": {
    //       "amis": [
    //         {
    //           "accountId": "string",
    //           "description": "string",
    //           "image": "string",
    //           "name": "string",
    //           "region": "string",
    //           "state": {
    //             "reason": "string",
    //             "status": "string"
    //           }
    //         }
    //       ],
    //       "containers": [
    //         {
    //           "imageUris": [
    //             "string"
    //           ],
    //           "region": "string"
    //         }
    //       ]
    //     },
    //     "platform": "string",
    //     "sourcePipelineArn": "string",
    //     "sourcePipelineName": "string",
    //     "state": {
    //       "reason": "string",
    //       "status": "string"
    //     },
    //     "tags": {
    //       "string": "string"
    //     },
    //     "type": "string",
    //     "version": "string"
    //   },
    //   "requestId": "string"
    // }


    CkRest_Dispose(rest);
    CkAuthAws_Dispose(authAws);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jResp);

    }