BatchGetDeploymentGroups 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
integer li_Enabled
integer li_IgnorePollAlarmFailure
string ls_ApplicationName
integer li_AutoRollbackConfigurationEnabled
string ls_ActionOnTimeout
integer li_WaitTimeInMinutes
string ls_Action
string ls_TerminateBlueInstancesOnDeploymentSuccessAction
integer li_TerminationWaitTimeInMinutes
string ls_ComputePlatform
string ls_DeploymentConfigName
string ls_DeploymentGroupId
string ls_DeploymentGroupName
string ls_DeploymentOption
string ls_DeploymentType
integer li_CreateTime
string ls_DeploymentId
integer li_EndTime
string ls_Status
integer li_LastSuccessfulDeploymentCreateTime
string ls_LastSuccessfulDeploymentDeploymentId
integer li_LastSuccessfulDeploymentEndTime
string ls_LastSuccessfulDeploymentStatus
string ls_OutdatedInstancesStrategy
string ls_ServiceRoleArn
string ls_Content
string ls_Sha256
string ls_CommitId
string ls_Repository
string ls_RevisionType
string ls_Bucket
string ls_BundleType
string ls_ETag
string ls_Key
string ls_Version
string ls_StringContent
string ls_StringSha256
integer j
integer li_Count_j
string ls_Name
string ls_StrVal
string ls_Hook
string ls_V_Type
string ls_Value
integer k
integer li_Count_k
string ls_ClusterName
string ls_ServiceName
string ls_TriggerName
string ls_TriggerTargetArn
string ls_ErrorMessage
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 = "codedeploy"
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
loo_Rest.SetAuthAws(loo_AuthAws)
// URL: https://codedeploy.us-west-2.amazonaws.com/
// Use the same region as specified above.
li_Success = loo_Rest.Connect("codedeploy.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("applicationName","string")
loo_Json.UpdateString("deploymentGroupNames[0]","string")
// The JSON request body created by the above code:
// {
// "applicationName": "string",
// "deploymentGroupNames": [
// "string"
// ]
// }
loo_Rest.AddHeader("Content-Type","application/x-amz-json-1.1")
loo_Rest.AddHeader("X-Amz-Target","CodeDeploy_20141006.BatchGetDeploymentGroups")
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_ErrorMessage = loo_JResp.StringOf("errorMessage")
i = 0
li_Count_i = loo_JResp.SizeOfArray("deploymentGroupsInfo")
do while i < li_Count_i
loo_JResp.I = i
li_Enabled = loo_JResp.IntOf("deploymentGroupsInfo[i].alarmConfiguration.enabled")
li_IgnorePollAlarmFailure = loo_JResp.IntOf("deploymentGroupsInfo[i].alarmConfiguration.ignorePollAlarmFailure")
ls_ApplicationName = loo_JResp.StringOf("deploymentGroupsInfo[i].applicationName")
li_AutoRollbackConfigurationEnabled = loo_JResp.IntOf("deploymentGroupsInfo[i].autoRollbackConfiguration.enabled")
ls_ActionOnTimeout = loo_JResp.StringOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.deploymentReadyOption.actionOnTimeout")
li_WaitTimeInMinutes = loo_JResp.IntOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.deploymentReadyOption.waitTimeInMinutes")
ls_Action = loo_JResp.StringOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.greenFleetProvisioningOption.action")
ls_TerminateBlueInstancesOnDeploymentSuccessAction = loo_JResp.StringOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.action")
li_TerminationWaitTimeInMinutes = loo_JResp.IntOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.terminationWaitTimeInMinutes")
ls_ComputePlatform = loo_JResp.StringOf("deploymentGroupsInfo[i].computePlatform")
ls_DeploymentConfigName = loo_JResp.StringOf("deploymentGroupsInfo[i].deploymentConfigName")
ls_DeploymentGroupId = loo_JResp.StringOf("deploymentGroupsInfo[i].deploymentGroupId")
ls_DeploymentGroupName = loo_JResp.StringOf("deploymentGroupsInfo[i].deploymentGroupName")
ls_DeploymentOption = loo_JResp.StringOf("deploymentGroupsInfo[i].deploymentStyle.deploymentOption")
ls_DeploymentType = loo_JResp.StringOf("deploymentGroupsInfo[i].deploymentStyle.deploymentType")
li_CreateTime = loo_JResp.IntOf("deploymentGroupsInfo[i].lastAttemptedDeployment.createTime")
ls_DeploymentId = loo_JResp.StringOf("deploymentGroupsInfo[i].lastAttemptedDeployment.deploymentId")
li_EndTime = loo_JResp.IntOf("deploymentGroupsInfo[i].lastAttemptedDeployment.endTime")
ls_Status = loo_JResp.StringOf("deploymentGroupsInfo[i].lastAttemptedDeployment.status")
li_LastSuccessfulDeploymentCreateTime = loo_JResp.IntOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.createTime")
ls_LastSuccessfulDeploymentDeploymentId = loo_JResp.StringOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.deploymentId")
li_LastSuccessfulDeploymentEndTime = loo_JResp.IntOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.endTime")
ls_LastSuccessfulDeploymentStatus = loo_JResp.StringOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.status")
ls_OutdatedInstancesStrategy = loo_JResp.StringOf("deploymentGroupsInfo[i].outdatedInstancesStrategy")
ls_ServiceRoleArn = loo_JResp.StringOf("deploymentGroupsInfo[i].serviceRoleArn")
ls_Content = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.appSpecContent.content")
ls_Sha256 = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.appSpecContent.sha256")
ls_CommitId = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.gitHubLocation.commitId")
ls_Repository = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.gitHubLocation.repository")
ls_RevisionType = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.revisionType")
ls_Bucket = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.bucket")
ls_BundleType = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.bundleType")
ls_ETag = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.eTag")
ls_Key = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.key")
ls_Version = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.version")
ls_StringContent = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.string.content")
ls_StringSha256 = loo_JResp.StringOf("deploymentGroupsInfo[i].targetRevision.string.sha256")
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].alarmConfiguration.alarms")
do while j < li_Count_j
loo_JResp.J = j
ls_Name = loo_JResp.StringOf("deploymentGroupsInfo[i].alarmConfiguration.alarms[j].name")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].autoRollbackConfiguration.events")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("deploymentGroupsInfo[i].autoRollbackConfiguration.events[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].autoScalingGroups")
do while j < li_Count_j
loo_JResp.J = j
ls_Hook = loo_JResp.StringOf("deploymentGroupsInfo[i].autoScalingGroups[j].hook")
ls_Name = loo_JResp.StringOf("deploymentGroupsInfo[i].autoScalingGroups[j].name")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].ec2TagFilters")
do while j < li_Count_j
loo_JResp.J = j
ls_Key = loo_JResp.StringOf("deploymentGroupsInfo[i].ec2TagFilters[j].Key")
ls_V_Type = loo_JResp.StringOf("deploymentGroupsInfo[i].ec2TagFilters[j].Type")
ls_Value = loo_JResp.StringOf("deploymentGroupsInfo[i].ec2TagFilters[j].Value")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList")
do while j < li_Count_j
loo_JResp.J = j
k = 0
li_Count_k = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j]")
do while k < li_Count_k
loo_JResp.K = k
ls_Key = loo_JResp.StringOf("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j][k].Key")
ls_V_Type = loo_JResp.StringOf("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j][k].Type")
ls_Value = loo_JResp.StringOf("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j][k].Value")
k = k + 1
loop
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].ecsServices")
do while j < li_Count_j
loo_JResp.J = j
ls_ClusterName = loo_JResp.StringOf("deploymentGroupsInfo[i].ecsServices[j].clusterName")
ls_ServiceName = loo_JResp.StringOf("deploymentGroupsInfo[i].ecsServices[j].serviceName")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.elbInfoList")
do while j < li_Count_j
loo_JResp.J = j
ls_Name = loo_JResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.elbInfoList[j].name")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupInfoList")
do while j < li_Count_j
loo_JResp.J = j
ls_Name = loo_JResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupInfoList[j].name")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList")
do while j < li_Count_j
loo_JResp.J = j
k = 0
li_Count_k = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].prodTrafficRoute.listenerArns")
do while k < li_Count_k
loo_JResp.K = k
ls_StrVal = loo_JResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].prodTrafficRoute.listenerArns[k]")
k = k + 1
loop
k = 0
li_Count_k = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].targetGroups")
do while k < li_Count_k
loo_JResp.K = k
ls_Name = loo_JResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].targetGroups[k].name")
k = k + 1
loop
k = 0
li_Count_k = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].testTrafficRoute.listenerArns")
do while k < li_Count_k
loo_JResp.K = k
ls_StrVal = loo_JResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].testTrafficRoute.listenerArns[k]")
k = k + 1
loop
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].onPremisesInstanceTagFilters")
do while j < li_Count_j
loo_JResp.J = j
ls_Key = loo_JResp.StringOf("deploymentGroupsInfo[i].onPremisesInstanceTagFilters[j].Key")
ls_V_Type = loo_JResp.StringOf("deploymentGroupsInfo[i].onPremisesInstanceTagFilters[j].Type")
ls_Value = loo_JResp.StringOf("deploymentGroupsInfo[i].onPremisesInstanceTagFilters[j].Value")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList")
do while j < li_Count_j
loo_JResp.J = j
k = 0
li_Count_k = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j]")
do while k < li_Count_k
loo_JResp.K = k
ls_Key = loo_JResp.StringOf("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j][k].Key")
ls_V_Type = loo_JResp.StringOf("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j][k].Type")
ls_Value = loo_JResp.StringOf("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j][k].Value")
k = k + 1
loop
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].triggerConfigurations")
do while j < li_Count_j
loo_JResp.J = j
ls_TriggerName = loo_JResp.StringOf("deploymentGroupsInfo[i].triggerConfigurations[j].triggerName")
ls_TriggerTargetArn = loo_JResp.StringOf("deploymentGroupsInfo[i].triggerConfigurations[j].triggerTargetArn")
k = 0
li_Count_k = loo_JResp.SizeOfArray("deploymentGroupsInfo[i].triggerConfigurations[j].triggerEvents")
do while k < li_Count_k
loo_JResp.K = k
ls_StrVal = loo_JResp.StringOf("deploymentGroupsInfo[i].triggerConfigurations[j].triggerEvents[k]")
k = k + 1
loop
j = j + 1
loop
i = i + 1
loop
// A sample JSON response body parsed by the above code:
// {
// "deploymentGroupsInfo": [
// {
// "alarmConfiguration": {
// "alarms": [
// {
// "name": "string"
// }
// ],
// "enabled": boolean,
// "ignorePollAlarmFailure": boolean
// },
// "applicationName": "string",
// "autoRollbackConfiguration": {
// "enabled": boolean,
// "events": [
// "string"
// ]
// },
// "autoScalingGroups": [
// {
// "hook": "string",
// "name": "string"
// }
// ],
// "blueGreenDeploymentConfiguration": {
// "deploymentReadyOption": {
// "actionOnTimeout": "string",
// "waitTimeInMinutes": number
// },
// "greenFleetProvisioningOption": {
// "action": "string"
// },
// "terminateBlueInstancesOnDeploymentSuccess": {
// "action": "string",
// "terminationWaitTimeInMinutes": number
// }
// },
// "computePlatform": "string",
// "deploymentConfigName": "string",
// "deploymentGroupId": "string",
// "deploymentGroupName": "string",
// "deploymentStyle": {
// "deploymentOption": "string",
// "deploymentType": "string"
// },
// "ec2TagFilters": [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ],
// "ec2TagSet": {
// "ec2TagSetList": [
// [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ]
// ]
// },
// "ecsServices": [
// {
// "clusterName": "string",
// "serviceName": "string"
// }
// ],
// "lastAttemptedDeployment": {
// "createTime": number,
// "deploymentId": "string",
// "endTime": number,
// "status": "string"
// },
// "lastSuccessfulDeployment": {
// "createTime": number,
// "deploymentId": "string",
// "endTime": number,
// "status": "string"
// },
// "loadBalancerInfo": {
// "elbInfoList": [
// {
// "name": "string"
// }
// ],
// "targetGroupInfoList": [
// {
// "name": "string"
// }
// ],
// "targetGroupPairInfoList": [
// {
// "prodTrafficRoute": {
// "listenerArns": [
// "string"
// ]
// },
// "targetGroups": [
// {
// "name": "string"
// }
// ],
// "testTrafficRoute": {
// "listenerArns": [
// "string"
// ]
// }
// }
// ]
// },
// "onPremisesInstanceTagFilters": [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ],
// "onPremisesTagSet": {
// "onPremisesTagSetList": [
// [
// {
// "Key": "string",
// "Type": "string",
// "Value": "string"
// }
// ]
// ]
// },
// "outdatedInstancesStrategy": "string",
// "serviceRoleArn": "string",
// "targetRevision": {
// "appSpecContent": {
// "content": "string",
// "sha256": "string"
// },
// "gitHubLocation": {
// "commitId": "string",
// "repository": "string"
// },
// "revisionType": "string",
// "s3Location": {
// "bucket": "string",
// "bundleType": "string",
// "eTag": "string",
// "key": "string",
// "version": "string"
// },
// "string": {
// "content": "string",
// "sha256": "string"
// }
// },
// "triggerConfigurations": [
// {
// "triggerEvents": [
// "string"
// ],
// "triggerName": "string",
// "triggerTargetArn": "string"
// }
// ]
// }
// ],
// "errorMessage": "string"
// }
destroy loo_Rest
destroy loo_AuthAws
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp