Chilkat Online Tools

GetDeployment autoit Example

AWS CodeDeploy

; 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 = "codedeploy"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)

; URL: https://codedeploy.us-west-2.amazonaws.com/
; Use the same region as specified above.
$bSuccess = $oRest.Connect("codedeploy.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("deploymentId","string")

; The JSON request body created by the above code:

; {
;   "deploymentId": "string"
; }

$oRest.AddHeader("Content-Type","application/x-amz-json-1.1")
$oRest.AddHeader("X-Amz-Target","CodeDeploy_20141006.GetDeployment")

$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 $strVal
Local $sName
Local $iJ
Local $iCount_j
Local $sV_Type
Local $sValue

Local $sAdditionalDeploymentStatusInfo = $oJResp.StringOf("deploymentInfo.additionalDeploymentStatusInfo")
Local $sApplicationName = $oJResp.StringOf("deploymentInfo.applicationName")
Local $iEnabled = $oJResp.IntOf("deploymentInfo.autoRollbackConfiguration.enabled")
Local $sActionOnTimeout = $oJResp.StringOf("deploymentInfo.blueGreenDeploymentConfiguration.deploymentReadyOption.actionOnTimeout")
Local $iWaitTimeInMinutes = $oJResp.IntOf("deploymentInfo.blueGreenDeploymentConfiguration.deploymentReadyOption.waitTimeInMinutes")
Local $sAction = $oJResp.StringOf("deploymentInfo.blueGreenDeploymentConfiguration.greenFleetProvisioningOption.action")
Local $sTerminateBlueInstancesOnDeploymentSuccessAction = $oJResp.StringOf("deploymentInfo.blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.action")
Local $iTerminationWaitTimeInMinutes = $oJResp.IntOf("deploymentInfo.blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.terminationWaitTimeInMinutes")
Local $iCompleteTime = $oJResp.IntOf("deploymentInfo.completeTime")
Local $sComputePlatform = $oJResp.StringOf("deploymentInfo.computePlatform")
Local $iCreateTime = $oJResp.IntOf("deploymentInfo.createTime")
Local $sCreator = $oJResp.StringOf("deploymentInfo.creator")
Local $sDeploymentConfigName = $oJResp.StringOf("deploymentInfo.deploymentConfigName")
Local $sDeploymentGroupName = $oJResp.StringOf("deploymentInfo.deploymentGroupName")
Local $sDeploymentId = $oJResp.StringOf("deploymentInfo.deploymentId")
Local $iFailed = $oJResp.IntOf("deploymentInfo.deploymentOverview.Failed")
Local $iInProgress = $oJResp.IntOf("deploymentInfo.deploymentOverview.InProgress")
Local $iPending = $oJResp.IntOf("deploymentInfo.deploymentOverview.Pending")
Local $iReady = $oJResp.IntOf("deploymentInfo.deploymentOverview.Ready")
Local $iSkipped = $oJResp.IntOf("deploymentInfo.deploymentOverview.Skipped")
Local $iSucceeded = $oJResp.IntOf("deploymentInfo.deploymentOverview.Succeeded")
Local $sDeploymentOption = $oJResp.StringOf("deploymentInfo.deploymentStyle.deploymentOption")
Local $sDeploymentType = $oJResp.StringOf("deploymentInfo.deploymentStyle.deploymentType")
Local $sDescription = $oJResp.StringOf("deploymentInfo.description")
Local $sCode = $oJResp.StringOf("deploymentInfo.errorInformation.code")
Local $sMessage = $oJResp.StringOf("deploymentInfo.errorInformation.message")
Local $sExternalId = $oJResp.StringOf("deploymentInfo.externalId")
Local $sFileExistsBehavior = $oJResp.StringOf("deploymentInfo.fileExistsBehavior")
Local $iIgnoreApplicationStopFailures = $oJResp.IntOf("deploymentInfo.ignoreApplicationStopFailures")
Local $iInstanceTerminationWaitTimeStarted = $oJResp.IntOf("deploymentInfo.instanceTerminationWaitTimeStarted")
Local $sContent = $oJResp.StringOf("deploymentInfo.previousRevision.appSpecContent.content")
Local $sSha256 = $oJResp.StringOf("deploymentInfo.previousRevision.appSpecContent.sha256")
Local $sCommitId = $oJResp.StringOf("deploymentInfo.previousRevision.gitHubLocation.commitId")
Local $sRepository = $oJResp.StringOf("deploymentInfo.previousRevision.gitHubLocation.repository")
Local $sRevisionType = $oJResp.StringOf("deploymentInfo.previousRevision.revisionType")
Local $sBucket = $oJResp.StringOf("deploymentInfo.previousRevision.s3Location.bucket")
Local $sBundleType = $oJResp.StringOf("deploymentInfo.previousRevision.s3Location.bundleType")
Local $sETag = $oJResp.StringOf("deploymentInfo.previousRevision.s3Location.eTag")
Local $sKey = $oJResp.StringOf("deploymentInfo.previousRevision.s3Location.key")
Local $sVersion = $oJResp.StringOf("deploymentInfo.previousRevision.s3Location.version")
Local $sStringContent = $oJResp.StringOf("deploymentInfo.previousRevision.string.content")
Local $sStringSha256 = $oJResp.StringOf("deploymentInfo.previousRevision.string.sha256")
Local $sAutoUpdateOutdatedInstancesRootDeploymentId = $oJResp.StringOf("deploymentInfo.relatedDeployments.autoUpdateOutdatedInstancesRootDeploymentId")
Local $sAppSpecContentContent = $oJResp.StringOf("deploymentInfo.revision.appSpecContent.content")
Local $sAppSpecContentSha256 = $oJResp.StringOf("deploymentInfo.revision.appSpecContent.sha256")
Local $sGitHubLocationCommitId = $oJResp.StringOf("deploymentInfo.revision.gitHubLocation.commitId")
Local $sGitHubLocationRepository = $oJResp.StringOf("deploymentInfo.revision.gitHubLocation.repository")
Local $sRevisionRevisionType = $oJResp.StringOf("deploymentInfo.revision.revisionType")
Local $sS3LocationBucket = $oJResp.StringOf("deploymentInfo.revision.s3Location.bucket")
Local $sS3LocationBundleType = $oJResp.StringOf("deploymentInfo.revision.s3Location.bundleType")
Local $sS3LocationETag = $oJResp.StringOf("deploymentInfo.revision.s3Location.eTag")
Local $sS3LocationKey = $oJResp.StringOf("deploymentInfo.revision.s3Location.key")
Local $sS3LocationVersion = $oJResp.StringOf("deploymentInfo.revision.s3Location.version")
$sStringContent = $oJResp.StringOf("deploymentInfo.revision.string.content")
$sStringSha256 = $oJResp.StringOf("deploymentInfo.revision.string.sha256")
Local $sRollbackDeploymentId = $oJResp.StringOf("deploymentInfo.rollbackInfo.rollbackDeploymentId")
Local $sRollbackMessage = $oJResp.StringOf("deploymentInfo.rollbackInfo.rollbackMessage")
Local $sRollbackTriggeringDeploymentId = $oJResp.StringOf("deploymentInfo.rollbackInfo.rollbackTriggeringDeploymentId")
Local $iStartTime = $oJResp.IntOf("deploymentInfo.startTime")
Local $sStatus = $oJResp.StringOf("deploymentInfo.status")
Local $iUpdateOutdatedInstancesOnly = $oJResp.IntOf("deploymentInfo.updateOutdatedInstancesOnly")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("deploymentInfo.autoRollbackConfiguration.events")
While $i < $iCount_i
    $oJResp.I = $i
    $strVal = $oJResp.StringOf("deploymentInfo.autoRollbackConfiguration.events[i]")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("deploymentInfo.deploymentStatusMessages")
While $i < $iCount_i
    $oJResp.I = $i
    $strVal = $oJResp.StringOf("deploymentInfo.deploymentStatusMessages[i]")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("deploymentInfo.loadBalancerInfo.elbInfoList")
While $i < $iCount_i
    $oJResp.I = $i
    $sName = $oJResp.StringOf("deploymentInfo.loadBalancerInfo.elbInfoList[i].name")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("deploymentInfo.loadBalancerInfo.targetGroupInfoList")
While $i < $iCount_i
    $oJResp.I = $i
    $sName = $oJResp.StringOf("deploymentInfo.loadBalancerInfo.targetGroupInfoList[i].name")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("deploymentInfo.loadBalancerInfo.targetGroupPairInfoList")
While $i < $iCount_i
    $oJResp.I = $i
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].prodTrafficRoute.listenerArns")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].prodTrafficRoute.listenerArns[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].targetGroups")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sName = $oJResp.StringOf("deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].targetGroups[j].name")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].testTrafficRoute.listenerArns")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("deploymentInfo.loadBalancerInfo.targetGroupPairInfoList[i].testTrafficRoute.listenerArns[j]")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("deploymentInfo.relatedDeployments.autoUpdateOutdatedInstancesDeploymentIds")
While $i < $iCount_i
    $oJResp.I = $i
    $strVal = $oJResp.StringOf("deploymentInfo.relatedDeployments.autoUpdateOutdatedInstancesDeploymentIds[i]")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("deploymentInfo.targetInstances.autoScalingGroups")
