BatchGetDeploymentGroups Foxpro Example
LOCAL loRest
LOCAL lnSuccess
LOCAL loAuthAws
LOCAL loJson
LOCAL loSbRequestBody
LOCAL loSbResponseBody
LOCAL lnRespStatusCode
LOCAL loJResp
LOCAL lnEnabled
LOCAL lnIgnorePollAlarmFailure
LOCAL lcApplicationName
LOCAL lnAutoRollbackConfigurationEnabled
LOCAL lcActionOnTimeout
LOCAL lnWaitTimeInMinutes
LOCAL lcAction
LOCAL lcTerminateBlueInstancesOnDeploymentSuccessAction
LOCAL lnTerminationWaitTimeInMinutes
LOCAL lcComputePlatform
LOCAL lcDeploymentConfigName
LOCAL lcDeploymentGroupId
LOCAL lcDeploymentGroupName
LOCAL lcDeploymentOption
LOCAL lcDeploymentType
LOCAL lnCreateTime
LOCAL lcDeploymentId
LOCAL lnEndTime
LOCAL lcStatus
LOCAL lnLastSuccessfulDeploymentCreateTime
LOCAL lcLastSuccessfulDeploymentDeploymentId
LOCAL lnLastSuccessfulDeploymentEndTime
LOCAL lcLastSuccessfulDeploymentStatus
LOCAL lcOutdatedInstancesStrategy
LOCAL lcServiceRoleArn
LOCAL lcContent
LOCAL lcSha256
LOCAL lcCommitId
LOCAL lcRepository
LOCAL lcRevisionType
LOCAL lcBucket
LOCAL lcBundleType
LOCAL lcETag
LOCAL lcKey
LOCAL lcVersion
LOCAL lcStringContent
LOCAL lcStringSha256
LOCAL j
LOCAL lnCount_j
LOCAL lcName
LOCAL lcStrVal
LOCAL lcHook
LOCAL lcV_Type
LOCAL lcValue
LOCAL k
LOCAL lnCount_k
LOCAL lcClusterName
LOCAL lcServiceName
LOCAL lcTriggerName
LOCAL lcTriggerTargetArn
LOCAL lcErrorMessage
LOCAL i
LOCAL lnCount_i
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loRest = CreateObject('Chilkat_9_5_0.Rest')
loAuthAws = CreateObject('Chilkat_9_5_0.AuthAws')
loAuthAws.AccessKey = "AWS_ACCESS_KEY"
loAuthAws.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.)
loAuthAws.Region = "us-west-2"
loAuthAws.ServiceName = "codedeploy"
* SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
loRest.SetAuthAws(loAuthAws)
* URL: https://codedeploy.us-west-2.amazonaws.com/
* Use the same region as specified above.
lnSuccess = loRest.Connect("codedeploy.us-west-2.amazonaws.com",443,1,1)
IF (lnSuccess <> 1) THEN
? "ConnectFailReason: " + STR(loRest.ConnectFailReason)
? loRest.LastErrorText
RELEASE loRest
RELEASE loAuthAws
CANCEL
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
loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.UpdateString("applicationName","string")
loJson.UpdateString("deploymentGroupNames[0]","string")
* The JSON request body created by the above code:
* {
* "applicationName": "string",
* "deploymentGroupNames": [
* "string"
* ]
* }
loRest.AddHeader("Content-Type","application/x-amz-json-1.1")
loRest.AddHeader("X-Amz-Target","CodeDeploy_20141006.BatchGetDeploymentGroups")
loSbRequestBody = CreateObject('Chilkat_9_5_0.StringBuilder')
loJson.EmitSb(loSbRequestBody)
loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestSb("POST","/",loSbRequestBody,loSbResponseBody)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loAuthAws
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
CANCEL
ENDIF
lnRespStatusCode = loRest.ResponseStatusCode
? "response status code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode <> 200) THEN
? "Response Header:"
? loRest.ResponseHeader
? "Response Body:"
? loSbResponseBody.GetAsString()
RELEASE loRest
RELEASE loAuthAws
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
CANCEL
ENDIF
loJResp = CreateObject('Chilkat_9_5_0.JsonObject')
loJResp.LoadSb(loSbResponseBody)
* 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
lcErrorMessage = loJResp.StringOf("errorMessage")
i = 0
lnCount_i = loJResp.SizeOfArray("deploymentGroupsInfo")
DO WHILE i < lnCount_i
loJResp.I = i
lnEnabled = loJResp.IntOf("deploymentGroupsInfo[i].alarmConfiguration.enabled")
lnIgnorePollAlarmFailure = loJResp.IntOf("deploymentGroupsInfo[i].alarmConfiguration.ignorePollAlarmFailure")
lcApplicationName = loJResp.StringOf("deploymentGroupsInfo[i].applicationName")
lnAutoRollbackConfigurationEnabled = loJResp.IntOf("deploymentGroupsInfo[i].autoRollbackConfiguration.enabled")
lcActionOnTimeout = loJResp.StringOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.deploymentReadyOption.actionOnTimeout")
lnWaitTimeInMinutes = loJResp.IntOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.deploymentReadyOption.waitTimeInMinutes")
lcAction = loJResp.StringOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.greenFleetProvisioningOption.action")
lcTerminateBlueInstancesOnDeploymentSuccessAction = loJResp.StringOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.action")
lnTerminationWaitTimeInMinutes = loJResp.IntOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.terminationWaitTimeInMinutes")
lcComputePlatform = loJResp.StringOf("deploymentGroupsInfo[i].computePlatform")
lcDeploymentConfigName = loJResp.StringOf("deploymentGroupsInfo[i].deploymentConfigName")
lcDeploymentGroupId = loJResp.StringOf("deploymentGroupsInfo[i].deploymentGroupId")
lcDeploymentGroupName = loJResp.StringOf("deploymentGroupsInfo[i].deploymentGroupName")
lcDeploymentOption = loJResp.StringOf("deploymentGroupsInfo[i].deploymentStyle.deploymentOption")
lcDeploymentType = loJResp.StringOf("deploymentGroupsInfo[i].deploymentStyle.deploymentType")
lnCreateTime = loJResp.IntOf("deploymentGroupsInfo[i].lastAttemptedDeployment.createTime")
lcDeploymentId = loJResp.StringOf("deploymentGroupsInfo[i].lastAttemptedDeployment.deploymentId")
lnEndTime = loJResp.IntOf("deploymentGroupsInfo[i].lastAttemptedDeployment.endTime")
lcStatus = loJResp.StringOf("deploymentGroupsInfo[i].lastAttemptedDeployment.status")
lnLastSuccessfulDeploymentCreateTime = loJResp.IntOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.createTime")
lcLastSuccessfulDeploymentDeploymentId = loJResp.StringOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.deploymentId")
lnLastSuccessfulDeploymentEndTime = loJResp.IntOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.endTime")
lcLastSuccessfulDeploymentStatus = loJResp.StringOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.status")
lcOutdatedInstancesStrategy = loJResp.StringOf("deploymentGroupsInfo[i].outdatedInstancesStrategy")
lcServiceRoleArn = loJResp.StringOf("deploymentGroupsInfo[i].serviceRoleArn")
lcContent = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.appSpecContent.content")
lcSha256 = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.appSpecContent.sha256")
lcCommitId = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.gitHubLocation.commitId")
lcRepository = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.gitHubLocation.repository")
lcRevisionType = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.revisionType")
lcBucket = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.bucket")
lcBundleType = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.bundleType")
lcETag = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.eTag")
lcKey = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.key")
lcVersion = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.version")
lcStringContent = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.string.content")
lcStringSha256 = loJResp.StringOf("deploymentGroupsInfo[i].targetRevision.string.sha256")
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].alarmConfiguration.alarms")
DO WHILE j < lnCount_j
loJResp.J = j
lcName = loJResp.StringOf("deploymentGroupsInfo[i].alarmConfiguration.alarms[j].name")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].autoRollbackConfiguration.events")
DO WHILE j < lnCount_j
loJResp.J = j
lcStrVal = loJResp.StringOf("deploymentGroupsInfo[i].autoRollbackConfiguration.events[j]")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].autoScalingGroups")
DO WHILE j < lnCount_j
loJResp.J = j
lcHook = loJResp.StringOf("deploymentGroupsInfo[i].autoScalingGroups[j].hook")
lcName = loJResp.StringOf("deploymentGroupsInfo[i].autoScalingGroups[j].name")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].ec2TagFilters")
DO WHILE j < lnCount_j
loJResp.J = j
lcKey = loJResp.StringOf("deploymentGroupsInfo[i].ec2TagFilters[j].Key")
lcV_Type = loJResp.StringOf("deploymentGroupsInfo[i].ec2TagFilters[j].Type")
lcValue = loJResp.StringOf("deploymentGroupsInfo[i].ec2TagFilters[j].Value")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList")
DO WHILE j < lnCount_j
loJResp.J = j
k = 0
lnCount_k = loJResp.SizeOfArray("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j]")
DO WHILE k < lnCount_k
loJResp.K = k
lcKey = loJResp.StringOf("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j][k].Key")
lcV_Type = loJResp.StringOf("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j][k].Type")
lcValue = loJResp.StringOf("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j][k].Value")
k = k + 1
ENDDO
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].ecsServices")
DO WHILE j < lnCount_j
loJResp.J = j
lcClusterName = loJResp.StringOf("deploymentGroupsInfo[i].ecsServices[j].clusterName")
lcServiceName = loJResp.StringOf("deploymentGroupsInfo[i].ecsServices[j].serviceName")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.elbInfoList")
DO WHILE j < lnCount_j
loJResp.J = j
lcName = loJResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.elbInfoList[j].name")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupInfoList")
DO WHILE j < lnCount_j
loJResp.J = j
lcName = loJResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupInfoList[j].name")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList")
DO WHILE j < lnCount_j
loJResp.J = j
k = 0
lnCount_k = loJResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].prodTrafficRoute.listenerArns")
DO WHILE k < lnCount_k
loJResp.K = k
lcStrVal = loJResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].prodTrafficRoute.listenerArns[k]")
k = k + 1
ENDDO
k = 0
lnCount_k = loJResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].targetGroups")
DO WHILE k < lnCount_k
loJResp.K = k
lcName = loJResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].targetGroups[k].name")
k = k + 1
ENDDO
k = 0
lnCount_k = loJResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].testTrafficRoute.listenerArns")
DO WHILE k < lnCount_k
loJResp.K = k
lcStrVal = loJResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].testTrafficRoute.listenerArns[k]")
k = k + 1
ENDDO
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].onPremisesInstanceTagFilters")
DO WHILE j < lnCount_j
loJResp.J = j
lcKey = loJResp.StringOf("deploymentGroupsInfo[i].onPremisesInstanceTagFilters[j].Key")
lcV_Type = loJResp.StringOf("deploymentGroupsInfo[i].onPremisesInstanceTagFilters[j].Type")
lcValue = loJResp.StringOf("deploymentGroupsInfo[i].onPremisesInstanceTagFilters[j].Value")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList")
DO WHILE j < lnCount_j
loJResp.J = j
k = 0
lnCount_k = loJResp.SizeOfArray("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j]")
DO WHILE k < lnCount_k
loJResp.K = k
lcKey = loJResp.StringOf("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j][k].Key")
lcV_Type = loJResp.StringOf("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j][k].Type")
lcValue = loJResp.StringOf("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j][k].Value")
k = k + 1
ENDDO
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("deploymentGroupsInfo[i].triggerConfigurations")
DO WHILE j < lnCount_j
loJResp.J = j
lcTriggerName = loJResp.StringOf("deploymentGroupsInfo[i].triggerConfigurations[j].triggerName")
lcTriggerTargetArn = loJResp.StringOf("deploymentGroupsInfo[i].triggerConfigurations[j].triggerTargetArn")
k = 0
lnCount_k = loJResp.SizeOfArray("deploymentGroupsInfo[i].triggerConfigurations[j].triggerEvents")
DO WHILE k < lnCount_k
loJResp.K = k
lcStrVal = loJResp.StringOf("deploymentGroupsInfo[i].triggerConfigurations[j].triggerEvents[k]")
k = k + 1
ENDDO
j = j + 1
ENDDO
i = i + 1
ENDDO
* 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"
* }
RELEASE loRest
RELEASE loAuthAws
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
RELEASE loJResp