software.amazon.awssdk.services.paymentcryptography.model.ExportKeyRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of paymentcryptography Show documentation
Show all versions of paymentcryptography Show documentation
The AWS Java SDK for Payment Cryptography module holds the client classes that are used for
communicating with Payment Cryptography.
/*
* 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.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 ExportKeyRequest extends PaymentCryptographyRequest implements
ToCopyableBuilder {
private static final SdkField KEY_MATERIAL_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("KeyMaterial")
.getter(getter(ExportKeyRequest::keyMaterial)).setter(setter(Builder::keyMaterial))
.constructor(ExportKeyMaterial::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyMaterial").build()).build();
private static final SdkField EXPORT_KEY_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ExportKeyIdentifier").getter(getter(ExportKeyRequest::exportKeyIdentifier))
.setter(setter(Builder::exportKeyIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExportKeyIdentifier").build())
.build();
private static final SdkField EXPORT_ATTRIBUTES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ExportAttributes")
.getter(getter(ExportKeyRequest::exportAttributes)).setter(setter(Builder::exportAttributes))
.constructor(ExportAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExportAttributes").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(KEY_MATERIAL_FIELD,
EXPORT_KEY_IDENTIFIER_FIELD, EXPORT_ATTRIBUTES_FIELD));
private final ExportKeyMaterial keyMaterial;
private final String exportKeyIdentifier;
private final ExportAttributes exportAttributes;
private ExportKeyRequest(BuilderImpl builder) {
super(builder);
this.keyMaterial = builder.keyMaterial;
this.exportKeyIdentifier = builder.exportKeyIdentifier;
this.exportAttributes = builder.exportAttributes;
}
/**
*
* The key block format type, for example, TR-34 or TR-31, to use during key material export.
*
*
* @return The key block format type, for example, TR-34 or TR-31, to use during key material export.
*/
public final ExportKeyMaterial keyMaterial() {
return keyMaterial;
}
/**
*
* The KeyARN
of the key under export from Amazon Web Services Payment Cryptography.
*
*
* @return The KeyARN
of the key under export from Amazon Web Services Payment Cryptography.
*/
public final String exportKeyIdentifier() {
return exportKeyIdentifier;
}
/**
*
* The attributes for IPEK generation during export.
*
*
* @return The attributes for IPEK generation during export.
*/
public final ExportAttributes exportAttributes() {
return exportAttributes;
}
@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(keyMaterial());
hashCode = 31 * hashCode + Objects.hashCode(exportKeyIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(exportAttributes());
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 ExportKeyRequest)) {
return false;
}
ExportKeyRequest other = (ExportKeyRequest) obj;
return Objects.equals(keyMaterial(), other.keyMaterial())
&& Objects.equals(exportKeyIdentifier(), other.exportKeyIdentifier())
&& Objects.equals(exportAttributes(), other.exportAttributes());
}
/**
* 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("ExportKeyRequest").add("KeyMaterial", keyMaterial())
.add("ExportKeyIdentifier", exportKeyIdentifier()).add("ExportAttributes", exportAttributes()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "KeyMaterial":
return Optional.ofNullable(clazz.cast(keyMaterial()));
case "ExportKeyIdentifier":
return Optional.ofNullable(clazz.cast(exportKeyIdentifier()));
case "ExportAttributes":
return Optional.ofNullable(clazz.cast(exportAttributes()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function