AWS Certificate Manager Private Certificate Authority
User Guide (Version latest)


The following Java sample shows how to use the UntagCertificateAuthority function.

This function removes one or more tags from your private CA. A tag consists of a key-value pair. If you do not specify the value portion of the tag when calling this function, the tag will be removed regardless of value. If you specify a value, the tag is removed only if it is associated with the specified value. To add tags to a private CA, use the TagCertificateAuthority function. Call the ListTags function to see what tags are associated with your CA.

package com.amazonaws.samples; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; import com.amazonaws.auth.AWSStaticCredentialsProvider; import java.util.ArrayList; import; import; import; import; import com.amazonaws.AmazonClientException; import; import; import; public class UntagCertificateAuthority { public static void main(String[] args) throws Exception { // Retrieve your credentials from the C:\Users\name\.aws\credentials file // in Windows or the .aws/credentials file in Linux. AWSCredentials credentials = null; try{ credentials = new ProfileCredentialsProvider("default").getCredentials(); } catch (Exception e) { throw new AmazonClientException("Cannot load your credentials from disk", e); } // Define the endpoint for your sample. String endpointProtocol = ""; String endpointRegion = "region"; EndpointConfiguration endpoint = new AwsClientBuilder.EndpointConfiguration(endpointProtocol, endpointRegion); // Create a client that you can use to make requests. AWSACMPCA client = AWSACMPCAClientBuilder.standard() .withEndpointConfiguration(endpoint) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); // Create a Tag object with the tag to delete. Tag tag = new Tag(); tag.withKey("Administrator"); tag.withValue("Bob"); // Add the tags to a collection. ArrayList<Tag> tags = new ArrayList<Tag>(); tags.add(tag); tags.add(tag); // Create a request object and specify the ARN of the certificate. UntagCertificateAuthorityRequest req = new UntagCertificateAuthorityRequest(); req.withCertificateAuthorityArn("arn:aws:acm-pca:region:account:" + "certificate-authority/12345678-1234-1234-1234-123456789012"); req.withTags(tags); // Delete the tag try{ client.untagCertificateAuthority(req); } catch (InvalidArnException ex) { throw ex; } catch(ResourceNotFoundException ex) { throw ex; } catch (InvalidTagException ex) { throw ex; } } }