GetDeploymentGroup Go Example
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
rest := chilkat.NewRest()
var success bool
authAws := chilkat.NewAuthAws()
authAws.SetAccessKey("AWS_ACCESS_KEY")
authAws.SetSecretKey("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.SetRegion("us-west-2")
authAws.SetServiceName("codedeploy")
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
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 {
fmt.Println("ConnectFailReason: ", rest.ConnectFailReason())
fmt.Println(rest.LastErrorText())
rest.DisposeRest()
authAws.DisposeAuthAws()
return
}
// 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
json := chilkat.NewJsonObject()
json.UpdateString("applicationName","string")
json.UpdateString("deploymentGroupName","string")
// The JSON request body created by the above code:
// {
// "applicationName": "string",
// "deploymentGroupName": "string"
// }
rest.AddHeader("Content-Type","application/x-amz-json-1.1")
rest.AddHeader("X-Amz-Target","CodeDeploy_20141006.GetDeploymentGroup")
sbRequestBody := chilkat.NewStringBuilder()
json.EmitSb(sbRequestBody)
sbResponseBody := chilkat.NewStringBuilder()
success = rest.FullRequestSb("POST","/",sbRequestBody,sbResponseBody)
if success != true {
fmt.Println(rest.LastErrorText())
rest.DisposeRest()
authAws.DisposeAuthAws()
json.DisposeJsonObject()
sbRequestBody.DisposeStringBuilder()
sbResponseBody.DisposeStringBuilder()
return
}
respStatusCode := rest.ResponseStatusCode()
fmt.Println("response status code = ", respStatusCode)
if respStatusCode != 200 {
fmt.Println("Response Header:")
fmt.Println(rest.ResponseHeader())
fmt.Println("Response Body:")
fmt.Println(*sbResponseBody.GetAsString())
rest.DisposeRest()
authAws.DisposeAuthAws()
json.DisposeJsonObject()
sbRequestBody.DisposeStringBuilder()
sbResponseBody.DisposeStringBuilder()
return
}
jResp := chilkat.NewJsonObject()
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
name_DECLARATION
strVal_DECLARATION
hook_DECLARATION
v_Type_DECLARATION
Value_DECLARATION
var j int
var count_j int
clusterName_DECLARATION
serviceName_DECLARATION
triggerName_DECLARATION
triggerTargetArn_DECLARATION
Enabled := jResp.IntOf("deploymentGroupInfo.alarmConfiguration.enabled")
IgnorePollAlarmFailure := jResp.IntOf("deploymentGroupInfo.alarmConfiguration.ignorePollAlarmFailure")
ApplicationName := jResp.StringOf("deploymentGroupInfo.applicationName")
AutoRollbackConfigurationEnabled := jResp.IntOf("deploymentGroupInfo.autoRollbackConfiguration.enabled")
ActionOnTimeout := jResp.StringOf("deploymentGroupInfo.blueGreenDeploymentConfiguration.deploymentReadyOption.actionOnTimeout")
WaitTimeInMinutes := jResp.IntOf("deploymentGroupInfo.blueGreenDeploymentConfiguration.deploymentReadyOption.waitTimeInMinutes")
Action := jResp.StringOf("deploymentGroupInfo.blueGreenDeploymentConfiguration.greenFleetProvisioningOption.action")
TerminateBlueInstancesOnDeploymentSuccessAction := jResp.StringOf("deploymentGroupInfo.blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.action")
TerminationWaitTimeInMinutes := jResp.IntOf("deploymentGroupInfo.blueGreenDeploymentConfiguration.terminateBlueInstancesOnDeploymentSuccess.terminationWaitTimeInMinutes")
ComputePlatform := jResp.StringOf("deploymentGroupInfo.computePlatform")
DeploymentConfigName := jResp.StringOf("deploymentGroupInfo.deploymentConfigName")
DeploymentGroupId := jResp.StringOf("deploymentGroupInfo.deploymentGroupId")
DeploymentGroupName := jResp.StringOf("deploymentGroupInfo.deploymentGroupName")
DeploymentOption := jResp.StringOf("deploymentGroupInfo.deploymentStyle.deploymentOption")
DeploymentType := jResp.StringOf("deploymentGroupInfo.deploymentStyle.deploymentType")
CreateTime := jResp.IntOf("deploymentGroupInfo.lastAttemptedDeployment.createTime")
DeploymentId := jResp.StringOf("deploymentGroupInfo.lastAttemptedDeployment.deploymentId")
EndTime := jResp.IntOf("deploymentGroupInfo.lastAttemptedDeployment.endTime")
Status := jResp.StringOf("deploymentGroupInfo.lastAttemptedDeployment.status")
LastSuccessfulDeploymentCreateTime := jResp.IntOf("deploymentGroupInfo.lastSuccessfulDeployment.createTime")
LastSuccessfulDeploymentDeploymentId := jResp.StringOf("deploymentGroupInfo.lastSuccessfulDeployment.deploymentId")
LastSuccessfulDeploymentEndTime := jResp.IntOf("deploymentGroupInfo.lastSuccessfulDeployment.endTime")
LastSuccessfulDeploymentStatus := jResp.StringOf("deploymentGroupInfo.lastSuccessfulDeployment.status")
OutdatedInstancesStrategy := jResp.StringOf("deploymentGroupInfo.outdatedInstancesStrategy")
ServiceRoleArn := jResp.StringOf("deploymentGroupInfo.serviceRoleArn")
Content := jResp.StringOf("deploymentGroupInfo.targetRevision.appSpecContent.content")
Sha256 := jResp.StringOf("deploymentGroupInfo.targetRevision.appSpecContent.sha256")
CommitId := jResp.StringOf("deploymentGroupInfo.targetRevision.gitHubLocation.commitId")
Repository := jResp.StringOf("deploymentGroupInfo.targetRevision.gitHubLocation.repository")
RevisionType := jResp.StringOf("deploymentGroupInfo.targetRevision.revisionType")
Bucket := jResp.StringOf("deploymentGroupInfo.targetRevision.s3Location.bucket")
BundleType := jResp.StringOf("deploymentGroupInfo.targetRevision.s3Location.bundleType")
ETag := jResp.StringOf("deploymentGroupInfo.targetRevision.s3Location.eTag")
Key := jResp.StringOf("deploymentGroupInfo.targetRevision.s3Location.key")
Version := jResp.StringOf("deploymentGroupInfo.targetRevision.s3Location.version")
StringContent := jResp.StringOf("deploymentGroupInfo.targetRevision.string.content")
StringSha256 := jResp.StringOf("deploymentGroupInfo.targetRevision.string.sha256")
i := 0
count_i := jResp.SizeOfArray("deploymentGroupInfo.alarmConfiguration.alarms")
for i < count_i {
jResp.SetI(i)
name = *jResp.StringOf("deploymentGroupInfo.alarmConfiguration.alarms[i].name")
i = i + 1
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.autoRollbackConfiguration.events")
for i < count_i {
jResp.SetI(i)
strVal = *jResp.StringOf("deploymentGroupInfo.autoRollbackConfiguration.events[i]")
i = i + 1
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.autoScalingGroups")
for i < count_i {
jResp.SetI(i)
hook = *jResp.StringOf("deploymentGroupInfo.autoScalingGroups[i].hook")
name = *jResp.StringOf("deploymentGroupInfo.autoScalingGroups[i].name")
i = i + 1
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.ec2TagFilters")
for i < count_i {
jResp.SetI(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
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.ec2TagSet.ec2TagSetList")
for i < count_i {
jResp.SetI(i)
j = 0
count_j = jResp.SizeOfArray("deploymentGroupInfo.ec2TagSet.ec2TagSetList[i]")
for j < count_j {
jResp.SetJ(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
}
i = i + 1
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.ecsServices")
for i < count_i {
jResp.SetI(i)
clusterName = *jResp.StringOf("deploymentGroupInfo.ecsServices[i].clusterName")
serviceName = *jResp.StringOf("deploymentGroupInfo.ecsServices[i].serviceName")
i = i + 1
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.loadBalancerInfo.elbInfoList")
for i < count_i {
jResp.SetI(i)
name = *jResp.StringOf("deploymentGroupInfo.loadBalancerInfo.elbInfoList[i].name")
i = i + 1
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.loadBalancerInfo.targetGroupInfoList")
for i < count_i {
jResp.SetI(i)
name = *jResp.StringOf("deploymentGroupInfo.loadBalancerInfo.targetGroupInfoList[i].name")
i = i + 1
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList")
for i < count_i {
jResp.SetI(i)
j = 0
count_j = jResp.SizeOfArray("deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].prodTrafficRoute.listenerArns")
for j < count_j {
jResp.SetJ(j)
strVal = *jResp.StringOf("deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].prodTrafficRoute.listenerArns[j]")
j = j + 1
}
j = 0
count_j = jResp.SizeOfArray("deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].targetGroups")
for j < count_j {
jResp.SetJ(j)
name = *jResp.StringOf("deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].targetGroups[j].name")
j = j + 1
}
j = 0
count_j = jResp.SizeOfArray("deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].testTrafficRoute.listenerArns")
for j < count_j {
jResp.SetJ(j)
strVal = *jResp.StringOf("deploymentGroupInfo.loadBalancerInfo.targetGroupPairInfoList[i].testTrafficRoute.listenerArns[j]")
j = j + 1
}
i = i + 1
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.onPremisesInstanceTagFilters")
for i < count_i {
jResp.SetI(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
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.onPremisesTagSet.onPremisesTagSetList")
for i < count_i {
jResp.SetI(i)
j = 0
count_j = jResp.SizeOfArray("deploymentGroupInfo.onPremisesTagSet.onPremisesTagSetList[i]")
for j < count_j {
jResp.SetJ(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
}
i = i + 1
}
i = 0
count_i = jResp.SizeOfArray("deploymentGroupInfo.triggerConfigurations")
for i < count_i {
jResp.SetI(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")
for j < count_j {
jResp.SetJ(j)
strVal = *jResp.StringOf("deploymentGroupInfo.triggerConfigurations[i].triggerEvents[j]")
j = j + 1
}
i = i + 1
}
// 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"
// }
// ]
// }
// }
rest.DisposeRest()
authAws.DisposeAuthAws()
json.DisposeJsonObject()
sbRequestBody.DisposeStringBuilder()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()