Chilkat Online Tools

BatchGetDeploymentGroups Xojo Example

AWS CodeDeploy

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Dim rest As New Chilkat.Rest
Dim success As Boolean

Dim authAws As New Chilkat.AuthAws
authAws.AccessKey = "AWS_ACCESS_KEY"
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.)
authAws.Region = "us-west-2"
authAws.ServiceName = "codedeploy"
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
success = rest.SetAuthAws(authAws)

// URL: https://codedeploy.us-west-2.amazonaws.com/
// Use the same region as specified above.
success = rest.Connect("codedeploy.us-west-2.amazonaws.com",443,True,True)
If (success <> True) Then
    System.DebugLog("ConnectFailReason: " + Str(rest.ConnectFailReason))
    System.DebugLog(rest.LastErrorText)
    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

Dim json As New Chilkat.JsonObject
success = json.UpdateString("applicationName","string")
success = json.UpdateString("deploymentGroupNames[0]","string")

// The JSON request body created by the above code:

// {
//   "applicationName": "string",
//   "deploymentGroupNames": [
//     "string"
//   ]
// }

success = rest.AddHeader("Content-Type","application/x-amz-json-1.1")
success = rest.AddHeader("X-Amz-Target","CodeDeploy_20141006.BatchGetDeploymentGroups")

