BatchGetProjects 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_Arn
string ls_ArtifactIdentifier
string ls_BucketOwnerAccess
integer li_EncryptionDisabled
string ls_Location
string ls_Name
string ls_NamespaceType
integer li_OverrideArtifactName
string ls_Packaging
string ls_Path
string ls_V_Type
integer li_BadgeEnabled
string ls_BadgeRequestUrl
string ls_BatchReportMode
integer li_CombineArtifacts
integer li_MaximumBuildsAllowed
string ls_ServiceRole
integer li_TimeoutInMins
string ls_CacheLocation
string ls_CacheType
integer li_ConcurrentBuildLimit
integer li_Created
string ls_Description
string ls_EncryptionKey
string ls_Certificate
string ls_ComputeType
string ls_Image
string ls_ImagePullCredentialsType
integer li_PrivilegedMode
string ls_Credential
string ls_CredentialProvider
string ls_EnvironmentType
integer li_LastModified
string ls_GroupName
string ls_Status
string ls_StreamName
string ls_S3LogsBucketOwnerAccess
integer li_S3LogsEncryptionDisabled
string ls_S3LogsLocation
string ls_S3LogsStatus
string ls_Name
string ls_ProjectVisibility
string ls_PublicProjectAlias
integer li_QueuedTimeoutInMinutes
string ls_ResourceAccessRole
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_TimeoutInMinutes
string ls_VpcId
string ls_BranchFilter
string ls_BuildType
integer li_LastModifiedSecret
string ls_PayloadUrl
string ls_Secret
string ls_V_Url
integer j
integer li_Count_j
string ls_StrVal
string ls_V_type
string ls_Value
string ls_Identifier
string ls_Location
string ls_MountOptions
string ls_MountPoint
string ls_ArtifactIdentifier
string ls_BucketOwnerAccess
integer li_EncryptionDisabled
string ls_NamespaceType
integer li_OverrideArtifactName
string ls_Packaging
string ls_Path
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_Key
integer k
integer li_Count_k
integer li_ExcludeMatchedPattern
string ls_Pattern
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("names[0]","string")
// The JSON request body created by the above code:
// {
// "names": [
// "string"
// ]
// }
loo_Rest.AddHeader("Content-Type","application/x-amz-json-1.1")
loo_Rest.AddHeader("X-Amz-Target","CodeBuild_20161006.BatchGetProjects")
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
i = 0
li_Count_i = loo_JResp.SizeOfArray("projects")
do while i < li_Count_i
loo_JResp.I = i
ls_Arn = loo_JResp.StringOf("projects[i].arn")
ls_ArtifactIdentifier = loo_JResp.StringOf("projects[i].artifacts.artifactIdentifier")
ls_BucketOwnerAccess = loo_JResp.StringOf("projects[i].artifacts.bucketOwnerAccess")
li_EncryptionDisabled = loo_JResp.IntOf("projects[i].artifacts.encryptionDisabled")
ls_Location = loo_JResp.StringOf("projects[i].artifacts.location")
ls_Name = loo_JResp.StringOf("projects[i].artifacts.name")
ls_NamespaceType = loo_JResp.StringOf("projects[i].artifacts.namespaceType")
li_OverrideArtifactName = loo_JResp.IntOf("projects[i].artifacts.overrideArtifactName")
ls_Packaging = loo_JResp.StringOf("projects[i].artifacts.packaging")
ls_Path = loo_JResp.StringOf("projects[i].artifacts.path")
ls_V_Type = loo_JResp.StringOf("projects[i].artifacts.type")
li_BadgeEnabled = loo_JResp.IntOf("projects[i].badge.badgeEnabled")
ls_BadgeRequestUrl = loo_JResp.StringOf("projects[i].badge.badgeRequestUrl")
ls_BatchReportMode = loo_JResp.StringOf("projects[i].buildBatchConfig.batchReportMode")
li_CombineArtifacts = loo_JResp.IntOf("projects[i].buildBatchConfig.combineArtifacts")
li_MaximumBuildsAllowed = loo_JResp.IntOf("projects[i].buildBatchConfig.restrictions.maximumBuildsAllowed")
ls_ServiceRole = loo_JResp.StringOf("projects[i].buildBatchConfig.serviceRole")
li_TimeoutInMins = loo_JResp.IntOf("projects[i].buildBatchConfig.timeoutInMins")
ls_CacheLocation = loo_JResp.StringOf("projects[i].cache.location")
ls_CacheType = loo_JResp.StringOf("projects[i].cache.type")
li_ConcurrentBuildLimit = loo_JResp.IntOf("projects[i].concurrentBuildLimit")
li_Created = loo_JResp.IntOf("projects[i].created")
ls_Description = loo_JResp.StringOf("projects[i].description")
ls_EncryptionKey = loo_JResp.StringOf("projects[i].encryptionKey")
ls_Certificate = loo_JResp.StringOf("projects[i].environment.certificate")
ls_ComputeType = loo_JResp.StringOf("projects[i].environment.computeType")
ls_Image = loo_JResp.StringOf("projects[i].environment.image")
ls_ImagePullCredentialsType = loo_JResp.StringOf("projects[i].environment.imagePullCredentialsType")
li_PrivilegedMode = loo_JResp.IntOf("projects[i].environment.privilegedMode")
ls_Credential = loo_JResp.StringOf("projects[i].environment.registryCredential.credential")
ls_CredentialProvider = loo_JResp.StringOf("projects[i].environment.registryCredential.credentialProvider")
ls_EnvironmentType = loo_JResp.StringOf("projects[i].environment.type")
li_LastModified = loo_JResp.IntOf("projects[i].lastModified")
ls_GroupName = loo_JResp.StringOf("projects[i].logsConfig.cloudWatchLogs.groupName")
ls_Status = loo_JResp.StringOf("projects[i].logsConfig.cloudWatchLogs.status")
ls_StreamName = loo_JResp.StringOf("projects[i].logsConfig.cloudWatchLogs.streamName")
ls_S3LogsBucketOwnerAccess = loo_JResp.StringOf("projects[i].logsConfig.s3Logs.bucketOwnerAccess")
li_S3LogsEncryptionDisabled = loo_JResp.IntOf("projects[i].logsConfig.s3Logs.encryptionDisabled")
ls_S3LogsLocation = loo_JResp.StringOf("projects[i].logsConfig.s3Logs.location")
ls_S3LogsStatus = loo_JResp.StringOf("projects[i].logsConfig.s3Logs.status")
ls_Name = loo_JResp.StringOf("projects[i].name")
ls_ProjectVisibility = loo_JResp.StringOf("projects[i].projectVisibility")
ls_PublicProjectAlias = loo_JResp.StringOf("projects[i].publicProjectAlias")
li_QueuedTimeoutInMinutes = loo_JResp.IntOf("projects[i].queuedTimeoutInMinutes")
ls_ResourceAccessRole = loo_JResp.StringOf("projects[i].resourceAccessRole")
ls_ServiceRole = loo_JResp.StringOf("projects[i].serviceRole")
ls_Resource = loo_JResp.StringOf("projects[i].source.auth.resource")
ls_AuthType = loo_JResp.StringOf("projects[i].source.auth.type")
ls_Buildspec = loo_JResp.StringOf("projects[i].source.buildspec")
ls_Context = loo_JResp.StringOf("projects[i].source.buildStatusConfig.context")
ls_TargetUrl = loo_JResp.StringOf("projects[i].source.buildStatusConfig.targetUrl")
li_GitCloneDepth = loo_JResp.IntOf("projects[i].source.gitCloneDepth")
li_FetchSubmodules = loo_JResp.IntOf("projects[i].source.gitSubmodulesConfig.fetchSubmodules")
li_InsecureSsl = loo_JResp.IntOf("projects[i].source.insecureSsl")
ls_SourceLocation = loo_JResp.StringOf("projects[i].source.location")
li_ReportBuildStatus = loo_JResp.IntOf("projects[i].source.reportBuildStatus")
ls_SourceIdentifier = loo_JResp.StringOf("projects[i].source.sourceIdentifier")
ls_SourceType = loo_JResp.StringOf("projects[i].source.type")
ls_SourceVersion = loo_JResp.StringOf("projects[i].sourceVersion")
li_TimeoutInMinutes = loo_JResp.IntOf("projects[i].timeoutInMinutes")
ls_VpcId = loo_JResp.StringOf("projects[i].vpcConfig.vpcId")
ls_BranchFilter = loo_JResp.StringOf("projects[i].webhook.branchFilter")
ls_BuildType = loo_JResp.StringOf("projects[i].webhook.buildType")
li_LastModifiedSecret = loo_JResp.IntOf("projects[i].webhook.lastModifiedSecret")
ls_PayloadUrl = loo_JResp.StringOf("projects[i].webhook.payloadUrl")
ls_Secret = loo_JResp.StringOf("projects[i].webhook.secret")
ls_V_Url = loo_JResp.StringOf("projects[i].webhook.url")
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].buildBatchConfig.restrictions.computeTypesAllowed")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("projects[i].buildBatchConfig.restrictions.computeTypesAllowed[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].cache.modes")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("projects[i].cache.modes[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].environment.environmentVariables")
do while j < li_Count_j
loo_JResp.J = j
ls_Name = loo_JResp.StringOf("projects[i].environment.environmentVariables[j].name")
ls_V_type = loo_JResp.StringOf("projects[i].environment.environmentVariables[j].type")
ls_Value = loo_JResp.StringOf("projects[i].environment.environmentVariables[j].value")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].fileSystemLocations")
do while j < li_Count_j
loo_JResp.J = j
ls_Identifier = loo_JResp.StringOf("projects[i].fileSystemLocations[j].identifier")
ls_Location = loo_JResp.StringOf("projects[i].fileSystemLocations[j].location")
ls_MountOptions = loo_JResp.StringOf("projects[i].fileSystemLocations[j].mountOptions")
ls_MountPoint = loo_JResp.StringOf("projects[i].fileSystemLocations[j].mountPoint")
ls_V_type = loo_JResp.StringOf("projects[i].fileSystemLocations[j].type")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].secondaryArtifacts")
do while j < li_Count_j
loo_JResp.J = j
ls_ArtifactIdentifier = loo_JResp.StringOf("projects[i].secondaryArtifacts[j].artifactIdentifier")
ls_BucketOwnerAccess = loo_JResp.StringOf("projects[i].secondaryArtifacts[j].bucketOwnerAccess")
li_EncryptionDisabled = loo_JResp.IntOf("projects[i].secondaryArtifacts[j].encryptionDisabled")
ls_Location = loo_JResp.StringOf("projects[i].secondaryArtifacts[j].location")
ls_Name = loo_JResp.StringOf("projects[i].secondaryArtifacts[j].name")
ls_NamespaceType = loo_JResp.StringOf("projects[i].secondaryArtifacts[j].namespaceType")
li_OverrideArtifactName = loo_JResp.IntOf("projects[i].secondaryArtifacts[j].overrideArtifactName")
ls_Packaging = loo_JResp.StringOf("projects[i].secondaryArtifacts[j].packaging")
ls_Path = loo_JResp.StringOf("projects[i].secondaryArtifacts[j].path")
ls_V_type = loo_JResp.StringOf("projects[i].secondaryArtifacts[j].type")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].secondarySources")
do while j < li_Count_j
loo_JResp.J = j
ls_AuthResource = loo_JResp.StringOf("projects[i].secondarySources[j].auth.resource")
ls_AuthType = loo_JResp.StringOf("projects[i].secondarySources[j].auth.type")
ls_Buildspec = loo_JResp.StringOf("projects[i].secondarySources[j].buildspec")
ls_BuildStatusConfigContext = loo_JResp.StringOf("projects[i].secondarySources[j].buildStatusConfig.context")
ls_BuildStatusConfigTargetUrl = loo_JResp.StringOf("projects[i].secondarySources[j].buildStatusConfig.targetUrl")
li_GitCloneDepth = loo_JResp.IntOf("projects[i].secondarySources[j].gitCloneDepth")
li_GitSubmodulesConfigFetchSubmodules = loo_JResp.IntOf("projects[i].secondarySources[j].gitSubmodulesConfig.fetchSubmodules")
li_InsecureSsl = loo_JResp.IntOf("projects[i].secondarySources[j].insecureSsl")
ls_Location = loo_JResp.StringOf("projects[i].secondarySources[j].location")
li_ReportBuildStatus = loo_JResp.IntOf("projects[i].secondarySources[j].reportBuildStatus")
ls_SourceIdentifier = loo_JResp.StringOf("projects[i].secondarySources[j].sourceIdentifier")
ls_V_type = loo_JResp.StringOf("projects[i].secondarySources[j].type")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].secondarySourceVersions")
do while j < li_Count_j
loo_JResp.J = j
ls_SourceIdentifier = loo_JResp.StringOf("projects[i].secondarySourceVersions[j].sourceIdentifier")
ls_SourceVersion = loo_JResp.StringOf("projects[i].secondarySourceVersions[j].sourceVersion")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].tags")
do while j < li_Count_j
loo_JResp.J = j
ls_Key = loo_JResp.StringOf("projects[i].tags[j].key")
ls_Value = loo_JResp.StringOf("projects[i].tags[j].value")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].vpcConfig.securityGroupIds")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("projects[i].vpcConfig.securityGroupIds[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].vpcConfig.subnets")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("projects[i].vpcConfig.subnets[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("projects[i].webhook.filterGroups")
do while j < li_Count_j
loo_JResp.J = j
k = 0
li_Count_k = loo_JResp.SizeOfArray("projects[i].webhook.filterGroups[j]")
do while k < li_Count_k
loo_JResp.K = k
li_ExcludeMatchedPattern = loo_JResp.IntOf("projects[i].webhook.filterGroups[j][k].excludeMatchedPattern")
ls_Pattern = loo_JResp.StringOf("projects[i].webhook.filterGroups[j][k].pattern")
ls_V_type = loo_JResp.StringOf("projects[i].webhook.filterGroups[j][k].type")
k = k + 1
loop
j = j + 1
loop
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("projectsNotFound")
do while i < li_Count_i
loo_JResp.I = i
ls_StrVal = loo_JResp.StringOf("projectsNotFound[i]")
i = i + 1
loop
// 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"
// ]
// }
destroy loo_Rest
destroy loo_AuthAws
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp