BatchGetBuilds autoit Example
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oRest = ObjCreate("Chilkat_9_5_0.Rest")
Local $bSuccess
$oAuthAws = ObjCreate("Chilkat_9_5_0.AuthAws")
$oAuthAws.AccessKey = "AWS_ACCESS_KEY"
$oAuthAws.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.)
$oAuthAws.Region = "us-west-2"
$oAuthAws.ServiceName = "codebuild"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)
; URL: https://codebuild.us-west-2.amazonaws.com/
; Use the same region as specified above.
$bSuccess = $oRest.Connect("codebuild.us-west-2.amazonaws.com",443,True,True)
If ($bSuccess <> True) Then
ConsoleWrite("ConnectFailReason: " & $oRest.ConnectFailReason & @CRLF)
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
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
$oJson = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJson.UpdateString("ids[0]","string")
; The JSON request body created by the above code:
; {
; "ids": [
; "string"
; ]
; }
$oRest.AddHeader("Content-Type","application/x-amz-json-1.1")
$oRest.AddHeader("X-Amz-Target","CodeBuild_20161006.BatchGetBuilds")
$oSbRequestBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$oJson.EmitSb($oSbRequestBody)
$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestSb("POST","/",$oSbRequestBody,$oSbResponseBody)
If ($bSuccess <> True) Then
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
Local $iRespStatusCode = $oRest.ResponseStatusCode
ConsoleWrite("response status code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode <> 200) Then
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oRest.ResponseHeader & @CRLF)
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oSbResponseBody.GetAsString() & @CRLF)
Exit
EndIf
$oJResp = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
; 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
Local $sArn
Local $sArtifactIdentifier
Local $sBucketOwnerAccess
Local $iEncryptionDisabled
Local $sLocation
Local $sMd5sum
Local $iOverrideArtifactName
Local $sSha256sum
Local $sBuildBatchArn
Local $iBuildComplete
Local $iBuildNumber
Local $sBuildStatus
Local $sCacheLocation
Local $sV_Type
Local $sCurrentPhase
Local $iSessionEnabled
Local $sSessionTarget
Local $sEncryptionKey
Local $iEndTime
Local $sCertificate
Local $sComputeType
Local $sImage
Local $sImagePullCredentialsType
Local $iPrivilegedMode
Local $sCredential
Local $sCredentialProvider
Local $sEnvironmentType
Local $sId
Local $sInitiator
Local $sGroupName
Local $sStatus
Local $sStreamName
Local $sCloudWatchLogsArn
Local $sDeepLink
Local $sLogsGroupName
Local $sS3DeepLink
Local $sS3LogsBucketOwnerAccess
Local $iS3LogsEncryptionDisabled
Local $sS3LogsLocation
Local $sS3LogsStatus
Local $sS3LogsArn
Local $sLogsStreamName
Local $sNetworkInterfaceId
Local $sSubnetId
Local $sProjectName
Local $iQueuedTimeoutInMinutes
Local $sResolvedSourceVersion
Local $serviceRole
Local $sResource
Local $sAuthType
Local $sBuildspec
Local $sContext
Local $sTargetUrl
Local $iGitCloneDepth
Local $iFetchSubmodules
Local $iInsecureSsl
Local $sourceLocation
Local $iReportBuildStatus
Local $sSourceIdentifier
Local $sourceType
Local $sourceVersion
Local $iStartTime
Local $iTimeoutInMinutes
Local $sVpcId
Local $iJ
Local $iCount_j
Local $strVal
Local $sName
Local $sV_type
Local $sValue
Local $sIdentifier
Local $sLocation
Local $sMountOptions
Local $sMountPoint
Local $iDurationInSeconds
Local $sPhaseStatus
Local $sPhaseType
Local $iK
Local $iCount_k
Local $sMessage
Local $statusCode
Local $sArtifactIdentifier
Local $sBucketOwnerAccess
Local $iEncryptionDisabled
Local $sMd5sum
Local $iOverrideArtifactName
Local $sha256sum
Local $sAuthResource
Local $sAuthType
Local $sBuildspec
Local $sBuildStatusConfigContext
Local $sBuildStatusConfigTargetUrl
Local $iGitCloneDepth
Local $iGitSubmodulesConfigFetchSubmodules
Local $insecureSsl
Local $iReportBuildStatus
Local $sourceIdentifier
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("builds")
While $i < $iCount_i
$oJResp.I = $i
$sArn = $oJResp.StringOf("builds[i].arn")
$sArtifactIdentifier = $oJResp.StringOf("builds[i].artifacts.artifactIdentifier")
$sBucketOwnerAccess = $oJResp.StringOf("builds[i].artifacts.bucketOwnerAccess")
$iEncryptionDisabled = $oJResp.IntOf("builds[i].artifacts.encryptionDisabled")
$sLocation = $oJResp.StringOf("builds[i].artifacts.location")
$sMd5sum = $oJResp.StringOf("builds[i].artifacts.md5sum")
$iOverrideArtifactName = $oJResp.IntOf("builds[i].artifacts.overrideArtifactName")
$sSha256sum = $oJResp.StringOf("builds[i].artifacts.sha256sum")
$sBuildBatchArn = $oJResp.StringOf("builds[i].buildBatchArn")
$iBuildComplete = $oJResp.IntOf("builds[i].buildComplete")
$iBuildNumber = $oJResp.IntOf("builds[i].buildNumber")
$sBuildStatus = $oJResp.StringOf("builds[i].buildStatus")
$sCacheLocation = $oJResp.StringOf("builds[i].cache.location")
$sV_Type = $oJResp.StringOf("builds[i].cache.type")
$sCurrentPhase = $oJResp.StringOf("builds[i].currentPhase")
$iSessionEnabled = $oJResp.IntOf("builds[i].debugSession.sessionEnabled")
$sSessionTarget = $oJResp.StringOf("builds[i].debugSession.sessionTarget")
$sEncryptionKey = $oJResp.StringOf("builds[i].encryptionKey")
$iEndTime = $oJResp.IntOf("builds[i].endTime")
$sCertificate = $oJResp.StringOf("builds[i].environment.certificate")
$sComputeType = $oJResp.StringOf("builds[i].environment.computeType")
$sImage = $oJResp.StringOf("builds[i].environment.image")
$sImagePullCredentialsType = $oJResp.StringOf("builds[i].environment.imagePullCredentialsType")
$iPrivilegedMode = $oJResp.IntOf("builds[i].environment.privilegedMode")
$sCredential = $oJResp.StringOf("builds[i].environment.registryCredential.credential")
$sCredentialProvider = $oJResp.StringOf("builds[i].environment.registryCredential.credentialProvider")
$sEnvironmentType = $oJResp.StringOf("builds[i].environment.type")
$sId = $oJResp.StringOf("builds[i].id")
$sInitiator = $oJResp.StringOf("builds[i].initiator")
$sGroupName = $oJResp.StringOf("builds[i].logs.cloudWatchLogs.groupName")
$sStatus = $oJResp.StringOf("builds[i].logs.cloudWatchLogs.status")
$sStreamName = $oJResp.StringOf("builds[i].logs.cloudWatchLogs.streamName")
$sCloudWatchLogsArn = $oJResp.StringOf("builds[i].logs.cloudWatchLogsArn")
$sDeepLink = $oJResp.StringOf("builds[i].logs.deepLink")
$sLogsGroupName = $oJResp.StringOf("builds[i].logs.groupName")
$sS3DeepLink = $oJResp.StringOf("builds[i].logs.s3DeepLink")
$sS3LogsBucketOwnerAccess = $oJResp.StringOf("builds[i].logs.s3Logs.bucketOwnerAccess")
$iS3LogsEncryptionDisabled = $oJResp.IntOf("builds[i].logs.s3Logs.encryptionDisabled")
$sS3LogsLocation = $oJResp.StringOf("builds[i].logs.s3Logs.location")
$sS3LogsStatus = $oJResp.StringOf("builds[i].logs.s3Logs.status")
$sS3LogsArn = $oJResp.StringOf("builds[i].logs.s3LogsArn")
$sLogsStreamName = $oJResp.StringOf("builds[i].logs.streamName")
$sNetworkInterfaceId = $oJResp.StringOf("builds[i].networkInterface.networkInterfaceId")
$sSubnetId = $oJResp.StringOf("builds[i].networkInterface.subnetId")
$sProjectName = $oJResp.StringOf("builds[i].projectName")
$iQueuedTimeoutInMinutes = $oJResp.IntOf("builds[i].queuedTimeoutInMinutes")
$sResolvedSourceVersion = $oJResp.StringOf("builds[i].resolvedSourceVersion")
$serviceRole = $oJResp.StringOf("builds[i].serviceRole")
$sResource = $oJResp.StringOf("builds[i].source.auth.resource")
$sAuthType = $oJResp.StringOf("builds[i].source.auth.type")
$sBuildspec = $oJResp.StringOf("builds[i].source.buildspec")
$sContext = $oJResp.StringOf("builds[i].source.buildStatusConfig.context")
$sTargetUrl = $oJResp.StringOf("builds[i].source.buildStatusConfig.targetUrl")
$iGitCloneDepth = $oJResp.IntOf("builds[i].source.gitCloneDepth")
$iFetchSubmodules = $oJResp.IntOf("builds[i].source.gitSubmodulesConfig.fetchSubmodules")
$iInsecureSsl = $oJResp.IntOf("builds[i].source.insecureSsl")
$sourceLocation = $oJResp.StringOf("builds[i].source.location")
$iReportBuildStatus = $oJResp.IntOf("builds[i].source.reportBuildStatus")
$sSourceIdentifier = $oJResp.StringOf("builds[i].source.sourceIdentifier")
$sourceType = $oJResp.StringOf("builds[i].source.type")
$sourceVersion = $oJResp.StringOf("builds[i].sourceVersion")
$iStartTime = $oJResp.IntOf("builds[i].startTime")
$iTimeoutInMinutes = $oJResp.IntOf("builds[i].timeoutInMinutes")
$sVpcId = $oJResp.StringOf("builds[i].vpcConfig.vpcId")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].cache.modes")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("builds[i].cache.modes[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].environment.environmentVariables")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sName = $oJResp.StringOf("builds[i].environment.environmentVariables[j].name")
$sV_type = $oJResp.StringOf("builds[i].environment.environmentVariables[j].type")
$sValue = $oJResp.StringOf("builds[i].environment.environmentVariables[j].value")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].exportedEnvironmentVariables")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sName = $oJResp.StringOf("builds[i].exportedEnvironmentVariables[j].name")
$sValue = $oJResp.StringOf("builds[i].exportedEnvironmentVariables[j].value")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].fileSystemLocations")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sIdentifier = $oJResp.StringOf("builds[i].fileSystemLocations[j].identifier")
$sLocation = $oJResp.StringOf("builds[i].fileSystemLocations[j].location")
$sMountOptions = $oJResp.StringOf("builds[i].fileSystemLocations[j].mountOptions")
$sMountPoint = $oJResp.StringOf("builds[i].fileSystemLocations[j].mountPoint")
$sV_type = $oJResp.StringOf("builds[i].fileSystemLocations[j].type")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].phases")
While $iJ < $iCount_j
$oJResp.J = $iJ
$iDurationInSeconds = $oJResp.IntOf("builds[i].phases[j].durationInSeconds")
$iEndTime = $oJResp.IntOf("builds[i].phases[j].endTime")
$sPhaseStatus = $oJResp.StringOf("builds[i].phases[j].phaseStatus")
$sPhaseType = $oJResp.StringOf("builds[i].phases[j].phaseType")
$iStartTime = $oJResp.IntOf("builds[i].phases[j].startTime")
$iK = 0
$iCount_k = $oJResp.SizeOfArray("builds[i].phases[j].contexts")
While $iK < $iCount_k
$oJResp.K = $iK
$sMessage = $oJResp.StringOf("builds[i].phases[j].contexts[k].message")
$statusCode = $oJResp.StringOf("builds[i].phases[j].contexts[k].statusCode")
$iK = $iK + 1
Wend
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].reportArns")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("builds[i].reportArns[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].secondaryArtifacts")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sArtifactIdentifier = $oJResp.StringOf("builds[i].secondaryArtifacts[j].artifactIdentifier")
$sBucketOwnerAccess = $oJResp.StringOf("builds[i].secondaryArtifacts[j].bucketOwnerAccess")
$iEncryptionDisabled = $oJResp.IntOf("builds[i].secondaryArtifacts[j].encryptionDisabled")
$sLocation = $oJResp.StringOf("builds[i].secondaryArtifacts[j].location")
$sMd5sum = $oJResp.StringOf("builds[i].secondaryArtifacts[j].md5sum")
$iOverrideArtifactName = $oJResp.IntOf("builds[i].secondaryArtifacts[j].overrideArtifactName")
$sha256sum = $oJResp.StringOf("builds[i].secondaryArtifacts[j].sha256sum")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].secondarySources")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sAuthResource = $oJResp.StringOf("builds[i].secondarySources[j].auth.resource")
$sAuthType = $oJResp.StringOf("builds[i].secondarySources[j].auth.type")
$sBuildspec = $oJResp.StringOf("builds[i].secondarySources[j].buildspec")
$sBuildStatusConfigContext = $oJResp.StringOf("builds[i].secondarySources[j].buildStatusConfig.context")
$sBuildStatusConfigTargetUrl = $oJResp.StringOf("builds[i].secondarySources[j].buildStatusConfig.targetUrl")
$iGitCloneDepth = $oJResp.IntOf("builds[i].secondarySources[j].gitCloneDepth")
$iGitSubmodulesConfigFetchSubmodules = $oJResp.IntOf("builds[i].secondarySources[j].gitSubmodulesConfig.fetchSubmodules")
$insecureSsl = $oJResp.IntOf("builds[i].secondarySources[j].insecureSsl")
$sLocation = $oJResp.StringOf("builds[i].secondarySources[j].location")
$iReportBuildStatus = $oJResp.IntOf("builds[i].secondarySources[j].reportBuildStatus")
$sourceIdentifier = $oJResp.StringOf("builds[i].secondarySources[j].sourceIdentifier")
$sV_type = $oJResp.StringOf("builds[i].secondarySources[j].type")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].secondarySourceVersions")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sourceIdentifier = $oJResp.StringOf("builds[i].secondarySourceVersions[j].sourceIdentifier")
$sourceVersion = $oJResp.StringOf("builds[i].secondarySourceVersions[j].sourceVersion")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].vpcConfig.securityGroupIds")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("builds[i].vpcConfig.securityGroupIds[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("builds[i].vpcConfig.subnets")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("builds[i].vpcConfig.subnets[j]")
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("buildsNotFound")
While $i < $iCount_i
$oJResp.I = $i
$strVal = $oJResp.StringOf("buildsNotFound[i]")
$i = $i + 1
Wend
; A sample JSON response body parsed by the above code:
; {
; "builds": [
; {
; "arn": "string",
; "artifacts": {
; "artifactIdentifier": "string",
; "bucketOwnerAccess": "string",
; "encryptionDisabled": boolean,
; "location": "string",
; "md5sum": "string",
; "overrideArtifactName": boolean,
; "sha256sum": "string"
; },
; "buildBatchArn": "string",
; "buildComplete": boolean,
; "buildNumber": number,
; "buildStatus": "string",
; "cache": {
; "location": "string",
; "modes": [
; "string"
; ],
; "type": "string"
; },
; "currentPhase": "string",
; "debugSession": {
; "sessionEnabled": boolean,
; "sessionTarget": "string"
; },
; "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"
; },
; "exportedEnvironmentVariables": [
; {
; "name": "string",
; "value": "string"
; }
; ],
; "fileSystemLocations": [
; {
; "identifier": "string",
; "location": "string",
; "mountOptions": "string",
; "mountPoint": "string",
; "type": "string"
; }
; ],
; "id": "string",
; "initiator": "string",
; "logs": {
; "cloudWatchLogs": {
; "groupName": "string",
; "status": "string",
; "streamName": "string"
; },
; "cloudWatchLogsArn": "string",
; "deepLink": "string",
; "groupName": "string",
; "s3DeepLink": "string",
; "s3Logs": {
; "bucketOwnerAccess": "string",
; "encryptionDisabled": boolean,
; "location": "string",
; "status": "string"
; },
; "s3LogsArn": "string",
; "streamName": "string"
; },
; "networkInterface": {
; "networkInterfaceId": "string",
; "subnetId": "string"
; },
; "phases": [
; {
; "contexts": [
; {
; "message": "string",
; "statusCode": "string"
; }
; ],
; "durationInSeconds": number,
; "endTime": number,
; "phaseStatus": "string",
; "phaseType": "string",
; "startTime": number
; }
; ],
; "projectName": "string",
; "queuedTimeoutInMinutes": number,
; "reportArns": [
; "string"
; ],
; "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,
; "timeoutInMinutes": number,
; "vpcConfig": {
; "securityGroupIds": [
; "string"
; ],
; "subnets": [
; "string"
; ],
; "vpcId": "string"
; }
; }
; ],
; "buildsNotFound": [
; "string"
; ]
; }