All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.acmpca.model.RevokeCertificateRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for ACM PCA module holds the client classes that are used for communicating with ACM PCA.

There is a newer version: 2.28.4
Show newest version
/*
 * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.acmpca.model;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class RevokeCertificateRequest extends AcmPcaRequest implements
        ToCopyableBuilder {
    private static final SdkField CERTIFICATE_AUTHORITY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(RevokeCertificateRequest::certificateAuthorityArn)).setter(setter(Builder::certificateAuthorityArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateAuthorityArn").build())
            .build();

    private static final SdkField CERTIFICATE_SERIAL_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(RevokeCertificateRequest::certificateSerial)).setter(setter(Builder::certificateSerial))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateSerial").build()).build();

    private static final SdkField REVOCATION_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(RevokeCertificateRequest::revocationReasonAsString)).setter(setter(Builder::revocationReason))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RevocationReason").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
            CERTIFICATE_AUTHORITY_ARN_FIELD, CERTIFICATE_SERIAL_FIELD, REVOCATION_REASON_FIELD));

    private final String certificateAuthorityArn;

    private final String certificateSerial;

    private final String revocationReason;

    private RevokeCertificateRequest(BuilderImpl builder) {
        super(builder);
        this.certificateAuthorityArn = builder.certificateAuthorityArn;
        this.certificateSerial = builder.certificateSerial;
        this.revocationReason = builder.revocationReason;
    }

    /**
     * 

* Amazon Resource Name (ARN) of the private CA that issued the certificate to be revoked. This must be of the form: *

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 *

* * @return Amazon Resource Name (ARN) of the private CA that issued the certificate to be revoked. This must be of * the form:

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 */ public String certificateAuthorityArn() { return certificateAuthorityArn; } /** *

* Serial number of the certificate to be revoked. This must be in hexadecimal format. You can retrieve the serial * number by calling GetCertificate with the Amazon Resource Name (ARN) of the certificate you want and the * ARN of your private CA. The GetCertificate operation retrieves the certificate in the PEM format. You can * use the following OpenSSL command to list the certificate in text format and copy the hexadecimal serial number. *

*

* openssl x509 -in file_path -text -noout *

*

* You can also copy the serial number from the console or use the DescribeCertificate * operation in the AWS Certificate Manager API Reference. *

* * @return Serial number of the certificate to be revoked. This must be in hexadecimal format. You can retrieve the * serial number by calling GetCertificate with the Amazon Resource Name (ARN) of the certificate you * want and the ARN of your private CA. The GetCertificate operation retrieves the certificate in the * PEM format. You can use the following OpenSSL command to list the certificate in text format and copy the * hexadecimal serial number.

*

* openssl x509 -in file_path -text -noout *

*

* You can also copy the serial number from the console or use the DescribeCertificate operation in the AWS Certificate Manager API Reference. */ public String certificateSerial() { return certificateSerial; } /** *

* Specifies why you revoked the certificate. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #revocationReason} * will return {@link RevocationReason#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #revocationReasonAsString}. *

* * @return Specifies why you revoked the certificate. * @see RevocationReason */ public RevocationReason revocationReason() { return RevocationReason.fromValue(revocationReason); } /** *

* Specifies why you revoked the certificate. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #revocationReason} * will return {@link RevocationReason#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #revocationReasonAsString}. *

* * @return Specifies why you revoked the certificate. * @see RevocationReason */ public String revocationReasonAsString() { return revocationReason; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(certificateAuthorityArn()); hashCode = 31 * hashCode + Objects.hashCode(certificateSerial()); hashCode = 31 * hashCode + Objects.hashCode(revocationReasonAsString()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof RevokeCertificateRequest)) { return false; } RevokeCertificateRequest other = (RevokeCertificateRequest) obj; return Objects.equals(certificateAuthorityArn(), other.certificateAuthorityArn()) && Objects.equals(certificateSerial(), other.certificateSerial()) && Objects.equals(revocationReasonAsString(), other.revocationReasonAsString()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("RevokeCertificateRequest").add("CertificateAuthorityArn", certificateAuthorityArn()) .add("CertificateSerial", certificateSerial()).add("RevocationReason", revocationReasonAsString()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "CertificateAuthorityArn": return Optional.ofNullable(clazz.cast(certificateAuthorityArn())); case "CertificateSerial": return Optional.ofNullable(clazz.cast(certificateSerial())); case "RevocationReason": return Optional.ofNullable(clazz.cast(revocationReasonAsString())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((RevokeCertificateRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends AcmPcaRequest.Builder, SdkPojo, CopyableBuilder { /** *

* Amazon Resource Name (ARN) of the private CA that issued the certificate to be revoked. This must be of the * form: *

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 *

* * @param certificateAuthorityArn * Amazon Resource Name (ARN) of the private CA that issued the certificate to be revoked. This must be * of the form:

*

* arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 * @return Returns a reference to this object so that method calls can be chained together. */ Builder certificateAuthorityArn(String certificateAuthorityArn); /** *

* Serial number of the certificate to be revoked. This must be in hexadecimal format. You can retrieve the * serial number by calling GetCertificate with the Amazon Resource Name (ARN) of the certificate you * want and the ARN of your private CA. The GetCertificate operation retrieves the certificate in the PEM * format. You can use the following OpenSSL command to list the certificate in text format and copy the * hexadecimal serial number. *

*

* openssl x509 -in file_path -text -noout *

*

* You can also copy the serial number from the console or use the DescribeCertificate operation in the AWS Certificate Manager API Reference. *

* * @param certificateSerial * Serial number of the certificate to be revoked. This must be in hexadecimal format. You can retrieve * the serial number by calling GetCertificate with the Amazon Resource Name (ARN) of the * certificate you want and the ARN of your private CA. The GetCertificate operation retrieves the * certificate in the PEM format. You can use the following OpenSSL command to list the certificate in * text format and copy the hexadecimal serial number.

*

* openssl x509 -in file_path -text -noout *

*

* You can also copy the serial number from the console or use the DescribeCertificate operation in the AWS Certificate Manager API Reference. * @return Returns a reference to this object so that method calls can be chained together. */ Builder certificateSerial(String certificateSerial); /** *

* Specifies why you revoked the certificate. *

* * @param revocationReason * Specifies why you revoked the certificate. * @see RevocationReason * @return Returns a reference to this object so that method calls can be chained together. * @see RevocationReason */ Builder revocationReason(String revocationReason); /** *

* Specifies why you revoked the certificate. *

* * @param revocationReason * Specifies why you revoked the certificate. * @see RevocationReason * @return Returns a reference to this object so that method calls can be chained together. * @see RevocationReason */ Builder revocationReason(RevocationReason revocationReason); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends AcmPcaRequest.BuilderImpl implements Builder { private String certificateAuthorityArn; private String certificateSerial; private String revocationReason; private BuilderImpl() { } private BuilderImpl(RevokeCertificateRequest model) { super(model); certificateAuthorityArn(model.certificateAuthorityArn); certificateSerial(model.certificateSerial); revocationReason(model.revocationReason); } public final String getCertificateAuthorityArn() { return certificateAuthorityArn; } @Override public final Builder certificateAuthorityArn(String certificateAuthorityArn) { this.certificateAuthorityArn = certificateAuthorityArn; return this; } public final void setCertificateAuthorityArn(String certificateAuthorityArn) { this.certificateAuthorityArn = certificateAuthorityArn; } public final String getCertificateSerial() { return certificateSerial; } @Override public final Builder certificateSerial(String certificateSerial) { this.certificateSerial = certificateSerial; return this; } public final void setCertificateSerial(String certificateSerial) { this.certificateSerial = certificateSerial; } public final String getRevocationReasonAsString() { return revocationReason; } @Override public final Builder revocationReason(String revocationReason) { this.revocationReason = revocationReason; return this; } @Override public final Builder revocationReason(RevocationReason revocationReason) { this.revocationReason(revocationReason.toString()); return this; } public final void setRevocationReason(String revocationReason) { this.revocationReason = revocationReason; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public RevokeCertificateRequest build() { return new RevokeCertificateRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy