DescribeCertificateAuthority 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("acm-pca")
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
rest.SetAuthAws(authAws)
// URL: https://acm-pca.us-west-2.amazonaws.com/
// Use the same region as specified above.
success = rest.Connect("acm-pca.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("CertificateAuthorityArn","string")
// The JSON request body created by the above code:
// {
// "CertificateAuthorityArn": "string"
// }
rest.AddHeader("Content-Type","application/x-amz-json-1.1")
rest.AddHeader("X-Amz-Target","ACMPrivateCA.DescribeCertificateAuthority")
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
DirectoryNameCommonName_DECLARATION
DirectoryNameCountry_DECLARATION
DirectoryNameDistinguishedNameQualifier_DECLARATION
DirectoryNameGenerationQualifier_DECLARATION
DirectoryNameGivenName_DECLARATION
DirectoryNameInitials_DECLARATION
DirectoryNameLocality_DECLARATION
DirectoryNameOrganization_DECLARATION
DirectoryNameOrganizationalUnit_DECLARATION
DirectoryNamePseudonym_DECLARATION
DirectoryNameSerialNumber_DECLARATION
DirectoryNameState_DECLARATION
DirectoryNameSurname_DECLARATION
DirectoryNameTitle_DECLARATION
DnsName_DECLARATION
NameAssigner_DECLARATION
PartyName_DECLARATION
IpAddress_DECLARATION
TypeId_DECLARATION
Value_DECLARATION
RegisteredId_DECLARATION
Rfc822Name_DECLARATION
UniformResourceIdentifier_DECLARATION
AccessMethodType_DECLARATION
CustomObjectIdentifier_DECLARATION
Arn := jResp.StringOf("CertificateAuthority.Arn")
CRLSign := jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.CRLSign")
DataEncipherment := jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DataEncipherment")
DecipherOnly := jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DecipherOnly")
DigitalSignature := jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DigitalSignature")
EncipherOnly := jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.EncipherOnly")
KeyAgreement := jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyAgreement")
KeyCertSign := jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyCertSign")
KeyEncipherment := jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyEncipherment")
NonRepudiation := jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.NonRepudiation")
KeyAlgorithm := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.KeyAlgorithm")
SigningAlgorithm := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.SigningAlgorithm")
CommonName := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.CommonName")
Country := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Country")
DistinguishedNameQualifier := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.DistinguishedNameQualifier")
GenerationQualifier := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.GenerationQualifier")
GivenName := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.GivenName")
Initials := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Initials")
Locality := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Locality")
Organization := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Organization")
OrganizationalUnit := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.OrganizationalUnit")
Pseudonym := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Pseudonym")
SerialNumber := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.SerialNumber")
State := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.State")
Surname := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Surname")
Title := jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Title")
CreatedAt := jResp.IntOf("CertificateAuthority.CreatedAt")
FailureReason := jResp.StringOf("CertificateAuthority.FailureReason")
KeyStorageSecurityStandard := jResp.StringOf("CertificateAuthority.KeyStorageSecurityStandard")
LastStateChangeAt := jResp.IntOf("CertificateAuthority.LastStateChangeAt")
NotAfter := jResp.IntOf("CertificateAuthority.NotAfter")
NotBefore := jResp.IntOf("CertificateAuthority.NotBefore")
OwnerAccount := jResp.StringOf("CertificateAuthority.OwnerAccount")
RestorableUntil := jResp.IntOf("CertificateAuthority.RestorableUntil")
CustomCname := jResp.StringOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.CustomCname")
Enabled := jResp.IntOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.Enabled")
ExpirationInDays := jResp.IntOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.ExpirationInDays")
S3BucketName := jResp.StringOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.S3BucketName")
S3ObjectAcl := jResp.StringOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.S3ObjectAcl")
OcspConfigurationEnabled := jResp.IntOf("CertificateAuthority.RevocationConfiguration.OcspConfiguration.Enabled")
OcspCustomCname := jResp.StringOf("CertificateAuthority.RevocationConfiguration.OcspConfiguration.OcspCustomCname")
Serial := jResp.StringOf("CertificateAuthority.Serial")
Status := jResp.StringOf("CertificateAuthority.Status")
v_Type := jResp.StringOf("CertificateAuthority.Type")
i := 0
count_i := jResp.SizeOfArray("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess")
for i < count_i {
jResp.SetI(i)
DirectoryNameCommonName = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.CommonName")
DirectoryNameCountry = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Country")
DirectoryNameDistinguishedNameQualifier = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.DistinguishedNameQualifier")
DirectoryNameGenerationQualifier = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.GenerationQualifier")
DirectoryNameGivenName = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.GivenName")
DirectoryNameInitials = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Initials")
DirectoryNameLocality = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Locality")
DirectoryNameOrganization = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Organization")
DirectoryNameOrganizationalUnit = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.OrganizationalUnit")
DirectoryNamePseudonym = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Pseudonym")
DirectoryNameSerialNumber = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.SerialNumber")
DirectoryNameState = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.State")
DirectoryNameSurname = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Surname")
DirectoryNameTitle = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Title")
DnsName = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DnsName")
NameAssigner = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.EdiPartyName.NameAssigner")
PartyName = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.EdiPartyName.PartyName")
IpAddress = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.IpAddress")
TypeId = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.OtherName.TypeId")
Value = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.OtherName.Value")
RegisteredId = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.RegisteredId")
Rfc822Name = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.Rfc822Name")
UniformResourceIdentifier = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.UniformResourceIdentifier")
AccessMethodType = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessMethod.AccessMethodType")
CustomObjectIdentifier = *jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessMethod.CustomObjectIdentifier")
i = i + 1
}
// 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"
// }
// }
rest.DisposeRest()
authAws.DisposeAuthAws()
json.DisposeJsonObject()
sbRequestBody.DisposeStringBuilder()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()