Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.backup.model.CreateBackupVaultRequest Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Backup module holds the client classes that are used for
communicating with Backup.
/*
* 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.backup.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 CreateBackupVaultRequest extends BackupRequest implements
ToCopyableBuilder {
private static final SdkField BACKUP_VAULT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackupVaultName").getter(getter(CreateBackupVaultRequest::backupVaultName))
.setter(setter(Builder::backupVaultName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("backupVaultName").build()).build();
private static final SdkField> BACKUP_VAULT_TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("BackupVaultTags")
.getter(getter(CreateBackupVaultRequest::backupVaultTags))
.setter(setter(Builder::backupVaultTags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupVaultTags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField ENCRYPTION_KEY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EncryptionKeyArn").getter(getter(CreateBackupVaultRequest::encryptionKeyArn))
.setter(setter(Builder::encryptionKeyArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EncryptionKeyArn").build()).build();
private static final SdkField CREATOR_REQUEST_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreatorRequestId").getter(getter(CreateBackupVaultRequest::creatorRequestId))
.setter(setter(Builder::creatorRequestId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatorRequestId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BACKUP_VAULT_NAME_FIELD,
BACKUP_VAULT_TAGS_FIELD, ENCRYPTION_KEY_ARN_FIELD, CREATOR_REQUEST_ID_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String backupVaultName;
private final Map backupVaultTags;
private final String encryptionKeyArn;
private final String creatorRequestId;
private CreateBackupVaultRequest(BuilderImpl builder) {
super(builder);
this.backupVaultName = builder.backupVaultName;
this.backupVaultTags = builder.backupVaultTags;
this.encryptionKeyArn = builder.encryptionKeyArn;
this.creatorRequestId = builder.creatorRequestId;
}
/**
*
* The name of a logical container where backups are stored. Backup vaults are identified by names that are unique
* to the account used to create them and the Amazon Web Services Region where they are created. They consist of
* letters, numbers, and hyphens.
*
*
* @return The name of a logical container where backups are stored. Backup vaults are identified by names that are
* unique to the account used to create them and the Amazon Web Services Region where they are created. They
* consist of letters, numbers, and hyphens.
*/
public final String backupVaultName() {
return backupVaultName;
}
/**
* For responses, this returns true if the service returned a value for the BackupVaultTags property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasBackupVaultTags() {
return backupVaultTags != null && !(backupVaultTags instanceof SdkAutoConstructMap);
}
/**
*
* The tags to assign to the backup vault.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasBackupVaultTags} method.
*
*
* @return The tags to assign to the backup vault.
*/
public final Map backupVaultTags() {
return backupVaultTags;
}
/**
*
* The server-side encryption key that is used to protect your backups; for example,
* arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
.
*
*
* @return The server-side encryption key that is used to protect your backups; for example,
* arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
.
*/
public final String encryptionKeyArn() {
return encryptionKeyArn;
}
/**
*
* A unique string that identifies the request and allows failed requests to be retried without the risk of running
* the operation twice. This parameter is optional.
*
*
* If used, this parameter must contain 1 to 50 alphanumeric or '-_.' characters.
*
*
* @return A unique string that identifies the request and allows failed requests to be retried without the risk of
* running the operation twice. This parameter is optional.
*
* If used, this parameter must contain 1 to 50 alphanumeric or '-_.' characters.
*/
public final String creatorRequestId() {
return creatorRequestId;
}
@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(backupVaultName());
hashCode = 31 * hashCode + Objects.hashCode(hasBackupVaultTags() ? backupVaultTags() : null);
hashCode = 31 * hashCode + Objects.hashCode(encryptionKeyArn());
hashCode = 31 * hashCode + Objects.hashCode(creatorRequestId());
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 CreateBackupVaultRequest)) {
return false;
}
CreateBackupVaultRequest other = (CreateBackupVaultRequest) obj;
return Objects.equals(backupVaultName(), other.backupVaultName()) && hasBackupVaultTags() == other.hasBackupVaultTags()
&& Objects.equals(backupVaultTags(), other.backupVaultTags())
&& Objects.equals(encryptionKeyArn(), other.encryptionKeyArn())
&& Objects.equals(creatorRequestId(), other.creatorRequestId());
}
/**
* 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("CreateBackupVaultRequest").add("BackupVaultName", backupVaultName())
.add("BackupVaultTags", backupVaultTags() == null ? null : "*** Sensitive Data Redacted ***")
.add("EncryptionKeyArn", encryptionKeyArn()).add("CreatorRequestId", creatorRequestId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BackupVaultName":
return Optional.ofNullable(clazz.cast(backupVaultName()));
case "BackupVaultTags":
return Optional.ofNullable(clazz.cast(backupVaultTags()));
case "EncryptionKeyArn":
return Optional.ofNullable(clazz.cast(encryptionKeyArn()));
case "CreatorRequestId":
return Optional.ofNullable(clazz.cast(creatorRequestId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("backupVaultName", BACKUP_VAULT_NAME_FIELD);
map.put("BackupVaultTags", BACKUP_VAULT_TAGS_FIELD);
map.put("EncryptionKeyArn", ENCRYPTION_KEY_ARN_FIELD);
map.put("CreatorRequestId", CREATOR_REQUEST_ID_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function getter(Function g) {
return obj -> g.apply((CreateBackupVaultRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends BackupRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The name of a logical container where backups are stored. Backup vaults are identified by names that are
* unique to the account used to create them and the Amazon Web Services Region where they are created. They
* consist of letters, numbers, and hyphens.
*
*
* @param backupVaultName
* The name of a logical container where backups are stored. Backup vaults are identified by names that
* are unique to the account used to create them and the Amazon Web Services Region where they are
* created. They consist of letters, numbers, and hyphens.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder backupVaultName(String backupVaultName);
/**
*
* The tags to assign to the backup vault.
*
*
* @param backupVaultTags
* The tags to assign to the backup vault.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder backupVaultTags(Map backupVaultTags);
/**
*
* The server-side encryption key that is used to protect your backups; for example,
* arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
.
*
*
* @param encryptionKeyArn
* The server-side encryption key that is used to protect your backups; for example,
* arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder encryptionKeyArn(String encryptionKeyArn);
/**
*
* A unique string that identifies the request and allows failed requests to be retried without the risk of
* running the operation twice. This parameter is optional.
*
*
* If used, this parameter must contain 1 to 50 alphanumeric or '-_.' characters.
*
*
* @param creatorRequestId
* A unique string that identifies the request and allows failed requests to be retried without the risk
* of running the operation twice. This parameter is optional.
*
* If used, this parameter must contain 1 to 50 alphanumeric or '-_.' characters.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder creatorRequestId(String creatorRequestId);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends BackupRequest.BuilderImpl implements Builder {
private String backupVaultName;
private Map backupVaultTags = DefaultSdkAutoConstructMap.getInstance();
private String encryptionKeyArn;
private String creatorRequestId;
private BuilderImpl() {
}
private BuilderImpl(CreateBackupVaultRequest model) {
super(model);
backupVaultName(model.backupVaultName);
backupVaultTags(model.backupVaultTags);
encryptionKeyArn(model.encryptionKeyArn);
creatorRequestId(model.creatorRequestId);
}
public final String getBackupVaultName() {
return backupVaultName;
}
public final void setBackupVaultName(String backupVaultName) {
this.backupVaultName = backupVaultName;
}
@Override
public final Builder backupVaultName(String backupVaultName) {
this.backupVaultName = backupVaultName;
return this;
}
public final Map getBackupVaultTags() {
if (backupVaultTags instanceof SdkAutoConstructMap) {
return null;
}
return backupVaultTags;
}
public final void setBackupVaultTags(Map backupVaultTags) {
this.backupVaultTags = TagsCopier.copy(backupVaultTags);
}
@Override
public final Builder backupVaultTags(Map backupVaultTags) {
this.backupVaultTags = TagsCopier.copy(backupVaultTags);
return this;
}
public final String getEncryptionKeyArn() {
return encryptionKeyArn;
}
public final void setEncryptionKeyArn(String encryptionKeyArn) {
this.encryptionKeyArn = encryptionKeyArn;
}
@Override
public final Builder encryptionKeyArn(String encryptionKeyArn) {
this.encryptionKeyArn = encryptionKeyArn;
return this;
}
public final String getCreatorRequestId() {
return creatorRequestId;
}
public final void setCreatorRequestId(String creatorRequestId) {
this.creatorRequestId = creatorRequestId;
}
@Override
public final Builder creatorRequestId(String creatorRequestId) {
this.creatorRequestId = creatorRequestId;
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 CreateBackupVaultRequest build() {
return new CreateBackupVaultRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}