StopBuild PowerBuilder Example
integer li_rc
oleobject loo_Rest
integer li_Success
oleobject loo_AuthAws
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_SbResponseBody
integer li_RespStatusCode
oleobject loo_JResp
string ls_StrVal
string ls_Name
string ls_V_type
string ls_Value
string ls_Identifier
string ls_Location
string ls_MountOptions
string ls_MountPoint
integer li_DurationInSeconds
integer li_EndTime
string ls_PhaseStatus
string ls_PhaseType
integer li_StartTime
integer j
integer li_Count_j
string ls_Message
string ls_StatusCode
string ls_ArtifactIdentifier
string ls_BucketOwnerAccess
integer li_EncryptionDisabled
string ls_Md5sum
integer li_OverrideArtifactName
string ls_Sha256sum
string ls_AuthResource
string ls_AuthType
string ls_Buildspec
string ls_BuildStatusConfigContext
string ls_BuildStatusConfigTargetUrl
integer li_GitCloneDepth
integer li_GitSubmodulesConfigFetchSubmodules
integer li_InsecureSsl
integer li_ReportBuildStatus
string ls_SourceIdentifier
string ls_SourceVersion
string ls_Arn
string ls_ArtifactIdentifier
string ls_BucketOwnerAccess
integer li_EncryptionDisabled
string ls_Location
string ls_Md5sum
integer li_OverrideArtifactName
string ls_Sha256sum
string ls_BuildBatchArn
integer li_BuildComplete
integer li_BuildNumber
string ls_BuildStatus
string ls_CacheLocation
string ls_V_Type
string ls_CurrentPhase
integer li_SessionEnabled
string ls_SessionTarget
string ls_EncryptionKey
integer li_EndTime
string ls_Certificate
string ls_ComputeType
string ls_Image
string ls_ImagePullCredentialsType
integer li_PrivilegedMode
string ls_Credential
string ls_CredentialProvider
string ls_EnvironmentType
string ls_Id
string ls_Initiator
string ls_GroupName
string ls_Status
string ls_StreamName
string ls_CloudWatchLogsArn
string ls_DeepLink
string ls_LogsGroupName
string ls_S3DeepLink
string ls_S3LogsBucketOwnerAccess
integer li_S3LogsEncryptionDisabled
string ls_S3LogsLocation
string ls_S3LogsStatus
string ls_S3LogsArn
string ls_LogsStreamName
string ls_NetworkInterfaceId
string ls_SubnetId
string ls_ProjectName
integer li_QueuedTimeoutInMinutes
string ls_ResolvedSourceVersion
string ls_ServiceRole
string ls_Resource
string ls_AuthType
string ls_Buildspec
string ls_Context
string ls_TargetUrl
integer li_GitCloneDepth
integer li_FetchSubmodules
integer li_InsecureSsl
string ls_SourceLocation
integer li_ReportBuildStatus
string ls_SourceIdentifier
string ls_SourceType
string ls_SourceVersion
integer li_StartTime
integer li_TimeoutInMinutes
string ls_VpcId
integer i
integer li_Count_i
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_AuthAws = create oleobject
li_rc = loo_AuthAws.ConnectToNewObject("Chilkat_9_5_0.AuthAws")
loo_AuthAws.AccessKey = "AWS_ACCESS_KEY"
loo_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.)
loo_AuthAws.Region = "us-west-2"
loo_AuthAws.ServiceName = "codebuild"
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
loo_Rest.SetAuthAws(loo_AuthAws)
// URL: https://codebuild.us-west-2.amazonaws.com/
// Use the same region as specified above.
li_Success = loo_Rest.Connect("codebuild.us-west-2.amazonaws.com",443,1,1)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_AuthAws
return
end if
// 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
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_Json.UpdateString("id","string")
// The JSON request body created by the above code:
// {
// "id": "string"
// }
loo_Rest.AddHeader("Content-Type","application/x-amz-json-1.1")
loo_Rest.AddHeader("X-Amz-Target","CodeBuild_20161006.StopBuild")
loo_SbRequestBody = create oleobject
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Rest.FullRequestSb("POST","/",loo_SbRequestBody,loo_SbResponseBody)
if li_Success <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_AuthAws
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
li_RespStatusCode = loo_Rest.ResponseStatusCode
Write-Debug "response status code = " + string(li_RespStatusCode)
if li_RespStatusCode <> 200 then
Write-Debug "Response Header:"
Write-Debug loo_Rest.ResponseHeader
Write-Debug "Response Body:"
Write-Debug loo_SbResponseBody.GetAsString()
destroy loo_Rest
destroy loo_AuthAws
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_JResp.LoadSb(loo_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
ls_Arn = loo_JResp.StringOf("build.arn")
ls_ArtifactIdentifier = loo_JResp.StringOf("build.artifacts.artifactIdentifier")
ls_BucketOwnerAccess = loo_JResp.StringOf("build.artifacts.bucketOwnerAccess")
li_EncryptionDisabled = loo_JResp.IntOf("build.artifacts.encryptionDisabled")
ls_Location = loo_JResp.StringOf("build.artifacts.location")
ls_Md5sum = loo_JResp.StringOf("build.artifacts.md5sum")
li_OverrideArtifactName = loo_JResp.IntOf("build.artifacts.overrideArtifactName")
ls_Sha256sum = loo_JResp.StringOf("build.artifacts.sha256sum")
ls_BuildBatchArn = loo_JResp.StringOf("build.buildBatchArn")
li_BuildComplete = loo_JResp.IntOf("build.buildComplete")
li_BuildNumber = loo_JResp.IntOf("build.buildNumber")
ls_BuildStatus = loo_JResp.StringOf("build.buildStatus")
ls_CacheLocation = loo_JResp.StringOf("build.cache.location")
ls_V_Type = loo_JResp.StringOf("build.cache.type")
ls_CurrentPhase = loo_JResp.StringOf("build.currentPhase")
li_SessionEnabled = loo_JResp.IntOf("build.debugSession.sessionEnabled")
ls_SessionTarget = loo_JResp.StringOf("build.debugSession.sessionTarget")
ls_EncryptionKey = loo_JResp.StringOf("build.encryptionKey")
li_EndTime = loo_JResp.IntOf("build.endTime")
ls_Certificate = loo_JResp.StringOf("build.environment.certificate")
ls_ComputeType = loo_JResp.StringOf("build.environment.computeType")
ls_Image = loo_JResp.StringOf("build.environment.image")
ls_ImagePullCredentialsType = loo_JResp.StringOf("build.environment.imagePullCredentialsType")
li_PrivilegedMode = loo_JResp.IntOf("build.environment.privilegedMode")
ls_Credential = loo_JResp.StringOf("build.environment.registryCredential.credential")
ls_CredentialProvider = loo_JResp.StringOf("build.environment.registryCredential.credentialProvider")
ls_EnvironmentType = loo_JResp.StringOf("build.environment.type")
ls_Id = loo_JResp.StringOf("build.id")
ls_Initiator = loo_JResp.StringOf("build.initiator")
ls_GroupName = loo_JResp.StringOf("build.logs.cloudWatchLogs.groupName")
ls_Status = loo_JResp.StringOf("build.logs.cloudWatchLogs.status")
ls_StreamName = loo_JResp.StringOf("build.logs.cloudWatchLogs.streamName")
ls_CloudWatchLogsArn = loo_JResp.StringOf("build.logs.cloudWatchLogsArn")
ls_DeepLink = loo_JResp.StringOf("build.logs.deepLink")
ls_LogsGroupName = loo_JResp.StringOf("build.logs.groupName")
ls_S3DeepLink = loo_JResp.StringOf("build.logs.s3DeepLink")
ls_S3LogsBucketOwnerAccess = loo_JResp.StringOf("build.logs.s3Logs.bucketOwnerAccess")
li_S3LogsEncryptionDisabled = loo_JResp.IntOf("build.logs.s3Logs.encryptionDisabled")
ls_S3LogsLocation = loo_JResp.StringOf("build.logs.s3Logs.location")
ls_S3LogsStatus = loo_JResp.StringOf("build.logs.s3Logs.status")
ls_S3LogsArn = loo_JResp.StringOf("build.logs.s3LogsArn")
ls_LogsStreamName = loo_JResp.StringOf("build.logs.streamName")
ls_NetworkInterfaceId = loo_JResp.StringOf("build.networkInterface.networkInterfaceId")
ls_SubnetId = loo_JResp.StringOf("build.networkInterface.subnetId")
ls_ProjectName = loo_JResp.StringOf("build.projectName")
li_QueuedTimeoutInMinutes = loo_JResp.IntOf("build.queuedTimeoutInMinutes")
ls_ResolvedSourceVersion = loo_JResp.StringOf("build.resolvedSourceVersion")
ls_ServiceRole = loo_JResp.StringOf("build.serviceRole")
ls_Resource = loo_JResp.StringOf("build.source.auth.resource")
ls_AuthType = loo_JResp.StringOf("build.source.auth.type")
ls_Buildspec = loo_JResp.StringOf("build.source.buildspec")
ls_Context = loo_JResp.StringOf("build.source.buildStatusConfig.context")
ls_TargetUrl = loo_JResp.StringOf("build.source.buildStatusConfig.targetUrl")
li_GitCloneDepth = loo_JResp.IntOf("build.source.gitCloneDepth")
li_FetchSubmodules = loo_JResp.IntOf("build.source.gitSubmodulesConfig.fetchSubmodules")
li_InsecureSsl = loo_JResp.IntOf("build.source.insecureSsl")
ls_SourceLocation = loo_JResp.StringOf("build.source.location")
li_ReportBuildStatus = loo_JResp.IntOf("build.source.reportBuildStatus")
ls_SourceIdentifier = loo_JResp.StringOf("build.source.sourceIdentifier")
ls_SourceType = loo_JResp.StringOf("build.source.type")
ls_SourceVersion = loo_JResp.StringOf("build.sourceVersion")
li_StartTime = loo_JResp.IntOf("build.startTime")
li_TimeoutInMinutes = loo_JResp.IntOf("build.timeoutInMinutes")
ls_VpcId = loo_JResp.StringOf("build.vpcConfig.vpcId")
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.cache.modes")
do while i < li_Count_i
loo_JResp.I = i
ls_StrVal = loo_JResp.StringOf("build.cache.modes[i]")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.environment.environmentVariables")
do while i < li_Count_i
loo_JResp.I = i
ls_Name = loo_JResp.StringOf("build.environment.environmentVariables[i].name")
ls_V_type = loo_JResp.StringOf("build.environment.environmentVariables[i].type")
ls_Value = loo_JResp.StringOf("build.environment.environmentVariables[i].value")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.exportedEnvironmentVariables")
do while i < li_Count_i
loo_JResp.I = i
ls_Name = loo_JResp.StringOf("build.exportedEnvironmentVariables[i].name")
ls_Value = loo_JResp.StringOf("build.exportedEnvironmentVariables[i].value")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.fileSystemLocations")
do while i < li_Count_i
loo_JResp.I = i
ls_Identifier = loo_JResp.StringOf("build.fileSystemLocations[i].identifier")
ls_Location = loo_JResp.StringOf("build.fileSystemLocations[i].location")
ls_MountOptions = loo_JResp.StringOf("build.fileSystemLocations[i].mountOptions")
ls_MountPoint = loo_JResp.StringOf("build.fileSystemLocations[i].mountPoint")
ls_V_type = loo_JResp.StringOf("build.fileSystemLocations[i].type")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.phases")
do while i < li_Count_i
loo_JResp.I = i
li_DurationInSeconds = loo_JResp.IntOf("build.phases[i].durationInSeconds")
li_EndTime = loo_JResp.IntOf("build.phases[i].endTime")
ls_PhaseStatus = loo_JResp.StringOf("build.phases[i].phaseStatus")
ls_PhaseType = loo_JResp.StringOf("build.phases[i].phaseType")
li_StartTime = loo_JResp.IntOf("build.phases[i].startTime")
j = 0
li_Count_j = loo_JResp.SizeOfArray("build.phases[i].contexts")
do while j < li_Count_j
loo_JResp.J = j
ls_Message = loo_JResp.StringOf("build.phases[i].contexts[j].message")
ls_StatusCode = loo_JResp.StringOf("build.phases[i].contexts[j].statusCode")
j = j + 1
loop
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.reportArns")
do while i < li_Count_i
loo_JResp.I = i
ls_StrVal = loo_JResp.StringOf("build.reportArns[i]")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.secondaryArtifacts")
do while i < li_Count_i
loo_JResp.I = i
ls_ArtifactIdentifier = loo_JResp.StringOf("build.secondaryArtifacts[i].artifactIdentifier")
ls_BucketOwnerAccess = loo_JResp.StringOf("build.secondaryArtifacts[i].bucketOwnerAccess")
li_EncryptionDisabled = loo_JResp.IntOf("build.secondaryArtifacts[i].encryptionDisabled")
ls_Location = loo_JResp.StringOf("build.secondaryArtifacts[i].location")
ls_Md5sum = loo_JResp.StringOf("build.secondaryArtifacts[i].md5sum")
li_OverrideArtifactName = loo_JResp.IntOf("build.secondaryArtifacts[i].overrideArtifactName")
ls_Sha256sum = loo_JResp.StringOf("build.secondaryArtifacts[i].sha256sum")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.secondarySources")
do while i < li_Count_i
loo_JResp.I = i
ls_AuthResource = loo_JResp.StringOf("build.secondarySources[i].auth.resource")
ls_AuthType = loo_JResp.StringOf("build.secondarySources[i].auth.type")
ls_Buildspec = loo_JResp.StringOf("build.secondarySources[i].buildspec")
ls_BuildStatusConfigContext = loo_JResp.StringOf("build.secondarySources[i].buildStatusConfig.context")
ls_BuildStatusConfigTargetUrl = loo_JResp.StringOf("build.secondarySources[i].buildStatusConfig.targetUrl")
li_GitCloneDepth = loo_JResp.IntOf("build.secondarySources[i].gitCloneDepth")
li_GitSubmodulesConfigFetchSubmodules = loo_JResp.IntOf("build.secondarySources[i].gitSubmodulesConfig.fetchSubmodules")
li_InsecureSsl = loo_JResp.IntOf("build.secondarySources[i].insecureSsl")
ls_Location = loo_JResp.StringOf("build.secondarySources[i].location")
li_ReportBuildStatus = loo_JResp.IntOf("build.secondarySources[i].reportBuildStatus")
ls_SourceIdentifier = loo_JResp.StringOf("build.secondarySources[i].sourceIdentifier")
ls_V_type = loo_JResp.StringOf("build.secondarySources[i].type")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.secondarySourceVersions")
do while i < li_Count_i
loo_JResp.I = i
ls_SourceIdentifier = loo_JResp.StringOf("build.secondarySourceVersions[i].sourceIdentifier")
ls_SourceVersion = loo_JResp.StringOf("build.secondarySourceVersions[i].sourceVersion")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.vpcConfig.securityGroupIds")
do while i < li_Count_i
loo_JResp.I = i
ls_StrVal = loo_JResp.StringOf("build.vpcConfig.securityGroupIds[i]")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("build.vpcConfig.subnets")
do while i < li_Count_i
loo_JResp.I = i
ls_StrVal = loo_JResp.StringOf("build.vpcConfig.subnets[i]")
i = i + 1
loop
// A sample JSON response body parsed by the above code:
// {
// "build": {
// "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"
// }
// }
// }
destroy loo_Rest
destroy loo_AuthAws
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp