software.amazon.awssdk.services.paymentcryptography.model.GetParametersForExportResponse 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.time.Instant;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetParametersForExportResponse extends PaymentCryptographyResponse implements
ToCopyableBuilder {
private static final SdkField SIGNING_KEY_CERTIFICATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SigningKeyCertificate").getter(getter(GetParametersForExportResponse::signingKeyCertificate))
.setter(setter(Builder::signingKeyCertificate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SigningKeyCertificate").build())
.build();
private static final SdkField SIGNING_KEY_CERTIFICATE_CHAIN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("SigningKeyCertificateChain")
.getter(getter(GetParametersForExportResponse::signingKeyCertificateChain))
.setter(setter(Builder::signingKeyCertificateChain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SigningKeyCertificateChain").build())
.build();
private static final SdkField SIGNING_KEY_ALGORITHM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SigningKeyAlgorithm").getter(getter(GetParametersForExportResponse::signingKeyAlgorithmAsString))
.setter(setter(Builder::signingKeyAlgorithm))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SigningKeyAlgorithm").build())
.build();
private static final SdkField EXPORT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ExportToken").getter(getter(GetParametersForExportResponse::exportToken))
.setter(setter(Builder::exportToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExportToken").build()).build();
private static final SdkField PARAMETERS_VALID_UNTIL_TIMESTAMP_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("ParametersValidUntilTimestamp")
.getter(getter(GetParametersForExportResponse::parametersValidUntilTimestamp))
.setter(setter(Builder::parametersValidUntilTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParametersValidUntilTimestamp")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SIGNING_KEY_CERTIFICATE_FIELD,
SIGNING_KEY_CERTIFICATE_CHAIN_FIELD, SIGNING_KEY_ALGORITHM_FIELD, EXPORT_TOKEN_FIELD,
PARAMETERS_VALID_UNTIL_TIMESTAMP_FIELD));
private final String signingKeyCertificate;
private final String signingKeyCertificateChain;
private final String signingKeyAlgorithm;
private final String exportToken;
private final Instant parametersValidUntilTimestamp;
private GetParametersForExportResponse(BuilderImpl builder) {
super(builder);
this.signingKeyCertificate = builder.signingKeyCertificate;
this.signingKeyCertificateChain = builder.signingKeyCertificateChain;
this.signingKeyAlgorithm = builder.signingKeyAlgorithm;
this.exportToken = builder.exportToken;
this.parametersValidUntilTimestamp = builder.parametersValidUntilTimestamp;
}
/**
*
* The signing key certificate in PEM format (base64 encoded) of the public key for signature within the TR-34 key
* block. The certificate expires after 7 days.
*
*
* @return The signing key certificate in PEM format (base64 encoded) of the public key for signature within the
* TR-34 key block. The certificate expires after 7 days.
*/
public final String signingKeyCertificate() {
return signingKeyCertificate;
}
/**
*
* The root certificate authority (CA) that signed the signing key certificate in PEM format (base64 encoded).
*
*
* @return The root certificate authority (CA) that signed the signing key certificate in PEM format (base64
* encoded).
*/
public final String signingKeyCertificateChain() {
return signingKeyCertificateChain;
}
/**
*
* The algorithm of the signing key certificate for use in TR-34 key block generation. RSA_2048
is the
* only signing key algorithm allowed.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #signingKeyAlgorithm} will return {@link KeyAlgorithm#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #signingKeyAlgorithmAsString}.
*
*
* @return The algorithm of the signing key certificate for use in TR-34 key block generation. RSA_2048
* is the only signing key algorithm allowed.
* @see KeyAlgorithm
*/
public final KeyAlgorithm signingKeyAlgorithm() {
return KeyAlgorithm.fromValue(signingKeyAlgorithm);
}
/**
*
* The algorithm of the signing key certificate for use in TR-34 key block generation. RSA_2048
is the
* only signing key algorithm allowed.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #signingKeyAlgorithm} will return {@link KeyAlgorithm#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #signingKeyAlgorithmAsString}.
*
*
* @return The algorithm of the signing key certificate for use in TR-34 key block generation. RSA_2048
* is the only signing key algorithm allowed.
* @see KeyAlgorithm
*/
public final String signingKeyAlgorithmAsString() {
return signingKeyAlgorithm;
}
/**
*
* The export token to initiate key export from Amazon Web Services Payment Cryptography. The export token expires
* after 7 days. You can use the same export token to export multiple keys from the same service account.
*
*
* @return The export token to initiate key export from Amazon Web Services Payment Cryptography. The export token
* expires after 7 days. You can use the same export token to export multiple keys from the same service
* account.
*/
public final String exportToken() {
return exportToken;
}
/**
*
* The validity period of the export token.
*
*
* @return The validity period of the export token.
*/
public final Instant parametersValidUntilTimestamp() {
return parametersValidUntilTimestamp;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(signingKeyCertificate());
hashCode = 31 * hashCode + Objects.hashCode(signingKeyCertificateChain());
hashCode = 31 * hashCode + Objects.hashCode(signingKeyAlgorithmAsString());
hashCode = 31 * hashCode + Objects.hashCode(exportToken());
hashCode = 31 * hashCode + Objects.hashCode(parametersValidUntilTimestamp());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetParametersForExportResponse)) {
return false;
}
GetParametersForExportResponse other = (GetParametersForExportResponse) obj;
return Objects.equals(signingKeyCertificate(), other.signingKeyCertificate())
&& Objects.equals(signingKeyCertificateChain(), other.signingKeyCertificateChain())
&& Objects.equals(signingKeyAlgorithmAsString(), other.signingKeyAlgorithmAsString())
&& Objects.equals(exportToken(), other.exportToken())
&& Objects.equals(parametersValidUntilTimestamp(), other.parametersValidUntilTimestamp());
}
/**
* 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("GetParametersForExportResponse")
.add("SigningKeyCertificate", signingKeyCertificate() == null ? null : "*** Sensitive Data Redacted ***")
.add("SigningKeyCertificateChain",
signingKeyCertificateChain() == null ? null : "*** Sensitive Data Redacted ***")
.add("SigningKeyAlgorithm", signingKeyAlgorithmAsString()).add("ExportToken", exportToken())
.add("ParametersValidUntilTimestamp", parametersValidUntilTimestamp()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SigningKeyCertificate":
return Optional.ofNullable(clazz.cast(signingKeyCertificate()));
case "SigningKeyCertificateChain":
return Optional.ofNullable(clazz.cast(signingKeyCertificateChain()));
case "SigningKeyAlgorithm":
return Optional.ofNullable(clazz.cast(signingKeyAlgorithmAsString()));
case "ExportToken":
return Optional.ofNullable(clazz.cast(exportToken()));
case "ParametersValidUntilTimestamp":
return Optional.ofNullable(clazz.cast(parametersValidUntilTimestamp()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function