Chilkat Online Tools

GetDeploymentGroup 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("deploymentGroupName","string")

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

// {
//   "applicationName": "string",
//   "deploymentGroupName": "string"
// }

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

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 name As String
Dim strVal As String
Dim hook As String
Dim v_Type As String
Dim Value As String
Dim j As Int32
Dim count_j As Int32
Dim clusterName As String
Dim serviceName As String
Dim triggerName As String
Dim triggerTargetArn As String

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

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

// {
//   "deploymentGroupInfo": {
//     "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"
//       }
//     ]
//   }
// }