Chilkat Online Tools

StartBuildBatch PureBasic Example

AWS CodeBuild

IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkRest.pb"
IncludeFile "CkAuthAws.pb"

Procedure ChilkatExample()

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

    rest.i = CkRest::ckCreate()
    If rest.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success.i

    authAws.i = CkAuthAws::ckCreate()
    If authAws.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkAuthAws::setCkAccessKey(authAws, "AWS_ACCESS_KEY")
    CkAuthAws::setCkSecretKey(authAws, "AWS_SECRET_KEY")

    ; Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
    CkAuthAws::setCkRegion(authAws, "us-west-2")
    CkAuthAws::setCkServiceName(authAws, "codebuild")
    ; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
    CkRest::ckSetAuthAws(rest,authAws)

    ; URL: https://codebuild.us-west-2.amazonaws.com/
    ; Use the same region as specified above.
    success = CkRest::ckConnect(rest,"codebuild.us-west-2.amazonaws.com",443,1,1)
    If success <> 1
        Debug "ConnectFailReason: " + Str(CkRest::ckConnectFailReason(rest))
        Debug CkRest::ckLastErrorText(rest)
        CkRest::ckDispose(rest)
        CkAuthAws::ckDispose(authAws)
        ProcedureReturn
    EndIf

    ; 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

    json.i = CkJsonObject::ckCreate()
    If json.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

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

    CkRest::ckAddHeader(rest,"Content-Type","application/x-amz-json-1.1")
    CkRest::ckAddHeader(rest,"X-Amz-Target","CodeBuild_20161006.StartBuildBatch")

    sbRequestBody.i = CkStringBuilder::ckCreate()
    If sbRequestBody.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkJsonObject::ckEmitSb(json,sbRequestBody)
    sbResponseBody.i = CkStringBuilder::ckCreate()
    If sbResponseBody.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success = CkRest::ckFullRequestSb(rest,"POST","/",sbRequestBody,sbResponseBody)
    If success <> 1
        Debug CkRest::ckLastErrorText(rest)
        CkRest::ckDispose(rest)
        CkAuthAws::ckDispose(authAws)
        CkJsonObject::ckDispose(json)
        CkStringBuilder::ckDispose(sbRequestBody)
        CkStringBuilder::ckDispose(sbResponseBody)
        ProcedureReturn
    EndIf

    respStatusCode.i = CkRest::ckResponseStatusCode(rest)
    Debug "response status code = " + Str(respStatusCode)
    If respStatusCode <> 200
        Debug "Response Header:"
        Debug CkRest::ckResponseHeader(rest)
        Debug "Response Body:"
        Debug CkStringBuilder::ckGetAsString(sbResponseBody)
        CkRest::ckDispose(rest)
        CkAuthAws::ckDispose(authAws)
        CkJsonObject::ckDispose(json)
        CkStringBuilder::ckDispose(sbRequestBody)
        CkStringBuilder::ckDispose(sbResponseBody)
        ProcedureReturn
    EndIf

    jResp.i = CkJsonObject::ckCreate()
    If jResp.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkJsonObject::ckLoadSb(jResp,sbResponseBody)

    ; The following code parses the JSON response.
    ; A sample JSON response is shown below the sample code.

    ; Use this online tool to generate parsing code from sample JSON:
    ; Generate Parsing Code from JSON

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

    Arn.s = CkJsonObject::ckStringOf(jResp,"buildBatch.arn")
    ArtifactIdentifier.s = CkJsonObject::ckStringOf(jResp,"buildBatch.artifacts.artifactIdentifier")
    BucketOwnerAccess.s = CkJsonObject::ckStringOf(jResp,"buildBatch.artifacts.bucketOwnerAccess")
    EncryptionDisabled.i = CkJsonObject::ckIntOf(jResp,"buildBatch.artifacts.encryptionDisabled")
    Location.s = CkJsonObject::ckStringOf(jResp,"buildBatch.artifacts.location")
    Md5sum.s = CkJsonObject::ckStringOf(jResp,"buildBatch.artifacts.md5sum")
    OverrideArtifactName.i = CkJsonObject::ckIntOf(jResp,"buildBatch.artifacts.overrideArtifactName")
    Sha256sum.s = CkJsonObject::ckStringOf(jResp,"buildBatch.artifacts.sha256sum")
    BatchReportMode.s = CkJsonObject::ckStringOf(jResp,"buildBatch.buildBatchConfig.batchReportMode")
    CombineArtifacts.i = CkJsonObject::ckIntOf(jResp,"buildBatch.buildBatchConfig.combineArtifacts")
    MaximumBuildsAllowed.i = CkJsonObject::ckIntOf(jResp,"buildBatch.buildBatchConfig.restrictions.maximumBuildsAllowed")
    ServiceRole.s = CkJsonObject::ckStringOf(jResp,"buildBatch.buildBatchConfig.serviceRole")
    TimeoutInMins.i = CkJsonObject::ckIntOf(jResp,"buildBatch.buildBatchConfig.timeoutInMins")
    BuildBatchNumber.i = CkJsonObject::ckIntOf(jResp,"buildBatch.buildBatchNumber")
    BuildBatchStatus.s = CkJsonObject::ckStringOf(jResp,"buildBatch.buildBatchStatus")
    BuildTimeoutInMinutes.i = CkJsonObject::ckIntOf(jResp,"buildBatch.buildTimeoutInMinutes")
    CacheLocation.s = CkJsonObject::ckStringOf(jResp,"buildBatch.cache.location")
    v_Type.s = CkJsonObject::ckStringOf(jResp,"buildBatch.cache.type")
    Complete.i = CkJsonObject::ckIntOf(jResp,"buildBatch.complete")
    CurrentPhase.s = CkJsonObject::ckStringOf(jResp,"buildBatch.currentPhase")
    DebugSessionEnabled.i = CkJsonObject::ckIntOf(jResp,"buildBatch.debugSessionEnabled")
    EncryptionKey.s = CkJsonObject::ckStringOf(jResp,"buildBatch.encryptionKey")
    EndTime.i = CkJsonObject::ckIntOf(jResp,"buildBatch.endTime")
    Certificate.s = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.certificate")
    ComputeType.s = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.computeType")
    Image.s = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.image")
    ImagePullCredentialsType.s = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.imagePullCredentialsType")
    PrivilegedMode.i = CkJsonObject::ckIntOf(jResp,"buildBatch.environment.privilegedMode")
    Credential.s = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.registryCredential.credential")
    CredentialProvider.s = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.registryCredential.credentialProvider")
    EnvironmentType.s = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.type")
    Id.s = CkJsonObject::ckStringOf(jResp,"buildBatch.id")
    Initiator.s = CkJsonObject::ckStringOf(jResp,"buildBatch.initiator")
    GroupName.s = CkJsonObject::ckStringOf(jResp,"buildBatch.logConfig.cloudWatchLogs.groupName")
    Status.s = CkJsonObject::ckStringOf(jResp,"buildBatch.logConfig.cloudWatchLogs.status")
    StreamName.s = CkJsonObject::ckStringOf(jResp,"buildBatch.logConfig.cloudWatchLogs.streamName")
    S3LogsBucketOwnerAccess.s = CkJsonObject::ckStringOf(jResp,"buildBatch.logConfig.s3Logs.bucketOwnerAccess")
    S3LogsEncryptionDisabled.i = CkJsonObject::ckIntOf(jResp,"buildBatch.logConfig.s3Logs.encryptionDisabled")
    S3LogsLocation.s = CkJsonObject::ckStringOf(jResp,"buildBatch.logConfig.s3Logs.location")
    S3LogsStatus.s = CkJsonObject::ckStringOf(jResp,"buildBatch.logConfig.s3Logs.status")
    ProjectName.s = CkJsonObject::ckStringOf(jResp,"buildBatch.projectName")
    QueuedTimeoutInMinutes.i = CkJsonObject::ckIntOf(jResp,"buildBatch.queuedTimeoutInMinutes")
    ResolvedSourceVersion.s = CkJsonObject::ckStringOf(jResp,"buildBatch.resolvedSourceVersion")
    buildBatchServiceRole.s = CkJsonObject::ckStringOf(jResp,"buildBatch.serviceRole")
    Resource.s = CkJsonObject::ckStringOf(jResp,"buildBatch.source.auth.resource")
    AuthType.s = CkJsonObject::ckStringOf(jResp,"buildBatch.source.auth.type")
    Buildspec.s = CkJsonObject::ckStringOf(jResp,"buildBatch.source.buildspec")
    Context.s = CkJsonObject::ckStringOf(jResp,"buildBatch.source.buildStatusConfig.context")
    TargetUrl.s = CkJsonObject::ckStringOf(jResp,"buildBatch.source.buildStatusConfig.targetUrl")
    GitCloneDepth.i = CkJsonObject::ckIntOf(jResp,"buildBatch.source.gitCloneDepth")
    FetchSubmodules.i = CkJsonObject::ckIntOf(jResp,"buildBatch.source.gitSubmodulesConfig.fetchSubmodules")
    InsecureSsl.i = CkJsonObject::ckIntOf(jResp,"buildBatch.source.insecureSsl")
    SourceLocation.s = CkJsonObject::ckStringOf(jResp,"buildBatch.source.location")
    ReportBuildStatus.i = CkJsonObject::ckIntOf(jResp,"buildBatch.source.reportBuildStatus")
    SourceIdentifier.s = CkJsonObject::ckStringOf(jResp,"buildBatch.source.sourceIdentifier")
    SourceType.s = CkJsonObject::ckStringOf(jResp,"buildBatch.source.type")
    SourceVersion.s = CkJsonObject::ckStringOf(jResp,"buildBatch.sourceVersion")
    StartTime.i = CkJsonObject::ckIntOf(jResp,"buildBatch.startTime")
    VpcId.s = CkJsonObject::ckStringOf(jResp,"buildBatch.vpcConfig.vpcId")
    i.i = 0
    count_i.i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.buildBatchConfig.restrictions.computeTypesAllowed")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        strVal = CkJsonObject::ckStringOf(jResp,"buildBatch.buildBatchConfig.restrictions.computeTypesAllowed[i]")
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.buildGroups")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        currentBuildSummaryArn = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].currentBuildSummary.arn")
        BuildStatus = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].currentBuildSummary.buildStatus")
        Identifier = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].currentBuildSummary.primaryArtifact.identifier")
        PrimaryArtifactLocation = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].currentBuildSummary.primaryArtifact.location")
        PrimaryArtifactType = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].currentBuildSummary.primaryArtifact.type")
        RequestedOn = CkJsonObject::ckIntOf(jResp,"buildBatch.buildGroups[i].currentBuildSummary.requestedOn")
        identifier = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].identifier")
        ignoreFailure = CkJsonObject::ckIntOf(jResp,"buildBatch.buildGroups[i].ignoreFailure")
        j = 0
        count_j = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts")
        While j < count_j
            CkJsonObject::setCkJ(jResp, j)
            identifier = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts[j].identifier")
            location = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts[j].location")
            v_type = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].currentBuildSummary.secondaryArtifacts[j].type")
            j = j + 1
        Wend
        j = 0
        count_j = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.buildGroups[i].dependsOn")
        While j < count_j
            CkJsonObject::setCkJ(jResp, j)
            strVal = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].dependsOn[j]")
            j = j + 1
        Wend
        j = 0
        count_j = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList")
        While j < count_j
            CkJsonObject::setCkJ(jResp, j)
            arn = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].arn")
            buildStatus = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].buildStatus")
            primaryArtifactIdentifier = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].primaryArtifact.identifier")
            primaryArtifactLocation = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].primaryArtifact.location")
            primaryArtifactType = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].primaryArtifact.type")
            requestedOn = CkJsonObject::ckIntOf(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].requestedOn")
            k = 0
            count_k = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts")
            While k < count_k
                CkJsonObject::setCkK(jResp, k)
                identifier = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts[k].identifier")
                location = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts[k].location")
                v_type = CkJsonObject::ckStringOf(jResp,"buildBatch.buildGroups[i].priorBuildSummaryList[j].secondaryArtifacts[k].type")
                k = k + 1
            Wend
            j = j + 1
        Wend
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.cache.modes")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        strVal = CkJsonObject::ckStringOf(jResp,"buildBatch.cache.modes[i]")
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.environment.environmentVariables")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        name = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.environmentVariables[i].name")
        v_type = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.environmentVariables[i].type")
        value = CkJsonObject::ckStringOf(jResp,"buildBatch.environment.environmentVariables[i].value")
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.fileSystemLocations")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        identifier = CkJsonObject::ckStringOf(jResp,"buildBatch.fileSystemLocations[i].identifier")
        location = CkJsonObject::ckStringOf(jResp,"buildBatch.fileSystemLocations[i].location")
        mountOptions = CkJsonObject::ckStringOf(jResp,"buildBatch.fileSystemLocations[i].mountOptions")
        mountPoint = CkJsonObject::ckStringOf(jResp,"buildBatch.fileSystemLocations[i].mountPoint")
        v_type = CkJsonObject::ckStringOf(jResp,"buildBatch.fileSystemLocations[i].type")
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.phases")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        durationInSeconds = CkJsonObject::ckIntOf(jResp,"buildBatch.phases[i].durationInSeconds")
        endTime = CkJsonObject::ckIntOf(jResp,"buildBatch.phases[i].endTime")
        phaseStatus = CkJsonObject::ckStringOf(jResp,"buildBatch.phases[i].phaseStatus")
        phaseType = CkJsonObject::ckStringOf(jResp,"buildBatch.phases[i].phaseType")
        startTime = CkJsonObject::ckIntOf(jResp,"buildBatch.phases[i].startTime")
        j = 0
        count_j = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.phases[i].contexts")
        While j < count_j
            CkJsonObject::setCkJ(jResp, j)
            message = CkJsonObject::ckStringOf(jResp,"buildBatch.phases[i].contexts[j].message")
            statusCode = CkJsonObject::ckStringOf(jResp,"buildBatch.phases[i].contexts[j].statusCode")
            j = j + 1
        Wend
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.secondaryArtifacts")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        artifactIdentifier = CkJsonObject::ckStringOf(jResp,"buildBatch.secondaryArtifacts[i].artifactIdentifier")
        bucketOwnerAccess = CkJsonObject::ckStringOf(jResp,"buildBatch.secondaryArtifacts[i].bucketOwnerAccess")
        encryptionDisabled = CkJsonObject::ckIntOf(jResp,"buildBatch.secondaryArtifacts[i].encryptionDisabled")
        location = CkJsonObject::ckStringOf(jResp,"buildBatch.secondaryArtifacts[i].location")
        md5sum = CkJsonObject::ckStringOf(jResp,"buildBatch.secondaryArtifacts[i].md5sum")
        overrideArtifactName = CkJsonObject::ckIntOf(jResp,"buildBatch.secondaryArtifacts[i].overrideArtifactName")
        sha256sum = CkJsonObject::ckStringOf(jResp,"buildBatch.secondaryArtifacts[i].sha256sum")
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.secondarySources")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        authResource = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySources[i].auth.resource")
        authType = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySources[i].auth.type")
        buildspec = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySources[i].buildspec")
        buildStatusConfigContext = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySources[i].buildStatusConfig.context")
        buildStatusConfigTargetUrl = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySources[i].buildStatusConfig.targetUrl")
        gitCloneDepth = CkJsonObject::ckIntOf(jResp,"buildBatch.secondarySources[i].gitCloneDepth")
        gitSubmodulesConfigFetchSubmodules = CkJsonObject::ckIntOf(jResp,"buildBatch.secondarySources[i].gitSubmodulesConfig.fetchSubmodules")
        insecureSsl = CkJsonObject::ckIntOf(jResp,"buildBatch.secondarySources[i].insecureSsl")
        location = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySources[i].location")
        reportBuildStatus = CkJsonObject::ckIntOf(jResp,"buildBatch.secondarySources[i].reportBuildStatus")
        sourceIdentifier = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySources[i].sourceIdentifier")
        v_type = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySources[i].type")
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.secondarySourceVersions")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        sourceIdentifier = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySourceVersions[i].sourceIdentifier")
        sourceVersion = CkJsonObject::ckStringOf(jResp,"buildBatch.secondarySourceVersions[i].sourceVersion")
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.vpcConfig.securityGroupIds")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        strVal = CkJsonObject::ckStringOf(jResp,"buildBatch.vpcConfig.securityGroupIds[i]")
        i = i + 1
    Wend
    i = 0
    count_i = CkJsonObject::ckSizeOfArray(jResp,"buildBatch.vpcConfig.subnets")
    While i < count_i
        CkJsonObject::setCkI(jResp, i)
        strVal = CkJsonObject::ckStringOf(jResp,"buildBatch.vpcConfig.subnets[i]")
        i = i + 1
    Wend

    ; 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"
    ;     }
    ;   }
    ; }


    CkRest::ckDispose(rest)
    CkAuthAws::ckDispose(authAws)
    CkJsonObject::ckDispose(json)
    CkStringBuilder::ckDispose(sbRequestBody)
    CkStringBuilder::ckDispose(sbResponseBody)
    CkJsonObject::ckDispose(jResp)


    ProcedureReturn
EndProcedure