software.amazon.awssdk.services.paymentcryptography.model.ExportKeyCryptogram Maven / Gradle / Ivy
Show all versions of paymentcryptography Show documentation
/*
* Copyright 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.paymentcryptography.model;
import java.io.Serializable;
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.Function;
import software.amazon.awssdk.annotations.Generated;
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;
/**
*
* Parameter information for key material export using asymmetric RSA wrap and unwrap key exchange method.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ExportKeyCryptogram implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CERTIFICATE_AUTHORITY_PUBLIC_KEY_IDENTIFIER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("CertificateAuthorityPublicKeyIdentifier")
.getter(getter(ExportKeyCryptogram::certificateAuthorityPublicKeyIdentifier))
.setter(setter(Builder::certificateAuthorityPublicKeyIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("CertificateAuthorityPublicKeyIdentifier").build()).build();
private static final SdkField WRAPPING_KEY_CERTIFICATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WrappingKeyCertificate").getter(getter(ExportKeyCryptogram::wrappingKeyCertificate))
.setter(setter(Builder::wrappingKeyCertificate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WrappingKeyCertificate").build())
.build();
private static final SdkField WRAPPING_SPEC_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WrappingSpec").getter(getter(ExportKeyCryptogram::wrappingSpecAsString))
.setter(setter(Builder::wrappingSpec))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WrappingSpec").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
CERTIFICATE_AUTHORITY_PUBLIC_KEY_IDENTIFIER_FIELD, WRAPPING_KEY_CERTIFICATE_FIELD, WRAPPING_SPEC_FIELD));
private static final long serialVersionUID = 1L;
private final String certificateAuthorityPublicKeyIdentifier;
private final String wrappingKeyCertificate;
private final String wrappingSpec;
private ExportKeyCryptogram(BuilderImpl builder) {
this.certificateAuthorityPublicKeyIdentifier = builder.certificateAuthorityPublicKeyIdentifier;
this.wrappingKeyCertificate = builder.wrappingKeyCertificate;
this.wrappingSpec = builder.wrappingSpec;
}
/**
*
* The KeyARN
of the certificate chain that signs the wrapping key certificate during RSA wrap and
* unwrap key export.
*
*
* @return The KeyARN
of the certificate chain that signs the wrapping key certificate during RSA wrap
* and unwrap key export.
*/
public final String certificateAuthorityPublicKeyIdentifier() {
return certificateAuthorityPublicKeyIdentifier;
}
/**
*
* The wrapping key certificate in PEM format (base64 encoded). Amazon Web Services Payment Cryptography uses this
* certificate to wrap the key under export.
*
*
* @return The wrapping key certificate in PEM format (base64 encoded). Amazon Web Services Payment Cryptography
* uses this certificate to wrap the key under export.
*/
public final String wrappingKeyCertificate() {
return wrappingKeyCertificate;
}
/**
*
* The wrapping spec for the key under export.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #wrappingSpec} will
* return {@link WrappingKeySpec#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #wrappingSpecAsString}.
*
*
* @return The wrapping spec for the key under export.
* @see WrappingKeySpec
*/
public final WrappingKeySpec wrappingSpec() {
return WrappingKeySpec.fromValue(wrappingSpec);
}
/**
*
* The wrapping spec for the key under export.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #wrappingSpec} will
* return {@link WrappingKeySpec#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #wrappingSpecAsString}.
*
*
* @return The wrapping spec for the key under export.
* @see WrappingKeySpec
*/
public final String wrappingSpecAsString() {
return wrappingSpec;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(certificateAuthorityPublicKeyIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(wrappingKeyCertificate());
hashCode = 31 * hashCode + Objects.hashCode(wrappingSpecAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ExportKeyCryptogram)) {
return false;
}
ExportKeyCryptogram other = (ExportKeyCryptogram) obj;
return Objects.equals(certificateAuthorityPublicKeyIdentifier(), other.certificateAuthorityPublicKeyIdentifier())
&& Objects.equals(wrappingKeyCertificate(), other.wrappingKeyCertificate())
&& Objects.equals(wrappingSpecAsString(), other.wrappingSpecAsString());
}
/**
* 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 final String toString() {
return ToString.builder("ExportKeyCryptogram")
.add("CertificateAuthorityPublicKeyIdentifier", certificateAuthorityPublicKeyIdentifier())
.add("WrappingKeyCertificate", wrappingKeyCertificate() == null ? null : "*** Sensitive Data Redacted ***")
.add("WrappingSpec", wrappingSpecAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CertificateAuthorityPublicKeyIdentifier":
return Optional.ofNullable(clazz.cast(certificateAuthorityPublicKeyIdentifier()));
case "WrappingKeyCertificate":
return Optional.ofNullable(clazz.cast(wrappingKeyCertificate()));
case "WrappingSpec":
return Optional.ofNullable(clazz.cast(wrappingSpecAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function