Chilkat Online Tools

StartBuildBatch Swift3 Example

AWS CodeBuild

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

    let rest = CkoRest()!
    var success: Bool

    let authAws = CkoAuthAws()!
    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 = "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", port: 443, tls: true, autoReconnect: true)
    if success != true {
        print("ConnectFailReason: \(rest.connectFailReason.intValue)")
        print("\(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

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

    let sbRequestBody = CkoStringBuilder()!
    json.emitSb(sbRequestBody)
    let sbResponseBody = CkoStringBuilder()!
    success = rest.fullRequestSb("POST", uriPath: "/", requestBody: sbRequestBody, responseBody: sbResponseBody)
    if success != true {
        print("\(rest.lastErrorText!)")
        return
    }

    var respStatusCode: Int = rest.responseStatusCode.intValue
    print("response status code = \(respStatusCode)")
    if respStatusCode != 200 {
        print("Response Header:")
        print("\(rest.responseHeader!)")
        print("Response Body:")
        print("\(sbResponseBody.getAsString()!)")
        return
    }

    let jResp = CkoJsonObject()!
    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

    var strVal: String?
    var currentBuildSummaryArn: String?
    var BuildStatus: String?
    var Identifier: String?
    var PrimaryArtifactLocation: String?
    var PrimaryArtifactType: String?
    var RequestedOn: Int
    var identifier: String?
    var ignoreFailure: Int
    var j: Int
    var count_j: Int
    var location: String?
    var v_type: String?
    var arn: String?
    var buildStatus: String?
    var primaryArtifactIdentifier: String?
    var primaryArtifactLocation: String?
    var primaryArtifactType: String?
    var requestedOn: Int
    var k: Int
    var count_k: Int
    var name: String?
    var value: String?
    var mountOptions: String?
    var mountPoint: String?
    var durationInSeconds: Int
    var endTime: Int
    var phaseStatus: String?
    var phaseType: String?
    var startTime: Int
    var message: String?
    var statusCode: String?
    var artifactIdentifier: String?
    var bucketOwnerAccess: String?
    var encryptionDisabled: Int
    var md5sum: String?
    var overrideArtifactName: Int
    var sha256sum: String?
    var authResource: String?
    var authType: String?
    var buildspec: String?
    var buildStatusConfigContext: String?
    var buildStatusConfigTargetUrl: String?
    var gitCloneDepth: Int
    var gitSubmodulesConfigFetchSubmodules: Int
    var insecureSsl: Int
    var reportBuildStatus: Int
    var sourceIdentifier: String?
    var sourceVersion: String?

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

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.buildGroups").intValue
    while i < count_i {
        jResp.i = i
        currentBuildSummaryArn = jResp.string(of: "buildBatch.buildGroups[i].currentBuildSummary.arn")
        BuildStatus = jResp.string(of: "buildBatch.buildGroups[i].currentBuildSummary.buildStatus")
        Identifier = jResp.string(of: "buildBatch.buildGroups[i].currentBuildSummary.primaryArtifact.identifier")
        PrimaryArtifactLocation = jResp.string(of: "buildBatch.buildGroups[i].currentBuildSummary.primaryArtifact.location")
        PrimaryArtifactType = jResp.string(of: "buildBatch.buildGroups[i].currentBuildSummary.primaryArtifact.type")
        RequestedOn = jResp.int(of: "buildBatch.buildGroups[i].currentBuildSummary.requestedOn").intValue
        identifier = jResp.string(of: "buildBatch.buildGroups[i].identifier")
        ignoreFailure = jResp.int(of: "buildBatch.buildGroups[i].ignoreFailure").intValue
        j = 0
        count_j = jResp.size(ofArray: "buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts").intValue
        while j < count_j {
            jResp.j = j
            identifier = jResp.string(of: "buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts[j].identifier")
            location = jResp.string(of: "buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts[j].location")
            v_type = jResp.string(of: "buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts[j].type")
            j = j + 1
        }

        j = 0
        count_j = jResp.size(ofArray: "buildBatch.buildGroups[i].dependsOn").intValue
        while j < count_j {
            jResp.j = j
            strVal = jResp.string(of: "buildBatch.buildGroups[i].dependsOn[j]")
            j = j + 1
        }

        j = 0
        count_j = jResp.size(ofArray: "buildBatch.buildGroups[i].priorBuildSummaryList").intValue
        while j < count_j {
            jResp.j = j
            arn = jResp.string(of: "buildBatch.buildGroups[i].priorBuildSummaryList[j].arn")
            buildStatus = jResp.string(of: "buildBatch.buildGroups[i].priorBuildSummaryList[j].buildStatus")
            primaryArtifactIdentifier = jResp.string(of: "buildBatch.buildGroups[i].priorBuildSummaryList[j].primaryArtifact.identifier")
            primaryArtifactLocation = jResp.string(of: "buildBatch.buildGroups[i].priorBuildSummaryList[j].primaryArtifact.location")
            primaryArtifactType = jResp.string(of: "buildBatch.buildGroups[i].priorBuildSummaryList[j].primaryArtifact.type")
            requestedOn = jResp.int(of: "buildBatch.buildGroups[i].priorBuildSummaryList[j].requestedOn").intValue
            k = 0
            count_k = jResp.size(ofArray: "buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts").intValue
            while k < count_k {
                jResp.k = k
                identifier = jResp.string(of: "buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts[k].identifier")
                location = jResp.string(of: "buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts[k].location")
                v_type = jResp.string(of: "buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts[k].type")
                k = k + 1
            }

            j = j + 1
        }

        i = i + 1
    }

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.cache.modes").intValue
    while i < count_i {
        jResp.i = i
        strVal = jResp.string(of: "buildBatch.cache.modes[i]")
        i = i + 1
    }

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.environment.environmentVariables").intValue
    while i < count_i {
        jResp.i = i
        name = jResp.string(of: "buildBatch.environment.environmentVariables[i].name")
        v_type = jResp.string(of: "buildBatch.environment.environmentVariables[i].type")
        value = jResp.string(of: "buildBatch.environment.environmentVariables[i].value")
        i = i + 1
    }

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.fileSystemLocations").intValue
    while i < count_i {
        jResp.i = i
        identifier = jResp.string(of: "buildBatch.fileSystemLocations[i].identifier")
        location = jResp.string(of: "buildBatch.fileSystemLocations[i].location")
        mountOptions = jResp.string(of: "buildBatch.fileSystemLocations[i].mountOptions")
        mountPoint = jResp.string(of: "buildBatch.fileSystemLocations[i].mountPoint")
        v_type = jResp.string(of: "buildBatch.fileSystemLocations[i].type")
        i = i + 1
    }

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.phases").intValue
    while i < count_i {
        jResp.i = i
        durationInSeconds = jResp.int(of: "buildBatch.phases[i].durationInSeconds").intValue
        endTime = jResp.int(of: "buildBatch.phases[i].endTime").intValue
        phaseStatus = jResp.string(of: "buildBatch.phases[i].phaseStatus")
        phaseType = jResp.string(of: "buildBatch.phases[i].phaseType")
        startTime = jResp.int(of: "buildBatch.phases[i].startTime").intValue
        j = 0
        count_j = jResp.size(ofArray: "buildBatch.phases[i].contexts").intValue
        while j < count_j {
            jResp.j = j
            message = jResp.string(of: "buildBatch.phases[i].contexts[j].message")
            statusCode = jResp.string(of: "buildBatch.phases[i].contexts[j].statusCode")
            j = j + 1
        }

        i = i + 1
    }

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.secondaryArtifacts").intValue
    while i < count_i {
        jResp.i = i
        artifactIdentifier = jResp.string(of: "buildBatch.secondaryArtifacts[i].artifactIdentifier")
        bucketOwnerAccess = jResp.string(of: "buildBatch.secondaryArtifacts[i].bucketOwnerAccess")
        encryptionDisabled = jResp.int(of: "buildBatch.secondaryArtifacts[i].encryptionDisabled").intValue
        location = jResp.string(of: "buildBatch.secondaryArtifacts[i].location")
        md5sum = jResp.string(of: "buildBatch.secondaryArtifacts[i].md5sum")
        overrideArtifactName = jResp.int(of: "buildBatch.secondaryArtifacts[i].overrideArtifactName").intValue
        sha256sum = jResp.string(of: "buildBatch.secondaryArtifacts[i].sha256sum")
        i = i + 1
    }

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.secondarySources").intValue
    while i < count_i {
        jResp.i = i
        authResource = jResp.string(of: "buildBatch.secondarySources[i].auth.resource")
        authType = jResp.string(of: "buildBatch.secondarySources[i].auth.type")
        buildspec = jResp.string(of: "buildBatch.secondarySources[i].buildspec")
        buildStatusConfigContext = jResp.string(of: "buildBatch.secondarySources[i].buildStatusConfig.context")
        buildStatusConfigTargetUrl = jResp.string(of: "buildBatch.secondarySources[i].buildStatusConfig.targetUrl")
        gitCloneDepth = jResp.int(of: "buildBatch.secondarySources[i].gitCloneDepth").intValue
        gitSubmodulesConfigFetchSubmodules = jResp.int(of: "buildBatch.secondarySources[i].gitSubmodulesConfig.fetchSubmodules").intValue
        insecureSsl = jResp.int(of: "buildBatch.secondarySources[i].insecureSsl").intValue
        location = jResp.string(of: "buildBatch.secondarySources[i].location")
        reportBuildStatus = jResp.int(of: "buildBatch.secondarySources[i].reportBuildStatus").intValue
        sourceIdentifier = jResp.string(of: "buildBatch.secondarySources[i].sourceIdentifier")
        v_type = jResp.string(of: "buildBatch.secondarySources[i].type")
        i = i + 1
    }

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.secondarySourceVersions").intValue
    while i < count_i {
        jResp.i = i
        sourceIdentifier = jResp.string(of: "buildBatch.secondarySourceVersions[i].sourceIdentifier")
        sourceVersion = jResp.string(of: "buildBatch.secondarySourceVersions[i].sourceVersion")
        i = i + 1
    }

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.vpcConfig.securityGroupIds").intValue
    while i < count_i {
        jResp.i = i
        strVal = jResp.string(of: "buildBatch.vpcConfig.securityGroupIds[i]")
        i = i + 1
    }

    i = 0
    count_i = jResp.size(ofArray: "buildBatch.vpcConfig.subnets").intValue
    while i < count_i {
        jResp.i = i
        strVal = jResp.string(of: "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"
    //     }
    //   }
    // }

}