Chilkat Online Tools

GetImage Objective-C Example

EC2 Image Builder

#import <CkoRest.h>
#import <CkoAuthAws.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
#import <NSString.h>

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

CkoRest *rest = [[CkoRest alloc] init];
BOOL success;

CkoAuthAws *authAws = [[CkoAuthAws alloc] init];
authAws.AccessKey = @"AWS_ACCESS_KEY";
authAws.SecretKey = @"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.Region = @"us-west-2";
authAws.ServiceName = @"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: @"imagebuilder.us-west-2.amazonaws.com" port: [NSNumber numberWithInt: 443] tls: YES autoReconnect: YES];
if (success != YES) {
    NSLog(@"%@%d",@"ConnectFailReason: ",[rest.ConnectFailReason intValue]);
    NSLog(@"%@",rest.LastErrorText);
    return;
}

[rest AddHeader: @"Content-Type" value: @"application/x-amz-json-1.1"];
[rest AddHeader: @"X-Amz-Target" value: @"GetImage"];

CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [rest FullRequestNoBodySb: @"GET" uriPath: @"/GetImage" sb: sbResponseBody];
if (success != YES) {
    NSLog(@"%@",rest.LastErrorText);
    return;
}

int respStatusCode = [rest.ResponseStatusCode intValue];
NSLog(@"%@%d",@"response status code = ",respStatusCode);
if (respStatusCode != 200) {
    NSLog(@"%@",@"Response Header:");
    NSLog(@"%@",rest.ResponseHeader);
    NSLog(@"%@",@"Response Body:");
    NSLog(@"%@",[sbResponseBody GetAsString]);
    return;
}

