Chilkat Online Tools

StartBuildBatch C++ Example

AWS CodeBuild

#include <CkRest.h>
#include <CkAuthAws.h>
#include <CkJsonObject.h>
#include <CkStringBuilder.h>

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

    CkRest rest;
    bool success;

    CkAuthAws authAws;
    authAws.put_AccessKey("AWS_ACCESS_KEY");
    authAws.put_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.put_Region("us-west-2");
    authAws.put_ServiceName("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("codebuild.us-west-2.amazonaws.com",443,true,true);
    if (success != true) {
        std::cout << "ConnectFailReason: " << rest.get_ConnectFailReason() << "\r\n";
        std::cout << rest.lastErrorText() << "\r\n";
        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

    CkJsonObject json;
    json.UpdateString("artifactsOverride.artifactIdentifier","string");
    json.UpdateString("artifactsOverride.bucketOwnerAccess","string");
    json.UpdateInt("artifactsOverride.encryptionDisabled",123);
    json.UpdateString("artifactsOverride.location","string");
    json.UpdateString("artifactsOverride.name","string");
    json.UpdateString("artifactsOverride.namespaceType","string");
    json.UpdateInt("artifactsOverride.overrideArtifactName",123);
    json.UpdateString("artifactsOverride.packaging","string");
    json.UpdateString("artifactsOverride.path","string");
    json.UpdateString("artifactsOverride.type","string");
    json.UpdateString("buildBatchConfigOverride.batchReportMode","string");
    json.UpdateInt("buildBatchConfigOverride.combineArtifacts",123);
    json.UpdateString("buildBatchConfigOverride.restrictions.computeTypesAllowed[0]","string");
    json.UpdateInt("buildBatchConfigOverride.restrictions.maximumBuildsAllowed",123);
    json.UpdateString("buildBatchConfigOverride.serviceRole","string");
    json.UpdateInt("buildBatchConfigOverride.timeoutInMins",123);
    json.UpdateString("buildspecOverride","string");
    json.UpdateInt("buildTimeoutInMinutesOverride",123);
    json.UpdateString("cacheOverride.location","string");
    json.UpdateString("cacheOverride.modes[0]","string");
    json.UpdateString("cacheOverride.type","string");
    json.UpdateString("certificateOverride","string");
    json.UpdateString("computeTypeOverride","string");
    json.UpdateInt("debugSessionEnabled",123);
    json.UpdateString("encryptionKeyOverride","string");
    json.UpdateString("environmentTypeOverride","string");
    json.UpdateString("environmentVariablesOverride[0].name","string");
    json.UpdateString("environmentVariablesOverride[0].type","string");
    json.UpdateString("environmentVariablesOverride[0].value","string");
    json.UpdateInt("gitCloneDepthOverride",123);
    json.UpdateInt("gitSubmodulesConfigOverride.fetchSubmodules",123);
    json.UpdateString("idempotencyToken","string");
    json.UpdateString("imageOverride","string");
    json.UpdateString("imagePullCredentialsTypeOverride","string");
    json.UpdateInt("insecureSslOverride",123);
    json.UpdateString("logsConfigOverride.cloudWatchLogs.groupName","string");
    json.UpdateString("logsConfigOverride.cloudWatchLogs.status","string");
    json.UpdateString("logsConfigOverride.cloudWatchLogs.streamName","string");
    json.UpdateString("logsConfigOverride.s3Logs.bucketOwnerAccess","string");
    json.UpdateInt("logsConfigOverride.s3Logs.encryptionDisabled",123);
    json.UpdateString("logsConfigOverride.s3Logs.location","string");
    json.UpdateString("logsConfigOverride.s3Logs.status","string");
    json.UpdateInt("privilegedModeOverride",123);
    json.UpdateString("projectName","string");
    json.UpdateInt("queuedTimeoutInMinutesOverride",123);
    json.UpdateString("registryCredentialOverride.credential","string");
    json.UpdateString("registryCredentialOverride.credentialProvider","string");
    json.UpdateInt("reportBuildBatchStatusOverride",123);
    json.UpdateString("secondaryArtifactsOverride[0].artifactIdentifier","string");
    json.UpdateString("secondaryArtifactsOverride[0].bucketOwnerAccess","string");
    json.UpdateInt("secondaryArtifactsOverride[0].encryptionDisabled",123);
    json.UpdateString("secondaryArtifactsOverride[0].location","string");
    json.UpdateString("secondaryArtifactsOverride[0].name","string");
    json.UpdateString("secondaryArtifactsOverride[0].namespaceType","string");
    json.UpdateInt("secondaryArtifactsOverride[0].overrideArtifactName",123);
    json.UpdateString("secondaryArtifactsOverride[0].packaging","string");
    json.UpdateString("secondaryArtifactsOverride[0].path","string");
    json.UpdateString("secondaryArtifactsOverride[0].type","string");
    json.UpdateString("secondarySourcesOverride[0].auth.resource","string");
    json.UpdateString("secondarySourcesOverride[0].auth.type","string");
    json.UpdateString("secondarySourcesOverride[0].buildspec","string");
    json.UpdateString("secondarySourcesOverride[0].buildStatusConfig.context","string");
    json.UpdateString("secondarySourcesOverride[0].buildStatusConfig.targetUrl","string");
    json.UpdateInt("secondarySourcesOverride[0].gitCloneDepth",123);
    json.UpdateInt("secondarySourcesOverride[0].gitSubmodulesConfig.fetchSubmodules",123);
    json.UpdateInt("secondarySourcesOverride[0].insecureSsl",123);
    json.UpdateString("secondarySourcesOverride[0].location","string");
    json.UpdateInt("secondarySourcesOverride[0].reportBuildStatus",123);
    json.UpdateString("secondarySourcesOverride[0].sourceIdentifier","string");
    json.UpdateString("secondarySourcesOverride[0].type","string");
    json.UpdateString("secondarySourcesVersionOverride[0].sourceIdentifier","string");
    json.UpdateString("secondarySourcesVersionOverride[0].sourceVersion","string");
    json.UpdateString("serviceRoleOverride","string");
    json.UpdateString("sourceAuthOverride.resource","string");
    json.UpdateString("sourceAuthOverride.type","string");
    json.UpdateString("sourceLocationOverride","string");
    json.UpdateString("sourceTypeOverride","string");
    json.UpdateString("sourceVersion","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("Content-Type","application/x-amz-json-1.1");
    rest.AddHeader("X-Amz-Target","CodeBuild_20161006.StartBuildBatch");

    CkStringBuilder sbRequestBody;
    json.EmitSb(sbRequestBody);
    CkStringBuilder sbResponseBody;
    success = rest.FullRequestSb("POST","/",sbRequestBody,sbResponseBody);
    if (success != true) {
        std::cout << rest.lastErrorText() << "\r\n";
        return;
    }

    int respStatusCode = rest.get_ResponseStatusCode();
    std::cout << "response status code = " << respStatusCode << "\r\n";
    if (respStatusCode != 200) {
        std::cout << "Response Header:" << "\r\n";
        std::cout << rest.responseHeader() << "\r\n";
        std::cout << "Response Body:" << "\r\n";
        std::cout << sbResponseBody.getAsString() << "\r\n";
        return;
    }

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

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

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

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

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

            j = j + 1;
        }

        i = i + 1;
    }

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

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

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

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

        i = i + 1;
    }

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

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

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

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

    i = 0;
    count_i = jResp.SizeOfArray("buildBatch.vpcConfig.subnets");
    while (i < count_i) {
        jResp.put_I(i);
        strVal = jResp.stringOf("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"
    //     }
    //   }
    // }
    }