While $i < $iCount_i
    $oJResp.I = $i
    $strVal = $oJResp.StringOf("deploymentInfo.targetInstances.autoScalingGroups[i]")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList")
While $i < $iCount_i
    $oJResp.I = $i
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList[i]")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sKey = $oJResp.StringOf("deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList[i][j].Key")
        $sV_Type = $oJResp.StringOf("deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList[i][j].Type")
        $sValue = $oJResp.StringOf("deploymentInfo.targetInstances.ec2TagSet.ec2TagSetList[i][j].Value")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("deploymentInfo.targetInstances.tagFilters")
While $i < $iCount_i
    $oJResp.I = $i
    $sKey = $oJResp.StringOf("deploymentInfo.targetInstances.tagFilters[i].Key")
    $sV_Type = $oJResp.StringOf("deploymentInfo.targetInstances.tagFilters[i].Type")
    $sValue = $oJResp.StringOf("deploymentInfo.targetInstances.tagFilters[i].Value")
    $i = $i + 1
Wend

; A sample JSON response body parsed by the above code:

; {
;   "deploymentInfo": {
;     "additionalDeploymentStatusInfo": "string",
;     "applicationName": "string",
;     "autoRollbackConfiguration": {
;       "enabled": boolean,
;       "events": [
;         "string"
;       ]
;     },
;     "blueGreenDeploymentConfiguration": {
;       "deploymentReadyOption": {
;         "actionOnTimeout": "string",
;         "waitTimeInMinutes": number
;       },
;       "greenFleetProvisioningOption": {
;         "action": "string"
;       },
;       "terminateBlueInstancesOnDeploymentSuccess": {
;         "action": "string",
;         "terminationWaitTimeInMinutes": number
;       }
;     },
;     "completeTime": number,
;     "computePlatform": "string",
;     "createTime": number,
;     "creator": "string",
;     "deploymentConfigName": "string",
;     "deploymentGroupName": "string",
;     "deploymentId": "string",
;     "deploymentOverview": {
;       "Failed": number,
;       "InProgress": number,
;       "Pending": number,
;       "Ready": number,
;       "Skipped": number,
;       "Succeeded": number
;     },
;     "deploymentStatusMessages": [
;       "string"
;     ],
;     "deploymentStyle": {
;       "deploymentOption": "string",
;       "deploymentType": "string"
;     },
;     "description": "string",
;     "errorInformation": {
;       "code": "string",
;       "message": "string"
;     },
;     "externalId": "string",
;     "fileExistsBehavior": "string",
;     "ignoreApplicationStopFailures": boolean,
;     "instanceTerminationWaitTimeStarted": boolean,
;     "loadBalancerInfo": {
;       "elbInfoList": [
;         {
;           "name": "string"
;         }
;       ],
;       "targetGroupInfoList": [
;         {
;           "name": "string"
;         }
;       ],
;       "targetGroupPairInfoList": [
;         {
;           "prodTrafficRoute": {
;             "listenerArns": [
;               "string"
;             ]
;           },
;           "targetGroups": [
;             {
;               "name": "string"
;             }
;           ],
;           "testTrafficRoute": {
;             "listenerArns": [
;               "string"
;             ]
;           }
;         }
;       ]
;     },
;     "previousRevision": {
;       "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"
;       }
;     },
;     "relatedDeployments": {
;       "autoUpdateOutdatedInstancesDeploymentIds": [
;         "string"
;       ],
;       "autoUpdateOutdatedInstancesRootDeploymentId": "string"
;     },
;     "revision": {
;       "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"
;       }
;     },
;     "rollbackInfo": {
;       "rollbackDeploymentId": "string",
;       "rollbackMessage": "string",
;       "rollbackTriggeringDeploymentId": "string"
;     },
;     "startTime": number,
;     "status": "string",
;     "targetInstances": {
;       "autoScalingGroups": [
;         "string"
;       ],
;       "ec2TagSet": {
;         "ec2TagSetList": [
;           [
;             {
;               "Key": "string",
;               "Type": "string",
;               "Value": "string"
;             }
;           ]
;         ]
;       },
;       "tagFilters": [
;         {
;           "Key": "string",
;           "Type": "string",
;           "Value": "string"
;         }
;       ]
;     },
;     "updateOutdatedInstancesOnly": boolean
;   }
; }