DescribeCertificateAuthority PowerBuilder Example
integer li_rc
oleobject loo_Rest
integer li_Success
oleobject loo_AuthAws
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_SbResponseBody
integer li_RespStatusCode
oleobject loo_JResp
string ls_DirectoryNameCommonName
string ls_DirectoryNameCountry
string ls_DirectoryNameDistinguishedNameQualifier
string ls_DirectoryNameGenerationQualifier
string ls_DirectoryNameGivenName
string ls_DirectoryNameInitials
string ls_DirectoryNameLocality
string ls_DirectoryNameOrganization
string ls_DirectoryNameOrganizationalUnit
string ls_DirectoryNamePseudonym
string ls_DirectoryNameSerialNumber
string ls_DirectoryNameState
string ls_DirectoryNameSurname
string ls_DirectoryNameTitle
string ls_DnsName
string ls_NameAssigner
string ls_PartyName
string ls_IpAddress
string ls_TypeId
string ls_Value
string ls_RegisteredId
string ls_Rfc822Name
string ls_UniformResourceIdentifier
string ls_AccessMethodType
string ls_CustomObjectIdentifier
string ls_Arn
integer li_CRLSign
integer li_DataEncipherment
integer li_DecipherOnly
integer li_DigitalSignature
integer li_EncipherOnly
integer li_KeyAgreement
integer li_KeyCertSign
integer li_KeyEncipherment
integer li_NonRepudiation
string ls_KeyAlgorithm
string ls_SigningAlgorithm
string ls_CommonName
string ls_Country
string ls_DistinguishedNameQualifier
string ls_GenerationQualifier
string ls_GivenName
string ls_Initials
string ls_Locality
string ls_Organization
string ls_OrganizationalUnit
string ls_Pseudonym
string ls_SerialNumber
string ls_State
string ls_Surname
string ls_Title
integer li_CreatedAt
string ls_FailureReason
string ls_KeyStorageSecurityStandard
integer li_LastStateChangeAt
integer li_NotAfter
integer li_NotBefore
string ls_OwnerAccount
integer li_RestorableUntil
string ls_CustomCname
integer li_Enabled
integer li_ExpirationInDays
string ls_S3BucketName
string ls_S3ObjectAcl
integer li_OcspConfigurationEnabled
string ls_OcspCustomCname
string ls_Serial
string ls_Status
string ls_V_Type
integer i
integer li_Count_i
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_AuthAws = create oleobject
li_rc = loo_AuthAws.ConnectToNewObject("Chilkat_9_5_0.AuthAws")
loo_AuthAws.AccessKey = "AWS_ACCESS_KEY"
loo_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.)
loo_AuthAws.Region = "us-west-2"
loo_AuthAws.ServiceName = "acm-pca"
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
loo_Rest.SetAuthAws(loo_AuthAws)
// URL: https://acm-pca.us-west-2.amazonaws.com/
// Use the same region as specified above.
li_Success = loo_Rest.Connect("acm-pca.us-west-2.amazonaws.com",443,1,1)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_AuthAws
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
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_Json.UpdateString("CertificateAuthorityArn","string")
// The JSON request body created by the above code:
// {
// "CertificateAuthorityArn": "string"
// }
loo_Rest.AddHeader("Content-Type","application/x-amz-json-1.1")
loo_Rest.AddHeader("X-Amz-Target","ACMPrivateCA.DescribeCertificateAuthority")
loo_SbRequestBody = create oleobject
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Rest.FullRequestSb("POST","/",loo_SbRequestBody,loo_SbResponseBody)
if li_Success <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_AuthAws
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
li_RespStatusCode = loo_Rest.ResponseStatusCode
Write-Debug "response status code = " + string(li_RespStatusCode)
if li_RespStatusCode <> 200 then
Write-Debug "Response Header:"
Write-Debug loo_Rest.ResponseHeader
Write-Debug "Response Body:"
Write-Debug loo_SbResponseBody.GetAsString()
destroy loo_Rest
destroy loo_AuthAws
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_JResp.LoadSb(loo_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
ls_Arn = loo_JResp.StringOf("CertificateAuthority.Arn")
li_CRLSign = loo_JResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.CRLSign")
li_DataEncipherment = loo_JResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DataEncipherment")
li_DecipherOnly = loo_JResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DecipherOnly")
li_DigitalSignature = loo_JResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DigitalSignature")
li_EncipherOnly = loo_JResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.EncipherOnly")
li_KeyAgreement = loo_JResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyAgreement")
li_KeyCertSign = loo_JResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyCertSign")
li_KeyEncipherment = loo_JResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyEncipherment")
li_NonRepudiation = loo_JResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.NonRepudiation")
ls_KeyAlgorithm = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.KeyAlgorithm")
ls_SigningAlgorithm = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.SigningAlgorithm")
ls_CommonName = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.CommonName")
ls_Country = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Country")
ls_DistinguishedNameQualifier = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.DistinguishedNameQualifier")
ls_GenerationQualifier = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.GenerationQualifier")
ls_GivenName = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.GivenName")
ls_Initials = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Initials")
ls_Locality = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Locality")
ls_Organization = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Organization")
ls_OrganizationalUnit = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.OrganizationalUnit")
ls_Pseudonym = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Pseudonym")
ls_SerialNumber = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.SerialNumber")
ls_State = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.State")
ls_Surname = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Surname")
ls_Title = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Title")
li_CreatedAt = loo_JResp.IntOf("CertificateAuthority.CreatedAt")
ls_FailureReason = loo_JResp.StringOf("CertificateAuthority.FailureReason")
ls_KeyStorageSecurityStandard = loo_JResp.StringOf("CertificateAuthority.KeyStorageSecurityStandard")
li_LastStateChangeAt = loo_JResp.IntOf("CertificateAuthority.LastStateChangeAt")
li_NotAfter = loo_JResp.IntOf("CertificateAuthority.NotAfter")
li_NotBefore = loo_JResp.IntOf("CertificateAuthority.NotBefore")
ls_OwnerAccount = loo_JResp.StringOf("CertificateAuthority.OwnerAccount")
li_RestorableUntil = loo_JResp.IntOf("CertificateAuthority.RestorableUntil")
ls_CustomCname = loo_JResp.StringOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.CustomCname")
li_Enabled = loo_JResp.IntOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.Enabled")
li_ExpirationInDays = loo_JResp.IntOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.ExpirationInDays")
ls_S3BucketName = loo_JResp.StringOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.S3BucketName")
ls_S3ObjectAcl = loo_JResp.StringOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.S3ObjectAcl")
li_OcspConfigurationEnabled = loo_JResp.IntOf("CertificateAuthority.RevocationConfiguration.OcspConfiguration.Enabled")
ls_OcspCustomCname = loo_JResp.StringOf("CertificateAuthority.RevocationConfiguration.OcspConfiguration.OcspCustomCname")
ls_Serial = loo_JResp.StringOf("CertificateAuthority.Serial")
ls_Status = loo_JResp.StringOf("CertificateAuthority.Status")
ls_V_Type = loo_JResp.StringOf("CertificateAuthority.Type")
i = 0
li_Count_i = loo_JResp.SizeOfArray("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess")
do while i < li_Count_i
loo_JResp.I = i
ls_DirectoryNameCommonName = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.CommonName")
ls_DirectoryNameCountry = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Country")
ls_DirectoryNameDistinguishedNameQualifier = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.DistinguishedNameQualifier")
ls_DirectoryNameGenerationQualifier = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.GenerationQualifier")
ls_DirectoryNameGivenName = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.GivenName")
ls_DirectoryNameInitials = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Initials")
ls_DirectoryNameLocality = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Locality")
ls_DirectoryNameOrganization = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Organization")
ls_DirectoryNameOrganizationalUnit = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.OrganizationalUnit")
ls_DirectoryNamePseudonym = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Pseudonym")
ls_DirectoryNameSerialNumber = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.SerialNumber")
ls_DirectoryNameState = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.State")
ls_DirectoryNameSurname = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Surname")
ls_DirectoryNameTitle = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Title")
ls_DnsName = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DnsName")
ls_NameAssigner = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.EdiPartyName.NameAssigner")
ls_PartyName = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.EdiPartyName.PartyName")
ls_IpAddress = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.IpAddress")
ls_TypeId = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.OtherName.TypeId")
ls_Value = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.OtherName.Value")
ls_RegisteredId = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.RegisteredId")
ls_Rfc822Name = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.Rfc822Name")
ls_UniformResourceIdentifier = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.UniformResourceIdentifier")
ls_AccessMethodType = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessMethod.AccessMethodType")
ls_CustomObjectIdentifier = loo_JResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessMethod.CustomObjectIdentifier")
i = i + 1
loop
// A sample JSON response body parsed by the above code:
// {
// "CertificateAuthority": {
// "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"
// }
// }
destroy loo_Rest
destroy loo_AuthAws
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp