software.amazon.awssdk.services.paymentcryptography.model.ImportTr34KeyBlock 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 import using the asymmetric TR-34 key exchange method.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ImportTr34KeyBlock implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CERTIFICATE_AUTHORITY_PUBLIC_KEY_IDENTIFIER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("CertificateAuthorityPublicKeyIdentifier")
.getter(getter(ImportTr34KeyBlock::certificateAuthorityPublicKeyIdentifier))
.setter(setter(Builder::certificateAuthorityPublicKeyIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("CertificateAuthorityPublicKeyIdentifier").build()).build();
private static final SdkField SIGNING_KEY_CERTIFICATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SigningKeyCertificate").getter(getter(ImportTr34KeyBlock::signingKeyCertificate))
.setter(setter(Builder::signingKeyCertificate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SigningKeyCertificate").build())
.build();
private static final SdkField IMPORT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ImportToken").getter(getter(ImportTr34KeyBlock::importToken)).setter(setter(Builder::importToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ImportToken").build()).build();
private static final SdkField WRAPPED_KEY_BLOCK_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WrappedKeyBlock").getter(getter(ImportTr34KeyBlock::wrappedKeyBlock))
.setter(setter(Builder::wrappedKeyBlock))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WrappedKeyBlock").build()).build();
private static final SdkField KEY_BLOCK_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KeyBlockFormat").getter(getter(ImportTr34KeyBlock::keyBlockFormatAsString))
.setter(setter(Builder::keyBlockFormat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyBlockFormat").build()).build();
private static final SdkField RANDOM_NONCE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RandomNonce").getter(getter(ImportTr34KeyBlock::randomNonce)).setter(setter(Builder::randomNonce))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RandomNonce").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
CERTIFICATE_AUTHORITY_PUBLIC_KEY_IDENTIFIER_FIELD, SIGNING_KEY_CERTIFICATE_FIELD, IMPORT_TOKEN_FIELD,
WRAPPED_KEY_BLOCK_FIELD, KEY_BLOCK_FORMAT_FIELD, RANDOM_NONCE_FIELD));
private static final long serialVersionUID = 1L;
private final String certificateAuthorityPublicKeyIdentifier;
private final String signingKeyCertificate;
private final String importToken;
private final String wrappedKeyBlock;
private final String keyBlockFormat;
private final String randomNonce;
private ImportTr34KeyBlock(BuilderImpl builder) {
this.certificateAuthorityPublicKeyIdentifier = builder.certificateAuthorityPublicKeyIdentifier;
this.signingKeyCertificate = builder.signingKeyCertificate;
this.importToken = builder.importToken;
this.wrappedKeyBlock = builder.wrappedKeyBlock;
this.keyBlockFormat = builder.keyBlockFormat;
this.randomNonce = builder.randomNonce;
}
/**
*
* The KeyARN
of the certificate chain that signs the signing key certificate during TR-34 key import.
*
*
* @return The KeyARN
of the certificate chain that signs the signing key certificate during TR-34 key
* import.
*/
public final String certificateAuthorityPublicKeyIdentifier() {
return certificateAuthorityPublicKeyIdentifier;
}
/**
*
* The public key component in PEM certificate format of the private key that signs the KDH TR-34 WrappedKeyBlock.
*
*
* @return The public key component in PEM certificate format of the private key that signs the KDH TR-34
* WrappedKeyBlock.
*/
public final String signingKeyCertificate() {
return signingKeyCertificate;
}
/**
*
* The import token that initiates key import using the asymmetric TR-34 key exchange method into Amazon Web
* Services Payment Cryptography. It expires after 7 days. You can use the same import token to import multiple keys
* to the same service account.
*
*
* @return The import token that initiates key import using the asymmetric TR-34 key exchange method into Amazon Web
* Services Payment Cryptography. It expires after 7 days. You can use the same import token to import
* multiple keys to the same service account.
*/
public final String importToken() {
return importToken;
}
/**
*
* The TR-34 wrapped key block to import.
*
*
* @return The TR-34 wrapped key block to import.
*/
public final String wrappedKeyBlock() {
return wrappedKeyBlock;
}
/**
*
* The key block format to use during key import. The only value allowed is X9_TR34_2012
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #keyBlockFormat}
* will return {@link Tr34KeyBlockFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #keyBlockFormatAsString}.
*
*
* @return The key block format to use during key import. The only value allowed is X9_TR34_2012
.
* @see Tr34KeyBlockFormat
*/
public final Tr34KeyBlockFormat keyBlockFormat() {
return Tr34KeyBlockFormat.fromValue(keyBlockFormat);
}
/**
*
* The key block format to use during key import. The only value allowed is X9_TR34_2012
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #keyBlockFormat}
* will return {@link Tr34KeyBlockFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #keyBlockFormatAsString}.
*
*
* @return The key block format to use during key import. The only value allowed is X9_TR34_2012
.
* @see Tr34KeyBlockFormat
*/
public final String keyBlockFormatAsString() {
return keyBlockFormat;
}
/**
*
* A random number value that is unique to the TR-34 key block generated using 2 pass. The operation will fail, if a
* random nonce value is not provided for a TR-34 key block generated using 2 pass.
*
*
* @return A random number value that is unique to the TR-34 key block generated using 2 pass. The operation will
* fail, if a random nonce value is not provided for a TR-34 key block generated using 2 pass.
*/
public final String randomNonce() {
return randomNonce;
}
@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(signingKeyCertificate());
hashCode = 31 * hashCode + Objects.hashCode(importToken());
hashCode = 31 * hashCode + Objects.hashCode(wrappedKeyBlock());
hashCode = 31 * hashCode + Objects.hashCode(keyBlockFormatAsString());
hashCode = 31 * hashCode + Objects.hashCode(randomNonce());
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 ImportTr34KeyBlock)) {
return false;
}
ImportTr34KeyBlock other = (ImportTr34KeyBlock) obj;
return Objects.equals(certificateAuthorityPublicKeyIdentifier(), other.certificateAuthorityPublicKeyIdentifier())
&& Objects.equals(signingKeyCertificate(), other.signingKeyCertificate())
&& Objects.equals(importToken(), other.importToken())
&& Objects.equals(wrappedKeyBlock(), other.wrappedKeyBlock())
&& Objects.equals(keyBlockFormatAsString(), other.keyBlockFormatAsString())
&& Objects.equals(randomNonce(), other.randomNonce());
}
/**
* 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("ImportTr34KeyBlock")
.add("CertificateAuthorityPublicKeyIdentifier", certificateAuthorityPublicKeyIdentifier())
.add("SigningKeyCertificate", signingKeyCertificate() == null ? null : "*** Sensitive Data Redacted ***")
.add("ImportToken", importToken()).add("WrappedKeyBlock", wrappedKeyBlock())
.add("KeyBlockFormat", keyBlockFormatAsString()).add("RandomNonce", randomNonce()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CertificateAuthorityPublicKeyIdentifier":
return Optional.ofNullable(clazz.cast(certificateAuthorityPublicKeyIdentifier()));
case "SigningKeyCertificate":
return Optional.ofNullable(clazz.cast(signingKeyCertificate()));
case "ImportToken":
return Optional.ofNullable(clazz.cast(importToken()));
case "WrappedKeyBlock":
return Optional.ofNullable(clazz.cast(wrappedKeyBlock()));
case "KeyBlockFormat":
return Optional.ofNullable(clazz.cast(keyBlockFormatAsString()));
case "RandomNonce":
return Optional.ofNullable(clazz.cast(randomNonce()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function