Chilkat Online Tools

StartBuildBatch unicodeCpp Example

AWS CodeBuild

#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"codebuild");
    // SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
    rest.SetAuthAws(authAws);

    // URL: https://codebuild.us-west-2.amazonaws.com/
    // Use the same region as specified above.
    success = rest.Connect(L"codebuild.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"artifactsOverride.artifactIdentifier",L"string");
    json.UpdateString(L"artifactsOverride.bucketOwnerAccess",L"string");
    json.UpdateInt(L"artifactsOverride.encryptionDisabled",123);
    json.UpdateString(L"artifactsOverride.location",L"string");
    json.UpdateString(L"artifactsOverride.name",L"string");
    json.UpdateString(L"artifactsOverride.namespaceType",L"string");
    json.UpdateInt(L"artifactsOverride.overrideArtifactName",123);
    json.UpdateString(L"artifactsOverride.packaging",L"string");
    json.UpdateString(L"artifactsOverride.path",L"string");
    json.UpdateString(L"artifactsOverride.type",L"string");
    json.UpdateString(L"buildBatchConfigOverride.batchReportMode",L"string");
    json.UpdateInt(L"buildBatchConfigOverride.combineArtifacts",123);
    json.UpdateString(L"buildBatchConfigOverride.restrictions.computeTypesAllowed[0]",L"string");
    json.UpdateInt(L"buildBatchConfigOverride.restrictions.maximumBuildsAllowed",123);
    json.UpdateString(L"buildBatchConfigOverride.serviceRole",L"string");
    json.UpdateInt(L"buildBatchConfigOverride.timeoutInMins",123);
    json.UpdateString(L"buildspecOverride",L"string");
    json.UpdateInt(L"buildTimeoutInMinutesOverride",123);
    json.UpdateString(L"cacheOverride.location",L"string");
    json.UpdateString(L"cacheOverride.modes[0]",L"string");
    json.UpdateString(L"cacheOverride.type",L"string");
    json.UpdateString(L"certificateOverride",L"string");
    json.UpdateString(L"computeTypeOverride",L"string");
    json.UpdateInt(L"debugSessionEnabled",123);
    json.UpdateString(L"encryptionKeyOverride",L"string");
    json.UpdateString(L"environmentTypeOverride",L"string");
    json.UpdateString(L"environmentVariablesOverride[0].name",L"string");
    json.UpdateString(L"environmentVariablesOverride[0].type",L"string");
    json.UpdateString(L"environmentVariablesOverride[0].value",L"string");
    json.UpdateInt(L"gitCloneDepthOverride",123);
    json.UpdateInt(L"gitSubmodulesConfigOverride.fetchSubmodules",123);
    json.UpdateString(L"idempotencyToken",L"string");
    json.UpdateString(L"imageOverride",L"string");
    json.UpdateString(L"imagePullCredentialsTypeOverride",L"string");
    json.UpdateInt(L"insecureSslOverride",123);
    json.UpdateString(L"logsConfigOverride.cloudWatchLogs.groupName",L"string");
    json.UpdateString(L"logsConfigOverride.cloudWatchLogs.status",L"string");
    json.UpdateString(L"logsConfigOverride.cloudWatchLogs.streamName",L"string");
    json.UpdateString(L"logsConfigOverride.s3Logs.bucketOwnerAccess",L"string");
    json.UpdateInt(L"logsConfigOverride.s3Logs.encryptionDisabled",123);
    json.UpdateString(L"logsConfigOverride.s3Logs.location",L"string");
    json.UpdateString(L"logsConfigOverride.s3Logs.status",L"string");
    json.UpdateInt(L"privilegedModeOverride",123);
    json.UpdateString(L"projectName",L"string");
    json.UpdateInt(L"queuedTimeoutInMinutesOverride",123);
    json.UpdateString(L"registryCredentialOverride.credential",L"string");
    json.UpdateString(L"registryCredentialOverride.credentialProvider",L"string");
    json.UpdateInt(L"reportBuildBatchStatusOverride",123);
    json.UpdateString(L"secondaryArtifactsOverride[0].artifactIdentifier",L"string");
    json.UpdateString(L"secondaryArtifactsOverride[0].bucketOwnerAccess",L"string");
    json.UpdateInt(L"secondaryArtifactsOverride[0].encryptionDisabled",123);
    json.UpdateString(L"secondaryArtifactsOverride[0].location",L"string");
    json.UpdateString(L"secondaryArtifactsOverride[0].name",L"string");
    json.UpdateString(L"secondaryArtifactsOverride[0].namespaceType",L"string");
    json.UpdateInt(L"secondaryArtifactsOverride[0].overrideArtifactName",123);
    json.UpdateString(L"secondaryArtifactsOverride[0].packaging",L"string");
    json.UpdateString(L"secondaryArtifactsOverride[0].path",L"string");
    json.UpdateString(L"secondaryArtifactsOverride[0].type",L"string");
    json.UpdateString(L"secondarySourcesOverride[0].auth.resource",L"string");
    json.UpdateString(L"secondarySourcesOverride[0].auth.type",L"string");
    json.UpdateString(L"secondarySourcesOverride[0].buildspec",L"string");
    json.UpdateString(L"secondarySourcesOverride[0].buildStatusConfig.context",L"string");
    json.UpdateString(L"secondarySourcesOverride[0].buildStatusConfig.targetUrl",L"string");
    json.UpdateInt(L"secondarySourcesOverride[0].gitCloneDepth",123);
    json.UpdateInt(L"secondarySourcesOverride[0].gitSubmodulesConfig.fetchSubmodules",123);
    json.UpdateInt(L"secondarySourcesOverride[0].insecureSsl",123);
    json.UpdateString(L"secondarySourcesOverride[0].location",L"string");
    json.UpdateInt(L"secondarySourcesOverride[0].reportBuildStatus",123);
    json.UpdateString(L"secondarySourcesOverride[0].sourceIdentifier",L"string");
    json.UpdateString(L"secondarySourcesOverride[0].type",L"string");
    json.UpdateString(L"secondarySourcesVersionOverride[0].sourceIdentifier",L"string");
    json.UpdateString(L"secondarySourcesVersionOverride[0].sourceVersion",L"string");
    json.UpdateString(L"serviceRoleOverride",L"string");
    json.UpdateString(L"sourceAuthOverride.resource",L"string");
    json.UpdateString(L"sourceAuthOverride.type",L"string");
    json.UpdateString(L"sourceLocationOverride",L"string");
    json.UpdateString(L"sourceTypeOverride",L"string");
    json.UpdateString(L"sourceVersion",L"string");

    // The JSON request body created by the above code:

    // {
    //   "artifactsOverride": {
    //     "artifactIdentifier": "string",
    //     "bucketOwnerAccess": "string",
    //     "encryptionDisabled": boolean,
    //     "location": "string",
    //     "name": "string",
    //     "namespaceType": "string",
    //     "overrideArtifactName": boolean,
    //     "packaging": "string",
    //     "path": "string",
    //     "type": "string"
    //   },
    //   "buildBatchConfigOverride": {
    //     "batchReportMode": "string",
    //     "combineArtifacts": boolean,
    //     "restrictions": {
    //       "computeTypesAllowed": [
    //         "string"
    //       ],
    //       "maximumBuildsAllowed": number
    //     },
    //     "serviceRole": "string",
    //     "timeoutInMins": number
    //   },
    //   "buildspecOverride": "string",
    //   "buildTimeoutInMinutesOverride": number,
    //   "cacheOverride": {
    //     "location": "string",
    //     "modes": [
    //       "string"
    //     ],
    //     "type": "string"
    //   },
    //   "certificateOverride": "string",
    //   "computeTypeOverride": "string",
    //   "debugSessionEnabled": boolean,
    //   "encryptionKeyOverride": "string",
    //   "environmentTypeOverride": "string",
    //   "environmentVariablesOverride": [
    //     {
    //       "name": "string",
    //       "type": "string",
    //       "value": "string"
    //     }
    //   ],
    //   "gitCloneDepthOverride": number,
    //   "gitSubmodulesConfigOverride": {
    //     "fetchSubmodules": boolean
    //   },
    //   "idempotencyToken": "string",
    //   "imageOverride": "string",
    //   "imagePullCredentialsTypeOverride": "string",
    //   "insecureSslOverride": boolean,
    //   "logsConfigOverride": {
    //     "cloudWatchLogs": {
    //       "groupName": "string",
    //       "status": "string",
    //       "streamName": "string"
    //     },
    //     "s3Logs": {
    //       "bucketOwnerAccess": "string",
    //       "encryptionDisabled": boolean,
    //       "location": "string",
    //       "status": "string"
    //     }
    //   },
    //   "privilegedModeOverride": boolean,
    //   "projectName": "string",
    //   "queuedTimeoutInMinutesOverride": number,
    //   "registryCredentialOverride": {
    //     "credential": "string",
    //     "credentialProvider": "string"
    //   },
    //   "reportBuildBatchStatusOverride": boolean,
    //   "secondaryArtifactsOverride": [
    //     {
    //       "artifactIdentifier": "string",
    //       "bucketOwnerAccess": "string",
    //       "encryptionDisabled": boolean,
    //       "location": "string",
    //       "name": "string",
    //       "namespaceType": "string",
    //       "overrideArtifactName": boolean,
    //       "packaging": "string",
    //       "path": "string",
    //       "type": "string"
    //     }
    //   ],
    //   "secondarySourcesOverride": [
    //     {
    //       "auth": {
    //         "resource": "string",
    //         "type": "string"
    //       },
    //       "buildspec": "string",
    //       "buildStatusConfig": {
    //         "context": "string",
    //         "targetUrl": "string"
    //       },
    //       "gitCloneDepth": number,
    //       "gitSubmodulesConfig": {
    //         "fetchSubmodules": boolean
    //       },
    //       "insecureSsl": boolean,
    //       "location": "string",
    //       "reportBuildStatus": boolean,
    //       "sourceIdentifier": "string",
    //       "type": "string"
    //     }
    //   ],
    //   "secondarySourcesVersionOverride": [
    //     {
    //       "sourceIdentifier": "string",
    //       "sourceVersion": "string"
    //     }
    //   ],
    //   "serviceRoleOverride": "string",
    //   "sourceAuthOverride": {
    //     "resource": "string",
    //     "type": "string"
    //   },
    //   "sourceLocationOverride": "string",
    //   "sourceTypeOverride": "string",
    //   "sourceVersion": "string"
    // }

    rest.AddHeader(L"Content-Type",L"application/x-amz-json-1.1");
    rest.AddHeader(L"X-Amz-Target",L"CodeBuild_20161006.StartBuildBatch");

    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 *strVal = 0;
    const wchar_t *currentBuildSummaryArn = 0;
    const wchar_t *BuildStatus = 0;
    const wchar_t *Identifier = 0;
    const wchar_t *PrimaryArtifactLocation = 0;
    const wchar_t *PrimaryArtifactType = 0;
    int RequestedOn;
    const wchar_t *identifier = 0;
    int ignoreFailure;
    int j;
    int count_j;
    const wchar_t *location = 0;
    const wchar_t *v_type = 0;
    const wchar_t *arn = 0;
    const wchar_t *buildStatus = 0;
    const wchar_t *primaryArtifactIdentifier = 0;
    const wchar_t *primaryArtifactLocation = 0;
    const wchar_t *primaryArtifactType = 0;
    int requestedOn;
    int k;
    int count_k;
    const wchar_t *name = 0;
    const wchar_t *value = 0;
    const wchar_t *mountOptions = 0;
    const wchar_t *mountPoint = 0;
    int durationInSeconds;
    int endTime;
    const wchar_t *phaseStatus = 0;
    const wchar_t *phaseType = 0;
    int startTime;
    const wchar_t *message = 0;
    const wchar_t *statusCode = 0;
    const wchar_t *artifactIdentifier = 0;
    const wchar_t *bucketOwnerAccess = 0;
    int encryptionDisabled;
    const wchar_t *md5sum = 0;
    int overrideArtifactName;
    const wchar_t *sha256sum = 0;
    const wchar_t *authResource = 0;
    const wchar_t *authType = 0;
    const wchar_t *buildspec = 0;
    const wchar_t *buildStatusConfigContext = 0;
    const wchar_t *buildStatusConfigTargetUrl = 0;
    int gitCloneDepth;
    int gitSubmodulesConfigFetchSubmodules;
    int insecureSsl;
    int reportBuildStatus;
    const wchar_t *sourceIdentifier = 0;
    const wchar_t *sourceVersion = 0;

    const wchar_t *Arn = jResp.stringOf(L"buildBatch.arn");
    const wchar_t *ArtifactIdentifier = jResp.stringOf(L"buildBatch.artifacts.artifactIdentifier");
    const wchar_t *BucketOwnerAccess = jResp.stringOf(L"buildBatch.artifacts.bucketOwnerAccess");
    int EncryptionDisabled = jResp.IntOf(L"buildBatch.artifacts.encryptionDisabled");
    const wchar_t *Location = jResp.stringOf(L"buildBatch.artifacts.location");
    const wchar_t *Md5sum = jResp.stringOf(L"buildBatch.artifacts.md5sum");
    int OverrideArtifactName = jResp.IntOf(L"buildBatch.artifacts.overrideArtifactName");
    const wchar_t *Sha256sum = jResp.stringOf(L"buildBatch.artifacts.sha256sum");
    const wchar_t *BatchReportMode = jResp.stringOf(L"buildBatch.buildBatchConfig.batchReportMode");
    int CombineArtifacts = jResp.IntOf(L"buildBatch.buildBatchConfig.combineArtifacts");
    int MaximumBuildsAllowed = jResp.IntOf(L"buildBatch.buildBatchConfig.restrictions.maximumBuildsAllowed");
    const wchar_t *ServiceRole = jResp.stringOf(L"buildBatch.buildBatchConfig.serviceRole");
    int TimeoutInMins = jResp.IntOf(L"buildBatch.buildBatchConfig.timeoutInMins");
    int BuildBatchNumber = jResp.IntOf(L"buildBatch.buildBatchNumber");
    const wchar_t *BuildBatchStatus = jResp.stringOf(L"buildBatch.buildBatchStatus");
    int BuildTimeoutInMinutes = jResp.IntOf(L"buildBatch.buildTimeoutInMinutes");
    const wchar_t *CacheLocation = jResp.stringOf(L"buildBatch.cache.location");
    const wchar_t *v_Type = jResp.stringOf(L"buildBatch.cache.type");
    int Complete = jResp.IntOf(L"buildBatch.complete");
    const wchar_t *CurrentPhase = jResp.stringOf(L"buildBatch.currentPhase");
    int DebugSessionEnabled = jResp.IntOf(L"buildBatch.debugSessionEnabled");
    const wchar_t *EncryptionKey = jResp.stringOf(L"buildBatch.encryptionKey");
    int EndTime = jResp.IntOf(L"buildBatch.endTime");
    const wchar_t *Certificate = jResp.stringOf(L"buildBatch.environment.certificate");
    const wchar_t *ComputeType = jResp.stringOf(L"buildBatch.environment.computeType");
    const wchar_t *Image = jResp.stringOf(L"buildBatch.environment.image");
    const wchar_t *ImagePullCredentialsType = jResp.stringOf(L"buildBatch.environment.imagePullCredentialsType");
    int PrivilegedMode = jResp.IntOf(L"buildBatch.environment.privilegedMode");
    const wchar_t *Credential = jResp.stringOf(L"buildBatch.environment.registryCredential.credential");
    const wchar_t *CredentialProvider = jResp.stringOf(L"buildBatch.environment.registryCredential.credentialProvider");
    const wchar_t *EnvironmentType = jResp.stringOf(L"buildBatch.environment.type");
    const wchar_t *Id = jResp.stringOf(L"buildBatch.id");
    const wchar_t *Initiator = jResp.stringOf(L"buildBatch.initiator");
    const wchar_t *GroupName = jResp.stringOf(L"buildBatch.logConfig.cloudWatchLogs.groupName");
    const wchar_t *Status = jResp.stringOf(L"buildBatch.logConfig.cloudWatchLogs.status");
    const wchar_t *StreamName = jResp.stringOf(L"buildBatch.logConfig.cloudWatchLogs.streamName");
    const wchar_t *S3LogsBucketOwnerAccess = jResp.stringOf(L"buildBatch.logConfig.s3Logs.bucketOwnerAccess");
    int S3LogsEncryptionDisabled = jResp.IntOf(L"buildBatch.logConfig.s3Logs.encryptionDisabled");
    const wchar_t *S3LogsLocation = jResp.stringOf(L"buildBatch.logConfig.s3Logs.location");
    const wchar_t *S3LogsStatus = jResp.stringOf(L"buildBatch.logConfig.s3Logs.status");
    const wchar_t *ProjectName = jResp.stringOf(L"buildBatch.projectName");
    int QueuedTimeoutInMinutes = jResp.IntOf(L"buildBatch.queuedTimeoutInMinutes");
    const wchar_t *ResolvedSourceVersion = jResp.stringOf(L"buildBatch.resolvedSourceVersion");
    const wchar_t *buildBatchServiceRole = jResp.stringOf(L"buildBatch.serviceRole");
    const wchar_t *Resource = jResp.stringOf(L"buildBatch.source.auth.resource");
    const wchar_t *AuthType = jResp.stringOf(L"buildBatch.source.auth.type");
    const wchar_t *Buildspec = jResp.stringOf(L"buildBatch.source.buildspec");
    const wchar_t *Context = jResp.stringOf(L"buildBatch.source.buildStatusConfig.context");
    const wchar_t *TargetUrl = jResp.stringOf(L"buildBatch.source.buildStatusConfig.targetUrl");
    int GitCloneDepth = jResp.IntOf(L"buildBatch.source.gitCloneDepth");
    int FetchSubmodules = jResp.IntOf(L"buildBatch.source.gitSubmodulesConfig.fetchSubmodules");
    int InsecureSsl = jResp.IntOf(L"buildBatch.source.insecureSsl");
    const wchar_t *SourceLocation = jResp.stringOf(L"buildBatch.source.location");
    int ReportBuildStatus = jResp.IntOf(L"buildBatch.source.reportBuildStatus");
    const wchar_t *SourceIdentifier = jResp.stringOf(L"buildBatch.source.sourceIdentifier");
    const wchar_t *SourceType = jResp.stringOf(L"buildBatch.source.type");
    const wchar_t *SourceVersion = jResp.stringOf(L"buildBatch.sourceVersion");
    int StartTime = jResp.IntOf(L"buildBatch.startTime");
    const wchar_t *VpcId = jResp.stringOf(L"buildBatch.vpcConfig.vpcId");
    int i = 0;
    int count_i = jResp.SizeOfArray(L"buildBatch.buildBatchConfig.restrictions.computeTypesAllowed");
    while (i < count_i) {
        jResp.put_I(i);
        strVal = jResp.stringOf(L"buildBatch.buildBatchConfig.restrictions.computeTypesAllowed[i]");
        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.buildGroups");
    while (i < count_i) {
        jResp.put_I(i);
        currentBuildSummaryArn = jResp.stringOf(L"buildBatch.buildGroups[i].currentBuildSummary.arn");
        BuildStatus = jResp.stringOf(L"buildBatch.buildGroups[i].currentBuildSummary.buildStatus");
        Identifier = jResp.stringOf(L"buildBatch.buildGroups[i].currentBuildSummary.primaryArtifact.identifier");
        PrimaryArtifactLocation = jResp.stringOf(L"buildBatch.buildGroups[i].currentBuildSummary.primaryArtifact.location");
        PrimaryArtifactType = jResp.stringOf(L"buildBatch.buildGroups[i].currentBuildSummary.primaryArtifact.type");
        RequestedOn = jResp.IntOf(L"buildBatch.buildGroups[i].currentBuildSummary.requestedOn");
        identifier = jResp.stringOf(L"buildBatch.buildGroups[i].identifier");
        ignoreFailure = jResp.IntOf(L"buildBatch.buildGroups[i].ignoreFailure");
        j = 0;
        count_j = jResp.SizeOfArray(L"buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts");
        while (j < count_j) {
            jResp.put_J(j);
            identifier = jResp.stringOf(L"buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts[j].identifier");
            location = jResp.stringOf(L"buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts[j].location");
            v_type = jResp.stringOf(L"buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts[j].type");
            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"buildBatch.buildGroups[i].dependsOn");
        while (j < count_j) {
            jResp.put_J(j);
            strVal = jResp.stringOf(L"buildBatch.buildGroups[i].dependsOn[j]");
            j = j + 1;
        }

        j = 0;
        count_j = jResp.SizeOfArray(L"buildBatch.buildGroups[i].priorBuildSummaryList");
        while (j < count_j) {
            jResp.put_J(j);
            arn = jResp.stringOf(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].arn");
            buildStatus = jResp.stringOf(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].buildStatus");
            primaryArtifactIdentifier = jResp.stringOf(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].primaryArtifact.identifier");
            primaryArtifactLocation = jResp.stringOf(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].primaryArtifact.location");
            primaryArtifactType = jResp.stringOf(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].primaryArtifact.type");
            requestedOn = jResp.IntOf(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].requestedOn");
            k = 0;
            count_k = jResp.SizeOfArray(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts");
            while (k < count_k) {
                jResp.put_K(k);
                identifier = jResp.stringOf(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts[k].identifier");
                location = jResp.stringOf(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts[k].location");
                v_type = jResp.stringOf(L"buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts[k].type");
                k = k + 1;
            }

            j = j + 1;
        }

        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.cache.modes");
    while (i < count_i) {
        jResp.put_I(i);
        strVal = jResp.stringOf(L"buildBatch.cache.modes[i]");
        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.environment.environmentVariables");
    while (i < count_i) {
        jResp.put_I(i);
        name = jResp.stringOf(L"buildBatch.environment.environmentVariables[i].name");
        v_type = jResp.stringOf(L"buildBatch.environment.environmentVariables[i].type");
        value = jResp.stringOf(L"buildBatch.environment.environmentVariables[i].value");
        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.fileSystemLocations");
    while (i < count_i) {
        jResp.put_I(i);
        identifier = jResp.stringOf(L"buildBatch.fileSystemLocations[i].identifier");
        location = jResp.stringOf(L"buildBatch.fileSystemLocations[i].location");
        mountOptions = jResp.stringOf(L"buildBatch.fileSystemLocations[i].mountOptions");
        mountPoint = jResp.stringOf(L"buildBatch.fileSystemLocations[i].mountPoint");
        v_type = jResp.stringOf(L"buildBatch.fileSystemLocations[i].type");
        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.phases");
    while (i < count_i) {
        jResp.put_I(i);
        durationInSeconds = jResp.IntOf(L"buildBatch.phases[i].durationInSeconds");
        endTime = jResp.IntOf(L"buildBatch.phases[i].endTime");
        phaseStatus = jResp.stringOf(L"buildBatch.phases[i].phaseStatus");
        phaseType = jResp.stringOf(L"buildBatch.phases[i].phaseType");
        startTime = jResp.IntOf(L"buildBatch.phases[i].startTime");
        j = 0;
        count_j = jResp.SizeOfArray(L"buildBatch.phases[i].contexts");
        while (j < count_j) {
            jResp.put_J(j);
            message = jResp.stringOf(L"buildBatch.phases[i].contexts[j].message");
            statusCode = jResp.stringOf(L"buildBatch.phases[i].contexts[j].statusCode");
            j = j + 1;
        }

        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.secondaryArtifacts");
    while (i < count_i) {
        jResp.put_I(i);
        artifactIdentifier = jResp.stringOf(L"buildBatch.secondaryArtifacts[i].artifactIdentifier");
        bucketOwnerAccess = jResp.stringOf(L"buildBatch.secondaryArtifacts[i].bucketOwnerAccess");
        encryptionDisabled = jResp.IntOf(L"buildBatch.secondaryArtifacts[i].encryptionDisabled");
        location = jResp.stringOf(L"buildBatch.secondaryArtifacts[i].location");
        md5sum = jResp.stringOf(L"buildBatch.secondaryArtifacts[i].md5sum");
        overrideArtifactName = jResp.IntOf(L"buildBatch.secondaryArtifacts[i].overrideArtifactName");
        sha256sum = jResp.stringOf(L"buildBatch.secondaryArtifacts[i].sha256sum");
        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.secondarySources");
    while (i < count_i) {
        jResp.put_I(i);
        authResource = jResp.stringOf(L"buildBatch.secondarySources[i].auth.resource");
        authType = jResp.stringOf(L"buildBatch.secondarySources[i].auth.type");
        buildspec = jResp.stringOf(L"buildBatch.secondarySources[i].buildspec");
        buildStatusConfigContext = jResp.stringOf(L"buildBatch.secondarySources[i].buildStatusConfig.context");
        buildStatusConfigTargetUrl = jResp.stringOf(L"buildBatch.secondarySources[i].buildStatusConfig.targetUrl");
        gitCloneDepth = jResp.IntOf(L"buildBatch.secondarySources[i].gitCloneDepth");
        gitSubmodulesConfigFetchSubmodules = jResp.IntOf(L"buildBatch.secondarySources[i].gitSubmodulesConfig.fetchSubmodules");
        insecureSsl = jResp.IntOf(L"buildBatch.secondarySources[i].insecureSsl");
        location = jResp.stringOf(L"buildBatch.secondarySources[i].location");
        reportBuildStatus = jResp.IntOf(L"buildBatch.secondarySources[i].reportBuildStatus");
        sourceIdentifier = jResp.stringOf(L"buildBatch.secondarySources[i].sourceIdentifier");
        v_type = jResp.stringOf(L"buildBatch.secondarySources[i].type");
        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.secondarySourceVersions");
    while (i < count_i) {
        jResp.put_I(i);
        sourceIdentifier = jResp.stringOf(L"buildBatch.secondarySourceVersions[i].sourceIdentifier");
        sourceVersion = jResp.stringOf(L"buildBatch.secondarySourceVersions[i].sourceVersion");
        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.vpcConfig.securityGroupIds");
    while (i < count_i) {
        jResp.put_I(i);
        strVal = jResp.stringOf(L"buildBatch.vpcConfig.securityGroupIds[i]");
        i = i + 1;
    }

    i = 0;
    count_i = jResp.SizeOfArray(L"buildBatch.vpcConfig.subnets");
    while (i < count_i) {
        jResp.put_I(i);
        strVal = jResp.stringOf(L"buildBatch.vpcConfig.subnets[i]");
        i = i + 1;
    }

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

    // {
    //   "buildBatch": {
    //     "arn": "string",
    //     "artifacts": {
    //       "artifactIdentifier": "string",
    //       "bucketOwnerAccess": "string",
    //       "encryptionDisabled": boolean,
    //       "location": "string",
    //       "md5sum": "string",
    //       "overrideArtifactName": boolean,
    //       "sha256sum": "string"
    //     },
    //     "buildBatchConfig": {
    //       "batchReportMode": "string",
    //       "combineArtifacts": boolean,
    //       "restrictions": {
    //         "computeTypesAllowed": [
    //           "string"
    //         ],
    //         "maximumBuildsAllowed": number
    //       },
    //       "serviceRole": "string",
    //       "timeoutInMins": number
    //     },
    //     "buildBatchNumber": number,
    //     "buildBatchStatus": "string",
    //     "buildGroups": [
    //       {
    //         "currentBuildSummary": {
    //           "arn": "string",
    //           "buildStatus": "string",
    //           "primaryArtifact": {
    //             "identifier": "string",
    //             "location": "string",
    //             "type": "string"
    //           },
    //           "requestedOn": number,
    //           "secondaryArtifacts": [
    //             {
    //               "identifier": "string",
    //               "location": "string",
    //               "type": "string"
    //             }
    //           ]
    //         },
    //         "dependsOn": [
    //           "string"
    //         ],
    //         "identifier": "string",
    //         "ignoreFailure": boolean,
    //         "priorBuildSummaryList": [
    //           {
    //             "arn": "string",
    //             "buildStatus": "string",
    //             "primaryArtifact": {
    //               "identifier": "string",
    //               "location": "string",
    //               "type": "string"
    //             },
    //             "requestedOn": number,
    //             "secondaryArtifacts": [
    //               {
    //                 "identifier": "string",
    //                 "location": "string",
    //                 "type": "string"
    //               }
    //             ]
    //           }
    //         ]
    //       }
    //     ],
    //     "buildTimeoutInMinutes": number,
    //     "cache": {
    //       "location": "string",
    //       "modes": [
    //         "string"
    //       ],
    //       "type": "string"
    //     },
    //     "complete": boolean,
    //     "currentPhase": "string",
    //     "debugSessionEnabled": boolean,
    //     "encryptionKey": "string",
    //     "endTime": number,
    //     "environment": {
    //       "certificate": "string",
    //       "computeType": "string",
    //       "environmentVariables": [
    //         {
    //           "name": "string",
    //           "type": "string",
    //           "value": "string"
    //         }
    //       ],
    //       "image": "string",
    //       "imagePullCredentialsType": "string",
    //       "privilegedMode": boolean,
    //       "registryCredential": {
    //         "credential": "string",
    //         "credentialProvider": "string"
    //       },
    //       "type": "string"
    //     },
    //     "fileSystemLocations": [
    //       {
    //         "identifier": "string",
    //         "location": "string",
    //         "mountOptions": "string",
    //         "mountPoint": "string",
    //         "type": "string"
    //       }
    //     ],
    //     "id": "string",
    //     "initiator": "string",
    //     "logConfig": {
    //       "cloudWatchLogs": {
    //         "groupName": "string",
    //         "status": "string",
    //         "streamName": "string"
    //       },
    //       "s3Logs": {
    //         "bucketOwnerAccess": "string",
    //         "encryptionDisabled": boolean,
    //         "location": "string",
    //         "status": "string"
    //       }
    //     },
    //     "phases": [
    //       {
    //         "contexts": [
    //           {
    //             "message": "string",
    //             "statusCode": "string"
    //           }
    //         ],
    //         "durationInSeconds": number,
    //         "endTime": number,
    //         "phaseStatus": "string",
    //         "phaseType": "string",
    //         "startTime": number
    //       }
    //     ],
    //     "projectName": "string",
    //     "queuedTimeoutInMinutes": number,
    //     "resolvedSourceVersion": "string",
    //     "secondaryArtifacts": [
    //       {
    //         "artifactIdentifier": "string",
    //         "bucketOwnerAccess": "string",
    //         "encryptionDisabled": boolean,
    //         "location": "string",
    //         "md5sum": "string",
    //         "overrideArtifactName": boolean,
    //         "sha256sum": "string"
    //       }
    //     ],
    //     "secondarySources": [
    //       {
    //         "auth": {
    //           "resource": "string",
    //           "type": "string"
    //         },
    //         "buildspec": "string",
    //         "buildStatusConfig": {
    //           "context": "string",
    //           "targetUrl": "string"
    //         },
    //         "gitCloneDepth": number,
    //         "gitSubmodulesConfig": {
    //           "fetchSubmodules": boolean
    //         },
    //         "insecureSsl": boolean,
    //         "location": "string",
    //         "reportBuildStatus": boolean,
    //         "sourceIdentifier": "string",
    //         "type": "string"
    //       }
    //     ],
    //     "secondarySourceVersions": [
    //       {
    //         "sourceIdentifier": "string",
    //         "sourceVersion": "string"
    //       }
    //     ],
    //     "serviceRole": "string",
    //     "source": {
    //       "auth": {
    //         "resource": "string",
    //         "type": "string"
    //       },
    //       "buildspec": "string",
    //       "buildStatusConfig": {
    //         "context": "string",
    //         "targetUrl": "string"
    //       },
    //       "gitCloneDepth": number,
    //       "gitSubmodulesConfig": {
    //         "fetchSubmodules": boolean
    //       },
    //       "insecureSsl": boolean,
    //       "location": "string",
    //       "reportBuildStatus": boolean,
    //       "sourceIdentifier": "string",
    //       "type": "string"
    //     },
    //     "sourceVersion": "string",
    //     "startTime": number,
    //     "vpcConfig": {
    //       "securityGroupIds": [
    //         "string"
    //       ],
    //       "subnets": [
    //         "string"
    //       ],
    //       "vpcId": "string"
    //     }
    //   }
    // }
    }