AutoIt
AutoIt
Glacier Get Job Information and Status
See more Amazon Glacier Examples
Demonstrates how to get information and status for a glacier job.Chilkat AutoIt Downloads
Local $bSuccess = False
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oRest = ObjCreate("Chilkat.Rest")
; Connect to the Amazon AWS REST server in the desired region.
Local $bTls = True
Local $iPort = 443
Local $bAutoReconnect = True
$bSuccess = $oRest.Connect("glacier.us-west-2.amazonaws.com",$iPort,$bTls,$bAutoReconnect)
; Provide AWS credentials.
$oAuthAws = ObjCreate("Chilkat.AuthAws")
$oAuthAws.AccessKey = "AWS_ACCESS_KEY"
$oAuthAws.SecretKey = "AWS_SECRET_KEY"
$oAuthAws.ServiceName = "glacier"
$oAuthAws.Region = "us-west-2"
$bSuccess = $oRest.SetAuthAws($oAuthAws)
; --------------------------------------------------------------------------
; Note: The above REST connection and setup of the AWS credentials
; can be done once. After connecting, any number of REST calls can be made.
; The "auto reconnect" property passed to rest.Connect indicates that if
; the connection is lost, a REST method call will automatically reconnect
; if needed.
; --------------------------------------------------------------------------
;
; For more information, see Glacier Describe Job Reference Documentation
;
$oRest.AddHeader("x-amz-glacier-version","2012-06-01")
$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/AWS_ACCOUNT_ID/vaults/chilkat/jobs/JOB_ID",$oSbResponseBody)
If ($bSuccess <> True) Then
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
Local $iRespStatusCode = $oRest.ResponseStatusCode
If ($iRespStatusCode >= 400) Then
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oRest.ResponseHeader & @CRLF)
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oSbResponseBody.GetAsString() & @CRLF)
Exit
EndIf
; Success is indicated by a 200 response status.
ConsoleWrite("response status code = " & $iRespStatusCode & @CRLF)
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.LoadSb($oSbResponseBody)
$oJson.EmitCompact = False
ConsoleWrite($oJson.Emit() & @CRLF)
; Sample output:
; Use this online tool to generate parsing code from sample JSON:
; Generate Parsing Code from JSON
; {
; "Action": "InventoryRetrieval",
; "ArchiveId": null,
; "ArchiveSHA256TreeHash": null,
; "ArchiveSizeInBytes": null,
; "Completed": false,
; "CompletionDate": null,
; "CreationDate": "2019-04-09T22:48:48.700Z",
; "InventoryRetrievalParameters": {
; "EndDate": null,
; "Format": "CSV",
; "Limit": null,
; "Marker": null,
; "StartDate": null
; },
; "InventorySizeInBytes": null,
; "JobDescription": "My inventory job",
; "JobId": "E-mCnb3j122yvz5PRFGzETmFVXVrkX_pgI8PIuwBKNRyI8pAJqIetKwzkJC5a6blIvYZrrVohiBENQVhZE1a-K-x-uRO",
; "JobOutputPath": null,
; "OutputLocation": null,
; "RetrievalByteRange": null,
; "SHA256TreeHash": null,
; "SNSTopic": null,
; "SelectParameters": null,
; "StatusCode": "InProgress",
; "StatusMessage": null,
; "Tier": null,
; "VaultARN": "arn:aws:glacier:us-west-2:954491834127:vaults/chilkat"
; }
;
Local $sAction
Local $sArchiveId
Local $sArchiveSHA256TreeHash
Local $sArchiveSizeInBytes
Local $bCompleted
Local $sCompletionDate
Local $sCreationDate
Local $sInventoryRetrievalParametersEndDate
Local $sInventoryRetrievalParametersFormat
Local $sInventoryRetrievalParametersLimit
Local $sInventoryRetrievalParametersMarker
Local $sInventoryRetrievalParametersStartDate
Local $sInventorySizeInBytes
Local $sJobDescription
Local $sJobId
Local $sJobOutputPath
Local $sOutputLocation
Local $sRetrievalByteRange
Local $sSHA256TreeHash
Local $sSNSTopic
Local $sSelectParameters
Local $sStatusCode
Local $sStatusMessage
Local $sTier
Local $sVaultARN
$sAction = $oJson.StringOf("Action")
$sArchiveId = $oJson.StringOf("ArchiveId")
$sArchiveSHA256TreeHash = $oJson.StringOf("ArchiveSHA256TreeHash")
$sArchiveSizeInBytes = $oJson.StringOf("ArchiveSizeInBytes")
$bCompleted = $oJson.BoolOf("Completed")
$sCompletionDate = $oJson.StringOf("CompletionDate")
$sCreationDate = $oJson.StringOf("CreationDate")
$sInventoryRetrievalParametersEndDate = $oJson.StringOf("InventoryRetrievalParameters.EndDate")
$sInventoryRetrievalParametersFormat = $oJson.StringOf("InventoryRetrievalParameters.Format")
$sInventoryRetrievalParametersLimit = $oJson.StringOf("InventoryRetrievalParameters.Limit")
$sInventoryRetrievalParametersMarker = $oJson.StringOf("InventoryRetrievalParameters.Marker")
$sInventoryRetrievalParametersStartDate = $oJson.StringOf("InventoryRetrievalParameters.StartDate")
$sInventorySizeInBytes = $oJson.StringOf("InventorySizeInBytes")
$sJobDescription = $oJson.StringOf("JobDescription")
$sJobId = $oJson.StringOf("JobId")
$sJobOutputPath = $oJson.StringOf("JobOutputPath")
$sOutputLocation = $oJson.StringOf("OutputLocation")
$sRetrievalByteRange = $oJson.StringOf("RetrievalByteRange")
$sSHA256TreeHash = $oJson.StringOf("SHA256TreeHash")
$sSNSTopic = $oJson.StringOf("SNSTopic")
$sSelectParameters = $oJson.StringOf("SelectParameters")
$sStatusCode = $oJson.StringOf("StatusCode")
$sStatusMessage = $oJson.StringOf("StatusMessage")
$sTier = $oJson.StringOf("Tier")
$sVaultARN = $oJson.StringOf("VaultARN")