BatchGetProjects 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("names[0]","string")
; The JSON request body created by the above code:
; {
; "names": [
; "string"
; ]
; }
$oRest.AddHeader("Content-Type","application/x-amz-json-1.1")
$oRest.AddHeader("X-Amz-Target","CodeBuild_20161006.BatchGetProjects")
$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 $sName
Local $sNamespaceType
Local $iOverrideArtifactName
Local $sPackaging
Local $sPath
Local $sV_Type
Local $iBadgeEnabled
Local $sBadgeRequestUrl
Local $sBatchReportMode
Local $iCombineArtifacts
Local $iMaximumBuildsAllowed
Local $sServiceRole
Local $iTimeoutInMins
Local $sCacheLocation
Local $sCacheType
Local $iConcurrentBuildLimit
Local $iCreated
Local $sDescription
Local $sEncryptionKey
Local $sCertificate
Local $sComputeType
Local $sImage
Local $sImagePullCredentialsType
Local $iPrivilegedMode
Local $sCredential
Local $sCredentialProvider
Local $sEnvironmentType
Local $iLastModified
Local $sGroupName
Local $sStatus
Local $sStreamName
Local $sS3LogsBucketOwnerAccess
Local $iS3LogsEncryptionDisabled
Local $sS3LogsLocation
Local $sS3LogsStatus
Local $sName
Local $sProjectVisibility
Local $sPublicProjectAlias
Local $iQueuedTimeoutInMinutes
Local $sResourceAccessRole
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 $iTimeoutInMinutes
Local $sVpcId
Local $sBranchFilter
Local $sBuildType
Local $iLastModifiedSecret
Local $sPayloadUrl
Local $sSecret
Local $sV_Url
Local $iJ
Local $iCount_j
Local $strVal
Local $sV_type
Local $sValue
Local $sIdentifier
Local $sLocation
Local $sMountOptions
Local $sMountPoint
Local $sArtifactIdentifier
Local $sBucketOwnerAccess
Local $iEncryptionDisabled
Local $sNamespaceType
Local $iOverrideArtifactName
Local $sPackaging
Local $sPath
Local $sAuthResource
Local $sAuthType
Local $sBuildspec
Local $sBuildStatusConfigContext
Local $sBuildStatusConfigTargetUrl
Local $iGitCloneDepth
Local $iGitSubmodulesConfigFetchSubmodules
Local $insecureSsl
Local $iReportBuildStatus
Local $sourceIdentifier
Local $sKey
Local $iK
Local $iCount_k
Local $iExcludeMatchedPattern
Local $sPattern
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("projects")
While $i < $iCount_i
$oJResp.I = $i
$sArn = $oJResp.StringOf("projects[i].arn")
$sArtifactIdentifier = $oJResp.StringOf("projects[i].artifacts.artifactIdentifier")
$sBucketOwnerAccess = $oJResp.StringOf("projects[i].artifacts.bucketOwnerAccess")
$iEncryptionDisabled = $oJResp.IntOf("projects[i].artifacts.encryptionDisabled")
$sLocation = $oJResp.StringOf("projects[i].artifacts.location")
$sName = $oJResp.StringOf("projects[i].artifacts.name")
$sNamespaceType = $oJResp.StringOf("projects[i].artifacts.namespaceType")
$iOverrideArtifactName = $oJResp.IntOf("projects[i].artifacts.overrideArtifactName")
$sPackaging = $oJResp.StringOf("projects[i].artifacts.packaging")
$sPath = $oJResp.StringOf("projects[i].artifacts.path")
$sV_Type = $oJResp.StringOf("projects[i].artifacts.type")
$iBadgeEnabled = $oJResp.IntOf("projects[i].badge.badgeEnabled")
$sBadgeRequestUrl = $oJResp.StringOf("projects[i].badge.badgeRequestUrl")
$sBatchReportMode = $oJResp.StringOf("projects[i].buildBatchConfig.batchReportMode")
$iCombineArtifacts = $oJResp.IntOf("projects[i].buildBatchConfig.combineArtifacts")
$iMaximumBuildsAllowed = $oJResp.IntOf("projects[i].buildBatchConfig.restrictions.maximumBuildsAllowed")
$sServiceRole = $oJResp.StringOf("projects[i].buildBatchConfig.serviceRole")
$iTimeoutInMins = $oJResp.IntOf("projects[i].buildBatchConfig.timeoutInMins")
$sCacheLocation = $oJResp.StringOf("projects[i].cache.location")
$sCacheType = $oJResp.StringOf("projects[i].cache.type")
$iConcurrentBuildLimit = $oJResp.IntOf("projects[i].concurrentBuildLimit")
$iCreated = $oJResp.IntOf("projects[i].created")
$sDescription = $oJResp.StringOf("projects[i].description")
$sEncryptionKey = $oJResp.StringOf("projects[i].encryptionKey")
$sCertificate = $oJResp.StringOf("projects[i].environment.certificate")
$sComputeType = $oJResp.StringOf("projects[i].environment.computeType")
$sImage = $oJResp.StringOf("projects[i].environment.image")
$sImagePullCredentialsType = $oJResp.StringOf("projects[i].environment.imagePullCredentialsType")
$iPrivilegedMode = $oJResp.IntOf("projects[i].environment.privilegedMode")
$sCredential = $oJResp.StringOf("projects[i].environment.registryCredential.credential")
$sCredentialProvider = $oJResp.StringOf("projects[i].environment.registryCredential.credentialProvider")
$sEnvironmentType = $oJResp.StringOf("projects[i].environment.type")
$iLastModified = $oJResp.IntOf("projects[i].lastModified")
$sGroupName = $oJResp.StringOf("projects[i].logsConfig.cloudWatchLogs.groupName")
$sStatus = $oJResp.StringOf("projects[i].logsConfig.cloudWatchLogs.status")
$sStreamName = $oJResp.StringOf("projects[i].logsConfig.cloudWatchLogs.streamName")
$sS3LogsBucketOwnerAccess = $oJResp.StringOf("projects[i].logsConfig.s3Logs.bucketOwnerAccess")
$iS3LogsEncryptionDisabled = $oJResp.IntOf("projects[i].logsConfig.s3Logs.encryptionDisabled")
$sS3LogsLocation = $oJResp.StringOf("projects[i].logsConfig.s3Logs.location")
$sS3LogsStatus = $oJResp.StringOf("projects[i].logsConfig.s3Logs.status")
$sName = $oJResp.StringOf("projects[i].name")
$sProjectVisibility = $oJResp.StringOf("projects[i].projectVisibility")
$sPublicProjectAlias = $oJResp.StringOf("projects[i].publicProjectAlias")
$iQueuedTimeoutInMinutes = $oJResp.IntOf("projects[i].queuedTimeoutInMinutes")
$sResourceAccessRole = $oJResp.StringOf("projects[i].resourceAccessRole")
$serviceRole = $oJResp.StringOf("projects[i].serviceRole")
$sResource = $oJResp.StringOf("projects[i].source.auth.resource")
$sAuthType = $oJResp.StringOf("projects[i].source.auth.type")
$sBuildspec = $oJResp.StringOf("projects[i].source.buildspec")
$sContext = $oJResp.StringOf("projects[i].source.buildStatusConfig.context")
$sTargetUrl = $oJResp.StringOf("projects[i].source.buildStatusConfig.targetUrl")
$iGitCloneDepth = $oJResp.IntOf("projects[i].source.gitCloneDepth")
$iFetchSubmodules = $oJResp.IntOf("projects[i].source.gitSubmodulesConfig.fetchSubmodules")
$iInsecureSsl = $oJResp.IntOf("projects[i].source.insecureSsl")
$sourceLocation = $oJResp.StringOf("projects[i].source.location")
$iReportBuildStatus = $oJResp.IntOf("projects[i].source.reportBuildStatus")
$sSourceIdentifier = $oJResp.StringOf("projects[i].source.sourceIdentifier")
$sourceType = $oJResp.StringOf("projects[i].source.type")
$sourceVersion = $oJResp.StringOf("projects[i].sourceVersion")
$iTimeoutInMinutes = $oJResp.IntOf("projects[i].timeoutInMinutes")
$sVpcId = $oJResp.StringOf("projects[i].vpcConfig.vpcId")
$sBranchFilter = $oJResp.StringOf("projects[i].webhook.branchFilter")
$sBuildType = $oJResp.StringOf("projects[i].webhook.buildType")
$iLastModifiedSecret = $oJResp.IntOf("projects[i].webhook.lastModifiedSecret")
$sPayloadUrl = $oJResp.StringOf("projects[i].webhook.payloadUrl")
$sSecret = $oJResp.StringOf("projects[i].webhook.secret")
$sV_Url = $oJResp.StringOf("projects[i].webhook.url")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].buildBatchConfig.restrictions.computeTypesAllowed")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("projects[i].buildBatchConfig.restrictions.computeTypesAllowed[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].cache.modes")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("projects[i].cache.modes[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].environment.environmentVariables")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sName = $oJResp.StringOf("projects[i].environment.environmentVariables[j].name")
$sV_type = $oJResp.StringOf("projects[i].environment.environmentVariables[j].type")
$sValue = $oJResp.StringOf("projects[i].environment.environmentVariables[j].value")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].fileSystemLocations")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sIdentifier = $oJResp.StringOf("projects[i].fileSystemLocations[j].identifier")
$sLocation = $oJResp.StringOf("projects[i].fileSystemLocations[j].location")
$sMountOptions = $oJResp.StringOf("projects[i].fileSystemLocations[j].mountOptions")
$sMountPoint = $oJResp.StringOf("projects[i].fileSystemLocations[j].mountPoint")
$sV_type = $oJResp.StringOf("projects[i].fileSystemLocations[j].type")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].secondaryArtifacts")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sArtifactIdentifier = $oJResp.StringOf("projects[i].secondaryArtifacts[j].artifactIdentifier")
$sBucketOwnerAccess = $oJResp.StringOf("projects[i].secondaryArtifacts[j].bucketOwnerAccess")
$iEncryptionDisabled = $oJResp.IntOf("projects[i].secondaryArtifacts[j].encryptionDisabled")
$sLocation = $oJResp.StringOf("projects[i].secondaryArtifacts[j].location")
$sName = $oJResp.StringOf("projects[i].secondaryArtifacts[j].name")
$sNamespaceType = $oJResp.StringOf("projects[i].secondaryArtifacts[j].namespaceType")
$iOverrideArtifactName = $oJResp.IntOf("projects[i].secondaryArtifacts[j].overrideArtifactName")
$sPackaging = $oJResp.StringOf("projects[i].secondaryArtifacts[j].packaging")
$sPath = $oJResp.StringOf("projects[i].secondaryArtifacts[j].path")
$sV_type = $oJResp.StringOf("projects[i].secondaryArtifacts[j].type")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].secondarySources")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sAuthResource = $oJResp.StringOf("projects[i].secondarySources[j].auth.resource")
$sAuthType = $oJResp.StringOf("projects[i].secondarySources[j].auth.type")
$sBuildspec = $oJResp.StringOf("projects[i].secondarySources[j].buildspec")
$sBuildStatusConfigContext = $oJResp.StringOf("projects[i].secondarySources[j].buildStatusConfig.context")
$sBuildStatusConfigTargetUrl = $oJResp.StringOf("projects[i].secondarySources[j].buildStatusConfig.targetUrl")
$iGitCloneDepth = $oJResp.IntOf("projects[i].secondarySources[j].gitCloneDepth")
$iGitSubmodulesConfigFetchSubmodules = $oJResp.IntOf("projects[i].secondarySources[j].gitSubmodulesConfig.fetchSubmodules")
$insecureSsl = $oJResp.IntOf("projects[i].secondarySources[j].insecureSsl")
$sLocation = $oJResp.StringOf("projects[i].secondarySources[j].location")
$iReportBuildStatus = $oJResp.IntOf("projects[i].secondarySources[j].reportBuildStatus")
$sourceIdentifier = $oJResp.StringOf("projects[i].secondarySources[j].sourceIdentifier")
$sV_type = $oJResp.StringOf("projects[i].secondarySources[j].type")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].secondarySourceVersions")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sourceIdentifier = $oJResp.StringOf("projects[i].secondarySourceVersions[j].sourceIdentifier")
$sourceVersion = $oJResp.StringOf("projects[i].secondarySourceVersions[j].sourceVersion")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].tags")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sKey = $oJResp.StringOf("projects[i].tags[j].key")
$sValue = $oJResp.StringOf("projects[i].tags[j].value")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].vpcConfig.securityGroupIds")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("projects[i].vpcConfig.securityGroupIds[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].vpcConfig.subnets")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("projects[i].vpcConfig.subnets[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("projects[i].webhook.filterGroups")
While $iJ < $iCount_j
$oJResp.J = $iJ
$iK = 0
$iCount_k = $oJResp.SizeOfArray("projects[i].webhook.filterGroups[j]")
While $iK < $iCount_k
$oJResp.K = $iK
$iExcludeMatchedPattern = $oJResp.IntOf("projects[i].webhook.filterGroups[j][k].excludeMatchedPattern")
$sPattern = $oJResp.StringOf("projects[i].webhook.filterGroups[j][k].pattern")
$sV_type = $oJResp.StringOf("projects[i].webhook.filterGroups[j][k].type")
$iK = $iK + 1
Wend
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("projectsNotFound")
While $i < $iCount_i
$oJResp.I = $i
$strVal = $oJResp.StringOf("projectsNotFound[i]")
$i = $i + 1
Wend
; A sample JSON response body parsed by the above code:
; {
; "projects": [
; {
; "arn": "string",
; "artifacts": {
; "artifactIdentifier": "string",
; "bucketOwnerAccess": "string",
; "encryptionDisabled": boolean,
; "location": "string",
; "name": "string",
; "namespaceType": "string",
; "overrideArtifactName": boolean,
; "packaging": "string",
; "path": "string",
; "type": "string"
; },
; "badge": {
; "badgeEnabled": boolean,
; "badgeRequestUrl": "string"
; },
; "buildBatchConfig": {
; "batchReportMode": "string",
; "combineArtifacts": boolean,
; "restrictions": {
; "computeTypesAllowed": [
; "string"
; ],
; "maximumBuildsAllowed": number
; },
; "serviceRole": "string",
; "timeoutInMins": number
; },
; "cache": {
; "location": "string",
; "modes": [
; "string"
; ],
; "type": "string"
; },
; "concurrentBuildLimit": number,
; "created": number,
; "description": "string",
; "encryptionKey": "string",
; "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"
; }
; ],
; "lastModified": number,
; "logsConfig": {
; "cloudWatchLogs": {
; "groupName": "string",
; "status": "string",
; "streamName": "string"
; },
; "s3Logs": {
; "bucketOwnerAccess": "string",
; "encryptionDisabled": boolean,
; "location": "string",
; "status": "string"
; }
; },
; "name": "string",
; "projectVisibility": "string",
; "publicProjectAlias": "string",
; "queuedTimeoutInMinutes": number,
; "resourceAccessRole": "string",
; "secondaryArtifacts": [
; {
; "artifactIdentifier": "string",
; "bucketOwnerAccess": "string",
; "encryptionDisabled": boolean,
; "location": "string",
; "name": "string",
; "namespaceType": "string",
; "overrideArtifactName": boolean,
; "packaging": "string",
; "path": "string",
; "type": "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",
; "tags": [
; {
; "key": "string",
; "value": "string"
; }
; ],
; "timeoutInMinutes": number,
; "vpcConfig": {
; "securityGroupIds": [
; "string"
; ],
; "subnets": [
; "string"
; ],
; "vpcId": "string"
; },
; "webhook": {
; "branchFilter": "string",
; "buildType": "string",
; "filterGroups": [
; [
; {
; "excludeMatchedPattern": boolean,
; "pattern": "string",
; "type": "string"
; }
; ]
; ],
; "lastModifiedSecret": number,
; "payloadUrl": "string",
; "secret": "string",
; "url": "string"
; }
; }
; ],
; "projectsNotFound": [
; "string"
; ]
; }