GetDistributionConfiguration autoit Example
; 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 = "imagebuilder"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)
; URL: https://imagebuilder.us-west-2.amazonaws.com/
; Use the same region as specified above.
$bSuccess = $oRest.Connect("imagebuilder.us-west-2.amazonaws.com",443,True,True)
If ($bSuccess <> True) Then
ConsoleWrite("ConnectFailReason: " & $oRest.ConnectFailReason & @CRLF)
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
$oRest.AddHeader("Content-Type","application/x-amz-json-1.1")
$oRest.AddHeader("X-Amz-Target","GetDistributionConfiguration")
$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/GetDistributionConfiguration",$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 $sAmiTagsString
Local $sAmiDistributionConfigurationDescription
Local $sKmsKeyId
Local $sAmiDistributionConfigurationName
Local $sContainerDistributionConfigurationDescription
Local $sRepositoryName
Local $sService
Local $sRegion
Local $sDiskImageFormat
Local $sRoleName
Local $sS3Bucket
Local $sS3Prefix
Local $iJ
Local $iCount_j
Local $strVal
Local $sAccountId
Local $iEnabled
Local $sLaunchTemplateId
Local $sLaunchTemplateName
Local $sLaunchTemplateVersion
Local $iMaxParallelLaunches
Local $iTargetResourceCount
Local $sLaunchTemplateId
Local $iSetDefaultVersion
Local $sArn = $oJResp.StringOf("distributionConfiguration.arn")
Local $sDateCreated = $oJResp.StringOf("distributionConfiguration.dateCreated")
Local $sDateUpdated = $oJResp.StringOf("distributionConfiguration.dateUpdated")
Local $sDescription = $oJResp.StringOf("distributionConfiguration.description")
Local $sName = $oJResp.StringOf("distributionConfiguration.name")
Local $sV_String = $oJResp.StringOf("distributionConfiguration.tags.string")
Local $iTimeoutMinutes = $oJResp.IntOf("distributionConfiguration.timeoutMinutes")
Local $sRequestId = $oJResp.StringOf("requestId")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("distributionConfiguration.distributions")
While $i < $iCount_i
$oJResp.I = $i
$sAmiTagsString = $oJResp.StringOf("distributionConfiguration.distributions[i].amiDistributionConfiguration.amiTags.string")
$sAmiDistributionConfigurationDescription = $oJResp.StringOf("distributionConfiguration.distributions[i].amiDistributionConfiguration.description")
$sKmsKeyId = $oJResp.StringOf("distributionConfiguration.distributions[i].amiDistributionConfiguration.kmsKeyId")
$sAmiDistributionConfigurationName = $oJResp.StringOf("distributionConfiguration.distributions[i].amiDistributionConfiguration.name")
$sContainerDistributionConfigurationDescription = $oJResp.StringOf("distributionConfiguration.distributions[i].containerDistributionConfiguration.description")
$sRepositoryName = $oJResp.StringOf("distributionConfiguration.distributions[i].containerDistributionConfiguration.targetRepository.repositoryName")
$sService = $oJResp.StringOf("distributionConfiguration.distributions[i].containerDistributionConfiguration.targetRepository.service")
$sRegion = $oJResp.StringOf("distributionConfiguration.distributions[i].region")
$sDiskImageFormat = $oJResp.StringOf("distributionConfiguration.distributions[i].s3ExportConfiguration.diskImageFormat")
$sRoleName = $oJResp.StringOf("distributionConfiguration.distributions[i].s3ExportConfiguration.roleName")
$sS3Bucket = $oJResp.StringOf("distributionConfiguration.distributions[i].s3ExportConfiguration.s3Bucket")
$sS3Prefix = $oJResp.StringOf("distributionConfiguration.distributions[i].s3ExportConfiguration.s3Prefix")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationalUnitArns")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationalUnitArns[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationArns")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.organizationArns[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userGroups")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userGroups[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userIds")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("distributionConfiguration.distributions[i].amiDistributionConfiguration.launchPermission.userIds[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("distributionConfiguration.distributions[i].amiDistributionConfiguration.targetAccountIds")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("distributionConfiguration.distributions[i].amiDistributionConfiguration.targetAccountIds[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("distributionConfiguration.distributions[i].containerDistributionConfiguration.containerTags")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("distributionConfiguration.distributions[i].containerDistributionConfiguration.containerTags[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("distributionConfiguration.distributions[i].fastLaunchConfigurations")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sAccountId = $oJResp.StringOf("distributionConfiguration.distributions[i].fastLaunchConfigurations[j].accountId")
$iEnabled = $oJResp.IntOf("distributionConfiguration.distributions[i].fastLaunchConfigurations[j].enabled")
$sLaunchTemplateId = $oJResp.StringOf("distributionConfiguration.distributions[i].fastLaunchConfigurations[j].launchTemplate.launchTemplateId")
$sLaunchTemplateName = $oJResp.StringOf("distributionConfiguration.distributions[i].fastLaunchConfigurations[j].launchTemplate.launchTemplateName")
$sLaunchTemplateVersion = $oJResp.StringOf("distributionConfiguration.distributions[i].fastLaunchConfigurations[j].launchTemplate.launchTemplateVersion")
$iMaxParallelLaunches = $oJResp.IntOf("distributionConfiguration.distributions[i].fastLaunchConfigurations[j].maxParallelLaunches")
$iTargetResourceCount = $oJResp.IntOf("distributionConfiguration.distributions[i].fastLaunchConfigurations[j].snapshotConfiguration.targetResourceCount")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("distributionConfiguration.distributions[i].launchTemplateConfigurations")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sAccountId = $oJResp.StringOf("distributionConfiguration.distributions[i].launchTemplateConfigurations[j].accountId")
$sLaunchTemplateId = $oJResp.StringOf("distributionConfiguration.distributions[i].launchTemplateConfigurations[j].launchTemplateId")
$iSetDefaultVersion = $oJResp.IntOf("distributionConfiguration.distributions[i].launchTemplateConfigurations[j].setDefaultVersion")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("distributionConfiguration.distributions[i].licenseConfigurationArns")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("distributionConfiguration.distributions[i].licenseConfigurationArns[j]")
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
; A sample JSON response body parsed by the above code:
; {
; "distributionConfiguration": {
; "arn": "string",
; "dateCreated": "string",
; "dateUpdated": "string",
; "description": "string",
; "distributions": [
; {
; "amiDistributionConfiguration": {
; "amiTags": {
; "string": "string"
; },
; "description": "string",
; "kmsKeyId": "string",
; "launchPermission": {
; "organizationalUnitArns": [
; "string"
; ],
; "organizationArns": [
; "string"
; ],
; "userGroups": [
; "string"
; ],
; "userIds": [
; "string"
; ]
; },
; "name": "string",
; "targetAccountIds": [
; "string"
; ]
; },
; "containerDistributionConfiguration": {
; "containerTags": [
; "string"
; ],
; "description": "string",
; "targetRepository": {
; "repositoryName": "string",
; "service": "string"
; }
; },
; "fastLaunchConfigurations": [
; {
; "accountId": "string",
; "enabled": boolean,
; "launchTemplate": {
; "launchTemplateId": "string",
; "launchTemplateName": "string",
; "launchTemplateVersion": "string"
; },
; "maxParallelLaunches": number,
; "snapshotConfiguration": {
; "targetResourceCount": number
; }
; }
; ],
; "launchTemplateConfigurations": [
; {
; "accountId": "string",
; "launchTemplateId": "string",
; "setDefaultVersion": boolean
; }
; ],
; "licenseConfigurationArns": [
; "string"
; ],
; "region": "string",
; "s3ExportConfiguration": {
; "diskImageFormat": "string",
; "roleName": "string",
; "s3Bucket": "string",
; "s3Prefix": "string"
; }
; }
; ],
; "name": "string",
; "tags": {
; "string": "string"
; },
; "timeoutMinutes": number
; },
; "requestId": "string"
; }