ListCertificateAuthorities 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 = "acm-pca"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)
; URL: https://acm-pca.us-west-2.amazonaws.com/
; Use the same region as specified above.
$bSuccess = $oRest.Connect("acm-pca.us-west-2.amazonaws.com",443,True,True)
If ($bSuccess <> True) Then
ConsoleWrite("ConnectFailReason: " & $oRest.ConnectFailReason & @CRLF)
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
; 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
$oJson = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJson.UpdateInt("MaxResults",123)
$oJson.UpdateString("NextToken","string")
$oJson.UpdateString("ResourceOwner","string")
; The JSON request body created by the above code:
; {
; "MaxResults": number,
; "NextToken": "string",
; "ResourceOwner": "string"
; }
$oRest.AddHeader("Content-Type","application/x-amz-json-1.1")
$oRest.AddHeader("X-Amz-Target","ACMPrivateCA.ListCertificateAuthorities")
$oSbRequestBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$oJson.EmitSb($oSbRequestBody)
$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestSb("POST","/",$oSbRequestBody,$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 $sArn
Local $iCRLSign
Local $iDataEncipherment
Local $iDecipherOnly
Local $iDigitalSignature
Local $iEncipherOnly
Local $iKeyAgreement
Local $iKeyCertSign
Local $iKeyEncipherment
Local $iNonRepudiation
Local $sKeyAlgorithm
Local $sSigningAlgorithm
Local $sCommonName
Local $sCountry
Local $sDistinguishedNameQualifier
Local $sGenerationQualifier
Local $sGivenName
Local $sInitials
Local $sLocality
Local $sOrganization
Local $sOrganizationalUnit
Local $sPseudonym
Local $sSerialNumber
Local $sState
Local $sSurname
Local $sTitle
Local $iCreatedAt
Local $sFailureReason
Local $sKeyStorageSecurityStandard
Local $iLastStateChangeAt
Local $iNotAfter
Local $iNotBefore
Local $sOwnerAccount
Local $iRestorableUntil
Local $sCustomCname
Local $iEnabled
Local $iExpirationInDays
Local $sS3BucketName
Local $sS3ObjectAcl
Local $iOcspConfigurationEnabled
Local $sOcspCustomCname
Local $sSerial
Local $sStatus
Local $sV_Type
Local $iJ
Local $iCount_j
Local $sDirectoryNameCommonName
Local $sDirectoryNameCountry
Local $sDirectoryNameDistinguishedNameQualifier
Local $sDirectoryNameGenerationQualifier
Local $sDirectoryNameGivenName
Local $sDirectoryNameInitials
Local $sDirectoryNameLocality
Local $sDirectoryNameOrganization
Local $sDirectoryNameOrganizationalUnit
Local $sDirectoryNamePseudonym
Local $sDirectoryNameSerialNumber
Local $sDirectoryNameState
Local $sDirectoryNameSurname
Local $sDirectoryNameTitle
Local $sDnsName
Local $sNameAssigner
Local $sPartyName
Local $sIpAddress
Local $sTypeId
Local $sValue
Local $sRegisteredId
Local $sRfc822Name
Local $sUniformResourceIdentifier
Local $sAccessMethodType
Local $sCustomObjectIdentifier
Local $sNextToken = $oJResp.StringOf("NextToken")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("CertificateAuthorities")
While $i < $iCount_i
$oJResp.I = $i
$sArn = $oJResp.StringOf("CertificateAuthorities[i].Arn")
$iCRLSign = $oJResp.IntOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.CRLSign")
$iDataEncipherment = $oJResp.IntOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DataEncipherment")
$iDecipherOnly = $oJResp.IntOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DecipherOnly")
$iDigitalSignature = $oJResp.IntOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DigitalSignature")
$iEncipherOnly = $oJResp.IntOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.EncipherOnly")
$iKeyAgreement = $oJResp.IntOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyAgreement")
$iKeyCertSign = $oJResp.IntOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyCertSign")
$iKeyEncipherment = $oJResp.IntOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyEncipherment")
$iNonRepudiation = $oJResp.IntOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.NonRepudiation")
$sKeyAlgorithm = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.KeyAlgorithm")
$sSigningAlgorithm = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.SigningAlgorithm")
$sCommonName = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.CommonName")
$sCountry = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.Country")
$sDistinguishedNameQualifier = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.DistinguishedNameQualifier")
$sGenerationQualifier = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.GenerationQualifier")
$sGivenName = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.GivenName")
$sInitials = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.Initials")
$sLocality = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.Locality")
$sOrganization = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.Organization")
$sOrganizationalUnit = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.OrganizationalUnit")
$sPseudonym = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.Pseudonym")
$sSerialNumber = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.SerialNumber")
$sState = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.State")
$sSurname = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.Surname")
$sTitle = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.Subject.Title")
$iCreatedAt = $oJResp.IntOf("CertificateAuthorities[i].CreatedAt")
$sFailureReason = $oJResp.StringOf("CertificateAuthorities[i].FailureReason")
$sKeyStorageSecurityStandard = $oJResp.StringOf("CertificateAuthorities[i].KeyStorageSecurityStandard")
$iLastStateChangeAt = $oJResp.IntOf("CertificateAuthorities[i].LastStateChangeAt")
$iNotAfter = $oJResp.IntOf("CertificateAuthorities[i].NotAfter")
$iNotBefore = $oJResp.IntOf("CertificateAuthorities[i].NotBefore")
$sOwnerAccount = $oJResp.StringOf("CertificateAuthorities[i].OwnerAccount")
$iRestorableUntil = $oJResp.IntOf("CertificateAuthorities[i].RestorableUntil")
$sCustomCname = $oJResp.StringOf("CertificateAuthorities[i].RevocationConfiguration.CrlConfiguration.CustomCname")
$iEnabled = $oJResp.IntOf("CertificateAuthorities[i].RevocationConfiguration.CrlConfiguration.Enabled")
$iExpirationInDays = $oJResp.IntOf("CertificateAuthorities[i].RevocationConfiguration.CrlConfiguration.ExpirationInDays")
$sS3BucketName = $oJResp.StringOf("CertificateAuthorities[i].RevocationConfiguration.CrlConfiguration.S3BucketName")
$sS3ObjectAcl = $oJResp.StringOf("CertificateAuthorities[i].RevocationConfiguration.CrlConfiguration.S3ObjectAcl")
$iOcspConfigurationEnabled = $oJResp.IntOf("CertificateAuthorities[i].RevocationConfiguration.OcspConfiguration.Enabled")
$sOcspCustomCname = $oJResp.StringOf("CertificateAuthorities[i].RevocationConfiguration.OcspConfiguration.OcspCustomCname")
$sSerial = $oJResp.StringOf("CertificateAuthorities[i].Serial")
$sStatus = $oJResp.StringOf("CertificateAuthorities[i].Status")
$sV_Type = $oJResp.StringOf("CertificateAuthorities[i].Type")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sDirectoryNameCommonName = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.CommonName")
$sDirectoryNameCountry = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.Country")
$sDirectoryNameDistinguishedNameQualifier = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.DistinguishedNameQualifier")
$sDirectoryNameGenerationQualifier = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.GenerationQualifier")
$sDirectoryNameGivenName = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.GivenName")
$sDirectoryNameInitials = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.Initials")
$sDirectoryNameLocality = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.Locality")
$sDirectoryNameOrganization = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.Organization")
$sDirectoryNameOrganizationalUnit = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.OrganizationalUnit")
$sDirectoryNamePseudonym = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.Pseudonym")
$sDirectoryNameSerialNumber = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.SerialNumber")
$sDirectoryNameState = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.State")
$sDirectoryNameSurname = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.Surname")
$sDirectoryNameTitle = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DirectoryName.Title")
$sDnsName = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.DnsName")
$sNameAssigner = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.EdiPartyName.NameAssigner")
$sPartyName = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.EdiPartyName.PartyName")
$sIpAddress = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.IpAddress")
$sTypeId = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.OtherName.TypeId")
$sValue = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.OtherName.Value")
$sRegisteredId = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.RegisteredId")
$sRfc822Name = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.Rfc822Name")
$sUniformResourceIdentifier = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessLocation.UniformResourceIdentifier")
$sAccessMethodType = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessMethod.AccessMethodType")
$sCustomObjectIdentifier = $oJResp.StringOf("CertificateAuthorities[i].CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[j].AccessMethod.CustomObjectIdentifier")
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
; A sample JSON response body parsed by the above code:
; {
; "CertificateAuthorities": [
; {
; "Arn": "string",
; "CertificateAuthorityConfiguration": {
; "CsrExtensions": {
; "KeyUsage": {
; "CRLSign": boolean,
; "DataEncipherment": boolean,
; "DecipherOnly": boolean,
; "DigitalSignature": boolean,
; "EncipherOnly": boolean,
; "KeyAgreement": boolean,
; "KeyCertSign": boolean,
; "KeyEncipherment": boolean,
; "NonRepudiation": boolean
; },
; "SubjectInformationAccess": [
; {
; "AccessLocation": {
; "DirectoryName": {
; "CommonName": "string",
; "Country": "string",
; "DistinguishedNameQualifier": "string",
; "GenerationQualifier": "string",
; "GivenName": "string",
; "Initials": "string",
; "Locality": "string",
; "Organization": "string",
; "OrganizationalUnit": "string",
; "Pseudonym": "string",
; "SerialNumber": "string",
; "State": "string",
; "Surname": "string",
; "Title": "string"
; },
; "DnsName": "string",
; "EdiPartyName": {
; "NameAssigner": "string",
; "PartyName": "string"
; },
; "IpAddress": "string",
; "OtherName": {
; "TypeId": "string",
; "Value": "string"
; },
; "RegisteredId": "string",
; "Rfc822Name": "string",
; "UniformResourceIdentifier": "string"
; },
; "AccessMethod": {
; "AccessMethodType": "string",
; "CustomObjectIdentifier": "string"
; }
; }
; ]
; },
; "KeyAlgorithm": "string",
; "SigningAlgorithm": "string",
; "Subject": {
; "CommonName": "string",
; "Country": "string",
; "DistinguishedNameQualifier": "string",
; "GenerationQualifier": "string",
; "GivenName": "string",
; "Initials": "string",
; "Locality": "string",
; "Organization": "string",
; "OrganizationalUnit": "string",
; "Pseudonym": "string",
; "SerialNumber": "string",
; "State": "string",
; "Surname": "string",
; "Title": "string"
; }
; },
; "CreatedAt": number,
; "FailureReason": "string",
; "KeyStorageSecurityStandard": "string",
; "LastStateChangeAt": number,
; "NotAfter": number,
; "NotBefore": number,
; "OwnerAccount": "string",
; "RestorableUntil": number,
; "RevocationConfiguration": {
; "CrlConfiguration": {
; "CustomCname": "string",
; "Enabled": boolean,
; "ExpirationInDays": number,
; "S3BucketName": "string",
; "S3ObjectAcl": "string"
; },
; "OcspConfiguration": {
; "Enabled": boolean,
; "OcspCustomCname": "string"
; }
; },
; "Serial": "string",
; "Status": "string",
; "Type": "string"
; }
; ],
; "NextToken": "string"
; }