Dim sbRequestBody As New Chilkat.StringBuilder
success = json.EmitSb(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST","/",sbRequestBody,sbResponseBody)
If (success <> True) Then
    System.DebugLog(rest.LastErrorText)
    Return
End If

Dim respStatusCode As Int32
respStatusCode = rest.ResponseStatusCode
System.DebugLog("response status code = " + Str(respStatusCode))
If (respStatusCode <> 200) Then
    System.DebugLog("Response Header:")
    System.DebugLog(rest.ResponseHeader)
    System.DebugLog("Response Body:")
    System.DebugLog(sbResponseBody.GetAsString())
    Return
End If

Dim jResp As New Chilkat.JsonObject
success = jResp.LoadSb(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

Dim Enabled As Int32
Dim IgnorePollAlarmFailure As Int32
Dim applicationName As String
Dim autoRollbackConfigurationEnabled As Int32
Dim ActionOnTimeout As String
Dim WaitTimeInMinutes As Int32
Dim Action As String
Dim TerminateBlueInstancesOnDeploymentSuccessAction As String
Dim TerminationWaitTimeInMinutes As Int32
Dim computePlatform As String
Dim deploymentConfigName As String
Dim deploymentGroupId As String
Dim deploymentGroupName As String
Dim DeploymentOption As String
Dim DeploymentType As String
Dim CreateTime As Int32
Dim DeploymentId As String
Dim EndTime As Int32
Dim Status As String
Dim lastSuccessfulDeploymentCreateTime As Int32
Dim lastSuccessfulDeploymentDeploymentId As String
Dim lastSuccessfulDeploymentEndTime As Int32
Dim lastSuccessfulDeploymentStatus As String
Dim outdatedInstancesStrategy As String
Dim serviceRoleArn As String
Dim Content As String
Dim Sha256 As String
Dim CommitId As String
Dim Repository As String
Dim RevisionType As String
Dim Bucket As String
Dim BundleType As String
Dim ETag As String
Dim Key As String
Dim Version As String
Dim StringContent As String
Dim StringSha256 As String
Dim j As Int32
Dim count_j As Int32
Dim name As String
Dim strVal As String
Dim hook As String
Dim v_Type As String
Dim Value As String
Dim k As Int32
Dim count_k As Int32
Dim clusterName As String
Dim serviceName As String
Dim triggerName As String
Dim triggerTargetArn As String

Dim errorMessage As String
errorMessage = jResp.StringOf("errorMessage")
Dim i As Int32
i = 0
Dim count_i As Int32
count_i = jResp.SizeOfArray("deploymentGroupsInfo")
While i < count_i
    jResp.I = i
    Enabled = jResp.IntOf("deploymentGroupsInfo[i].alarmConfiguration.enabled")
    IgnorePollAlarmFailure = jResp.IntOf("deploymentGroupsInfo[i].alarmConfiguration.ignorePollAlarmFailure")
    applicationName = jResp.StringOf("deploymentGroupsInfo[i].applicationName")
    autoRollbackConfigurationEnabled = jResp.IntOf("deploymentGroupsInfo[i].autoRollbackConfiguration.enabled")
    ActionOnTimeout = jResp.StringOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.deploymentReadyOption.actionOnTimeout")
    WaitTimeInMinutes = jResp.IntOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.deploymentReadyOption.waitTimeInMinutes")
    Action = jResp.StringOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.greenFleetProvisioningOption.action")
    TerminateBlueInstancesOnDeploymentSuccessAction = jResp.StringOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.action")
    TerminationWaitTimeInMinutes = jResp.IntOf("deploymentGroupsInfo[i].blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.terminationWaitTimeInMinutes")
    computePlatform = jResp.StringOf("deploymentGroupsInfo[i].computePlatform")
    deploymentConfigName = jResp.StringOf("deploymentGroupsInfo[i].deploymentConfigName")
    deploymentGroupId = jResp.StringOf("deploymentGroupsInfo[i].deploymentGroupId")
    deploymentGroupName = jResp.StringOf("deploymentGroupsInfo[i].deploymentGroupName")
    DeploymentOption = jResp.StringOf("deploymentGroupsInfo[i].deploymentStyle.deploymentOption")
    DeploymentType = jResp.StringOf("deploymentGroupsInfo[i].deploymentStyle.deploymentType")
    CreateTime = jResp.IntOf("deploymentGroupsInfo[i].lastAttemptedDeployment.createTime")
    DeploymentId = jResp.StringOf("deploymentGroupsInfo[i].lastAttemptedDeployment.deploymentId")
    EndTime = jResp.IntOf("deploymentGroupsInfo[i].lastAttemptedDeployment.endTime")
    Status = jResp.StringOf("deploymentGroupsInfo[i].lastAttemptedDeployment.status")
    lastSuccessfulDeploymentCreateTime = jResp.IntOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.createTime")
    lastSuccessfulDeploymentDeploymentId = jResp.StringOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.deploymentId")
    lastSuccessfulDeploymentEndTime = jResp.IntOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.endTime")
    lastSuccessfulDeploymentStatus = jResp.StringOf("deploymentGroupsInfo[i].lastSuccessfulDeployment.status")
    outdatedInstancesStrategy = jResp.StringOf("deploymentGroupsInfo[i].outdatedInstancesStrategy")
    serviceRoleArn = jResp.StringOf("deploymentGroupsInfo[i].serviceRoleArn")
    Content = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.appSpecContent.content")
    Sha256 = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.appSpecContent.sha256")
    CommitId = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.gitHubLocation.commitId")
    Repository = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.gitHubLocation.repository")
    RevisionType = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.revisionType")
    Bucket = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.bucket")
    BundleType = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.bundleType")
    ETag = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.eTag")
    Key = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.key")
    Version = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.s3Location.version")
    StringContent = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.string.content")
    StringSha256 = jResp.StringOf("deploymentGroupsInfo[i].targetRevision.string.sha256")
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].alarmConfiguration.alarms")
    While j < count_j
        jResp.J = j
        name = jResp.StringOf("deploymentGroupsInfo[i].alarmConfiguration.alarms[j].name")
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].autoRollbackConfiguration.events")
    While j < count_j
        jResp.J = j
        strVal = jResp.StringOf("deploymentGroupsInfo[i].autoRollbackConfiguration.events[j]")
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].autoScalingGroups")
    While j < count_j
        jResp.J = j
        hook = jResp.StringOf("deploymentGroupsInfo[i].autoScalingGroups[j].hook")
        name = jResp.StringOf("deploymentGroupsInfo[i].autoScalingGroups[j].name")
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].ec2TagFilters")
    While j < count_j
        jResp.J = j
        Key = jResp.StringOf("deploymentGroupsInfo[i].ec2TagFilters[j].Key")
        v_Type = jResp.StringOf("deploymentGroupsInfo[i].ec2TagFilters[j].Type")
        Value = jResp.StringOf("deploymentGroupsInfo[i].ec2TagFilters[j].Value")
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList")
    While j < count_j
        jResp.J = j
        k = 0
        count_k = jResp.SizeOfArray("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j]")
        While k < count_k
            jResp.K = k
            Key = jResp.StringOf("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j][k].Key")
            v_Type = jResp.StringOf("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j][k].Type")
            Value = jResp.StringOf("deploymentGroupsInfo[i].ec2TagSet.ec2TagSetList[j][k].Value")
            k = k + 1
        Wend
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].ecsServices")
    While j < count_j
        jResp.J = j
        clusterName = jResp.StringOf("deploymentGroupsInfo[i].ecsServices[j].clusterName")
        serviceName = jResp.StringOf("deploymentGroupsInfo[i].ecsServices[j].serviceName")
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.elbInfoList")
    While j < count_j
        jResp.J = j
        name = jResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.elbInfoList[j].name")
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupInfoList")
    While j < count_j
        jResp.J = j
        name = jResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupInfoList[j].name")
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList")
    While j < count_j
        jResp.J = j
        k = 0
        count_k = jResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].prodTrafficRoute.listenerArns")
        While k < count_k
            jResp.K = k
            strVal = jResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].prodTrafficRoute.listenerArns[k]")
            k = k + 1
        Wend
        k = 0
        count_k = jResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].targetGroups")
        While k < count_k
            jResp.K = k
            name = jResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].targetGroups[k].name")
            k = k + 1
        Wend
        k = 0
        count_k = jResp.SizeOfArray("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].testTrafficRoute.listenerArns")
        While k < count_k
            jResp.K = k
            strVal = jResp.StringOf("deploymentGroupsInfo[i].loadBalancerInfo.targetGroupPairInfoList[j].testTrafficRoute.listenerArns[k]")
            k = k + 1
        Wend
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].onPremisesInstanceTagFilters")
    While j < count_j
        jResp.J = j
        Key = jResp.StringOf("deploymentGroupsInfo[i].onPremisesInstanceTagFilters[j].Key")
        v_Type = jResp.StringOf("deploymentGroupsInfo[i].onPremisesInstanceTagFilters[j].Type")
        Value = jResp.StringOf("deploymentGroupsInfo[i].onPremisesInstanceTagFilters[j].Value")
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList")
    While j < count_j
        jResp.J = j
        k = 0
        count_k = jResp.SizeOfArray("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j]")
        While k < count_k
            jResp.K = k
            Key = jResp.StringOf("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j][k].Key")
            v_Type = jResp.StringOf("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j][k].Type")
            Value = jResp.StringOf("deploymentGroupsInfo[i].onPremisesTagSet.onPremisesTagSetList[j][k].Value")
            k = k + 1
        Wend
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("deploymentGroupsInfo[i].triggerConfigurations")
    While j < count_j
        jResp.J = j
        triggerName = jResp.StringOf("deploymentGroupsInfo[i].triggerConfigurations[j].triggerName")
        triggerTargetArn = jResp.StringOf("deploymentGroupsInfo[i].triggerConfigurations[j].triggerTargetArn")
        k = 0
        count_k = jResp.SizeOfArray("deploymentGroupsInfo[i].triggerConfigurations[j].triggerEvents")
        While k < count_k
            jResp.K = k
            strVal = jResp.StringOf("deploymentGroupsInfo[i].triggerConfigurations[j].triggerEvents[k]")
            k = k + 1
        Wend
        j = j + 1
    Wend
    i = i + 1
Wend

// 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"
// }