software.amazon.awssdk.services.kms.model.UpdateCustomKeyStoreRequest Maven / Gradle / Ivy
/*
* 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.kms.model;
import java.beans.Transient;
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 UpdateCustomKeyStoreRequest extends KmsRequest implements
ToCopyableBuilder {
private static final SdkField CUSTOM_KEY_STORE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CustomKeyStoreId").getter(getter(UpdateCustomKeyStoreRequest::customKeyStoreId))
.setter(setter(Builder::customKeyStoreId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustomKeyStoreId").build()).build();
private static final SdkField NEW_CUSTOM_KEY_STORE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NewCustomKeyStoreName").getter(getter(UpdateCustomKeyStoreRequest::newCustomKeyStoreName))
.setter(setter(Builder::newCustomKeyStoreName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NewCustomKeyStoreName").build())
.build();
private static final SdkField KEY_STORE_PASSWORD_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KeyStorePassword").getter(getter(UpdateCustomKeyStoreRequest::keyStorePassword))
.setter(setter(Builder::keyStorePassword))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyStorePassword").build()).build();
private static final SdkField CLOUD_HSM_CLUSTER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CloudHsmClusterId").getter(getter(UpdateCustomKeyStoreRequest::cloudHsmClusterId))
.setter(setter(Builder::cloudHsmClusterId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CloudHsmClusterId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CUSTOM_KEY_STORE_ID_FIELD,
NEW_CUSTOM_KEY_STORE_NAME_FIELD, KEY_STORE_PASSWORD_FIELD, CLOUD_HSM_CLUSTER_ID_FIELD));
private final String customKeyStoreId;
private final String newCustomKeyStoreName;
private final String keyStorePassword;
private final String cloudHsmClusterId;
private UpdateCustomKeyStoreRequest(BuilderImpl builder) {
super(builder);
this.customKeyStoreId = builder.customKeyStoreId;
this.newCustomKeyStoreName = builder.newCustomKeyStoreName;
this.keyStorePassword = builder.keyStorePassword;
this.cloudHsmClusterId = builder.cloudHsmClusterId;
}
/**
*
* Identifies the custom key store that you want to update. Enter the ID of the custom key store. To find the ID of
* a custom key store, use the DescribeCustomKeyStores operation.
*
*
* @return Identifies the custom key store that you want to update. Enter the ID of the custom key store. To find
* the ID of a custom key store, use the DescribeCustomKeyStores operation.
*/
public final String customKeyStoreId() {
return customKeyStoreId;
}
/**
*
* Changes the friendly name of the custom key store to the value that you specify. The custom key store name must
* be unique in the Amazon Web Services account.
*
*
* @return Changes the friendly name of the custom key store to the value that you specify. The custom key store
* name must be unique in the Amazon Web Services account.
*/
public final String newCustomKeyStoreName() {
return newCustomKeyStoreName;
}
/**
*
* Enter the current password of the kmsuser
crypto user (CU) in the CloudHSM cluster that is
* associated with the custom key store.
*
*
* This parameter tells KMS the current password of the kmsuser
crypto user (CU). It does not set or
* change the password of any users in the CloudHSM cluster.
*
*
* @return Enter the current password of the kmsuser
crypto user (CU) in the CloudHSM cluster that is
* associated with the custom key store.
*
* This parameter tells KMS the current password of the kmsuser
crypto user (CU). It does not
* set or change the password of any users in the CloudHSM cluster.
*/
public final String keyStorePassword() {
return keyStorePassword;
}
/**
*
* Associates the custom key store with a related CloudHSM cluster.
*
*
* Enter the cluster ID of the cluster that you used to create the custom key store or a cluster that shares a
* backup history and has the same cluster certificate as the original cluster. You cannot use this parameter to
* associate a custom key store with an unrelated cluster. In addition, the replacement cluster must fulfill the
* requirements for a cluster associated with a custom key store. To view the cluster certificate of a cluster,
* use the DescribeClusters
* operation.
*
*
* @return Associates the custom key store with a related CloudHSM cluster.
*
* Enter the cluster ID of the cluster that you used to create the custom key store or a cluster that shares
* a backup history and has the same cluster certificate as the original cluster. You cannot use this
* parameter to associate a custom key store with an unrelated cluster. In addition, the replacement cluster
* must fulfill
* the requirements for a cluster associated with a custom key store. To view the cluster certificate of
* a cluster, use the DescribeClusters operation.
*/
public final String cloudHsmClusterId() {
return cloudHsmClusterId;
}
@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(customKeyStoreId());
hashCode = 31 * hashCode + Objects.hashCode(newCustomKeyStoreName());
hashCode = 31 * hashCode + Objects.hashCode(keyStorePassword());
hashCode = 31 * hashCode + Objects.hashCode(cloudHsmClusterId());
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 UpdateCustomKeyStoreRequest)) {
return false;
}
UpdateCustomKeyStoreRequest other = (UpdateCustomKeyStoreRequest) obj;
return Objects.equals(customKeyStoreId(), other.customKeyStoreId())
&& Objects.equals(newCustomKeyStoreName(), other.newCustomKeyStoreName())
&& Objects.equals(keyStorePassword(), other.keyStorePassword())
&& Objects.equals(cloudHsmClusterId(), other.cloudHsmClusterId());
}
/**
* 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("UpdateCustomKeyStoreRequest").add("CustomKeyStoreId", customKeyStoreId())
.add("NewCustomKeyStoreName", newCustomKeyStoreName())
.add("KeyStorePassword", keyStorePassword() == null ? null : "*** Sensitive Data Redacted ***")
.add("CloudHsmClusterId", cloudHsmClusterId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CustomKeyStoreId":
return Optional.ofNullable(clazz.cast(customKeyStoreId()));
case "NewCustomKeyStoreName":
return Optional.ofNullable(clazz.cast(newCustomKeyStoreName()));
case "KeyStorePassword":
return Optional.ofNullable(clazz.cast(keyStorePassword()));
case "CloudHsmClusterId":
return Optional.ofNullable(clazz.cast(cloudHsmClusterId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* This parameter tells KMS the current password of the kmsuser
crypto user (CU). It does
* not set or change the password of any users in the CloudHSM cluster.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder keyStorePassword(String keyStorePassword);
/**
*
* Associates the custom key store with a related CloudHSM cluster.
*
*
* Enter the cluster ID of the cluster that you used to create the custom key store or a cluster that shares a
* backup history and has the same cluster certificate as the original cluster. You cannot use this parameter to
* associate a custom key store with an unrelated cluster. In addition, the replacement cluster must fulfill the
* requirements for a cluster associated with a custom key store. To view the cluster certificate of a
* cluster, use the
* DescribeClusters operation.
*
*
* @param cloudHsmClusterId
* Associates the custom key store with a related CloudHSM cluster.
*
* Enter the cluster ID of the cluster that you used to create the custom key store or a cluster that
* shares a backup history and has the same cluster certificate as the original cluster. You cannot use
* this parameter to associate a custom key store with an unrelated cluster. In addition, the replacement
* cluster must fulfill the requirements for a cluster associated with a custom key store. To view the cluster
* certificate of a cluster, use the DescribeClusters operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder cloudHsmClusterId(String cloudHsmClusterId);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends KmsRequest.BuilderImpl implements Builder {
private String customKeyStoreId;
private String newCustomKeyStoreName;
private String keyStorePassword;
private String cloudHsmClusterId;
private BuilderImpl() {
}
private BuilderImpl(UpdateCustomKeyStoreRequest model) {
super(model);
customKeyStoreId(model.customKeyStoreId);
newCustomKeyStoreName(model.newCustomKeyStoreName);
keyStorePassword(model.keyStorePassword);
cloudHsmClusterId(model.cloudHsmClusterId);
}
public final String getCustomKeyStoreId() {
return customKeyStoreId;
}
public final void setCustomKeyStoreId(String customKeyStoreId) {
this.customKeyStoreId = customKeyStoreId;
}
@Override
@Transient
public final Builder customKeyStoreId(String customKeyStoreId) {
this.customKeyStoreId = customKeyStoreId;
return this;
}
public final String getNewCustomKeyStoreName() {
return newCustomKeyStoreName;
}
public final void setNewCustomKeyStoreName(String newCustomKeyStoreName) {
this.newCustomKeyStoreName = newCustomKeyStoreName;
}
@Override
@Transient
public final Builder newCustomKeyStoreName(String newCustomKeyStoreName) {
this.newCustomKeyStoreName = newCustomKeyStoreName;
return this;
}
public final String getKeyStorePassword() {
return keyStorePassword;
}
public final void setKeyStorePassword(String keyStorePassword) {
this.keyStorePassword = keyStorePassword;
}
@Override
@Transient
public final Builder keyStorePassword(String keyStorePassword) {
this.keyStorePassword = keyStorePassword;
return this;
}
public final String getCloudHsmClusterId() {
return cloudHsmClusterId;
}
public final void setCloudHsmClusterId(String cloudHsmClusterId) {
this.cloudHsmClusterId = cloudHsmClusterId;
}
@Override
@Transient
public final Builder cloudHsmClusterId(String cloudHsmClusterId) {
this.cloudHsmClusterId = cloudHsmClusterId;
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public UpdateCustomKeyStoreRequest build() {
return new UpdateCustomKeyStoreRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}