CkoJsonObject *jResp = [[CkoJsonObject alloc] init];
[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

NSString *componentArn = 0;
int j;
int count_j;
NSString *name = 0;
int k;
int count_k;
NSString *strVal = 0;
NSString *deviceName = 0;
int DeleteOnTermination;
int ebsEncrypted;
int Iops;
NSString *ebsKmsKeyId = 0;
NSString *SnapshotId = 0;
int Throughput;
int VolumeSize;
NSString *VolumeType = 0;
NSString *noDevice = 0;
NSString *virtualName = 0;
NSString *AmiTagsString = 0;
NSString *amiDistributionConfigurationDescription = 0;
NSString *amiDistributionConfigurationKmsKeyId = 0;
NSString *amiDistributionConfigurationName = 0;
NSString *containerDistributionConfigurationDescription = 0;
NSString *TargetRepositoryRepositoryName = 0;
NSString *TargetRepositoryService = 0;
NSString *region = 0;
NSString *DiskImageFormat = 0;
NSString *RoleName = 0;
NSString *S3Bucket = 0;
NSString *S3Prefix = 0;
NSString *accountId = 0;
int enabled;
NSString *LaunchTemplateId = 0;
NSString *LaunchTemplateName = 0;
NSString *LaunchTemplateVersion = 0;
int maxParallelLaunches;
int TargetResourceCount;
NSString *launchTemplateId = 0;
int setDefaultVersion;
int ebsDeleteOnTermination;
int ebsIops;
NSString *ebsSnapshotId = 0;
int ebsThroughput;
int ebsVolumeSize;
NSString *ebsVolumeType = 0;
NSString *description = 0;
NSString *image = 0;
NSString *stateReason = 0;
NSString *stateStatus = 0;

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

        j = j + 1;
    }

    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    deviceName = [jResp StringOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].deviceName"];
    DeleteOnTermination = [[jResp IntOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.deleteOnTermination"] intValue];
    ebsEncrypted = [[jResp IntOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.encrypted"] intValue];
    Iops = [[jResp IntOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.iops"] intValue];
    ebsKmsKeyId = [jResp StringOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.kmsKeyId"];
    SnapshotId = [jResp StringOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.snapshotId"];
    Throughput = [[jResp IntOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.throughput"] intValue];
    VolumeSize = [[jResp IntOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.volumeSize"] intValue];
    VolumeType = [jResp StringOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].ebs.volumeType"];
    noDevice = [jResp StringOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].noDevice"];
    virtualName = [jResp StringOf: @"image.containerRecipe.instanceConfiguration.blockDeviceMappings[i].virtualName"];
    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    AmiTagsString = [jResp StringOf: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.amiTags.string"];
    amiDistributionConfigurationDescription = [jResp StringOf: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.description"];
    amiDistributionConfigurationKmsKeyId = [jResp StringOf: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.kmsKeyId"];
    amiDistributionConfigurationName = [jResp StringOf: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.name"];
    containerDistributionConfigurationDescription = [jResp StringOf: @"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.description"];
    TargetRepositoryRepositoryName = [jResp StringOf: @"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.targetRepository.repositoryName"];
    TargetRepositoryService = [jResp StringOf: @"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.targetRepository.service"];
    region = [jResp StringOf: @"image.distributionConfiguration.distributions[i].region"];
    DiskImageFormat = [jResp StringOf: @"image.distributionConfiguration.distributions[i].s3ExportConfiguration.diskImageFormat"];
    RoleName = [jResp StringOf: @"image.distributionConfiguration.distributions[i].s3ExportConfiguration.roleName"];
    S3Bucket = [jResp StringOf: @"image.distributionConfiguration.distributions[i].s3ExportConfiguration.s3Bucket"];
    S3Prefix = [jResp StringOf: @"image.distributionConfiguration.distributions[i].s3ExportConfiguration.s3Prefix"];
    j = 0;
    count_j = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationalUnitArns"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        strVal = [jResp StringOf: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationalUnitArns[j]"];
        j = j + 1;
    }

    j = 0;
    count_j = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationArns"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        strVal = [jResp StringOf: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationArns[j]"];
        j = j + 1;
    }

    j = 0;
    count_j = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userGroups"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        strVal = [jResp StringOf: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userGroups[j]"];
        j = j + 1;
    }

    j = 0;
    count_j = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userIds"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        strVal = [jResp StringOf: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userIds[j]"];
        j = j + 1;
    }

    j = 0;
    count_j = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.targetAccountIds"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        strVal = [jResp StringOf: @"image.distributionConfiguration.distributions[i].amiDistributionConfiguration.targetAccountIds[j]"];
        j = j + 1;
    }

    j = 0;
    count_j = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.containerTags"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        strVal = [jResp StringOf: @"image.distributionConfiguration.distributions[i].containerDistributionConfiguration.containerTags[j]"];
        j = j + 1;
    }

    j = 0;
    count_j = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions[i].fastLaunchConfigurations"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        accountId = [jResp StringOf: @"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].accountId"];
        enabled = [[jResp IntOf: @"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].enabled"] intValue];
        LaunchTemplateId = [jResp StringOf: @"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].launchTemplate.launchTemplateId"];
        LaunchTemplateName = [jResp StringOf: @"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].launchTemplate.launchTemplateName"];
        LaunchTemplateVersion = [jResp StringOf: @"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].launchTemplate.launchTemplateVersion"];
        maxParallelLaunches = [[jResp IntOf: @"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].maxParallelLaunches"] intValue];
        TargetResourceCount = [[jResp IntOf: @"image.distributionConfiguration.distributions[i].fastLaunchConfigurations[j].snapshotConfiguration.targetResourceCount"] intValue];
        j = j + 1;
    }

    j = 0;
    count_j = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions[i].launchTemplateConfigurations"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        accountId = [jResp StringOf: @"image.distributionConfiguration.distributions[i].launchTemplateConfigurations[j].accountId"];
        launchTemplateId = [jResp StringOf: @"image.distributionConfiguration.distributions[i].launchTemplateConfigurations[j].launchTemplateId"];
        setDefaultVersion = [[jResp IntOf: @"image.distributionConfiguration.distributions[i].launchTemplateConfigurations[j].setDefaultVersion"] intValue];
        j = j + 1;
    }

    j = 0;
    count_j = [[jResp SizeOfArray: @"image.distributionConfiguration.distributions[i].licenseConfigurationArns"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        strVal = [jResp StringOf: @"image.distributionConfiguration.distributions[i].licenseConfigurationArns[j]"];
        j = j + 1;
    }

    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"image.imageRecipe.blockDeviceMappings"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    deviceName = [jResp StringOf: @"image.imageRecipe.blockDeviceMappings[i].deviceName"];
    ebsDeleteOnTermination = [[jResp IntOf: @"image.imageRecipe.blockDeviceMappings[i].ebs.deleteOnTermination"] intValue];
    ebsEncrypted = [[jResp IntOf: @"image.imageRecipe.blockDeviceMappings[i].ebs.encrypted"] intValue];
    ebsIops = [[jResp IntOf: @"image.imageRecipe.blockDeviceMappings[i].ebs.iops"] intValue];
    ebsKmsKeyId = [jResp StringOf: @"image.imageRecipe.blockDeviceMappings[i].ebs.kmsKeyId"];
    ebsSnapshotId = [jResp StringOf: @"image.imageRecipe.blockDeviceMappings[i].ebs.snapshotId"];
    ebsThroughput = [[jResp IntOf: @"image.imageRecipe.blockDeviceMappings[i].ebs.throughput"] intValue];
    ebsVolumeSize = [[jResp IntOf: @"image.imageRecipe.blockDeviceMappings[i].ebs.volumeSize"] intValue];
    ebsVolumeType = [jResp StringOf: @"image.imageRecipe.blockDeviceMappings[i].ebs.volumeType"];
    noDevice = [jResp StringOf: @"image.imageRecipe.blockDeviceMappings[i].noDevice"];
    virtualName = [jResp StringOf: @"image.imageRecipe.blockDeviceMappings[i].virtualName"];
    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"image.imageRecipe.components"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    componentArn = [jResp StringOf: @"image.imageRecipe.components[i].componentArn"];
    j = 0;
    count_j = [[jResp SizeOfArray: @"image.imageRecipe.components[i].parameters"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        name = [jResp StringOf: @"image.imageRecipe.components[i].parameters[j].name"];
        k = 0;
        count_k = [[jResp SizeOfArray: @"image.imageRecipe.components[i].parameters[j].value"] intValue];
        while (k < count_k) {
            jResp.K = [NSNumber numberWithInt: k];
            strVal = [jResp StringOf: @"image.imageRecipe.components[i].parameters[j].value[k]"];
            k = k + 1;
        }

        j = j + 1;
    }

    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"image.infrastructureConfiguration.instanceTypes"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    strVal = [jResp StringOf: @"image.infrastructureConfiguration.instanceTypes[i]"];
    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"image.infrastructureConfiguration.securityGroupIds"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    strVal = [jResp StringOf: @"image.infrastructureConfiguration.securityGroupIds[i]"];
    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"image.outputResources.amis"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    accountId = [jResp StringOf: @"image.outputResources.amis[i].accountId"];
    description = [jResp StringOf: @"image.outputResources.amis[i].description"];
    image = [jResp StringOf: @"image.outputResources.amis[i].image"];
    name = [jResp StringOf: @"image.outputResources.amis[i].name"];
    region = [jResp StringOf: @"image.outputResources.amis[i].region"];
    stateReason = [jResp StringOf: @"image.outputResources.amis[i].state.reason"];
    stateStatus = [jResp StringOf: @"image.outputResources.amis[i].state.status"];
    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"image.outputResources.containers"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    region = [jResp StringOf: @"image.outputResources.containers[i].region"];
    j = 0;
    count_j = [[jResp SizeOfArray: @"image.outputResources.containers[i].imageUris"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        strVal = [jResp StringOf: @"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"
// }