All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.backup.model.StartBackupJobRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Backup module holds the client classes that are used for communicating with Backup.

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright 2014-2019 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.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class StartBackupJobRequest extends BackupRequest implements
        ToCopyableBuilder {
    private static final SdkField BACKUP_VAULT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(StartBackupJobRequest::backupVaultName)).setter(setter(Builder::backupVaultName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupVaultName").build()).build();

    private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(StartBackupJobRequest::resourceArn)).setter(setter(Builder::resourceArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceArn").build()).build();

    private static final SdkField IAM_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(StartBackupJobRequest::iamRoleArn)).setter(setter(Builder::iamRoleArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IamRoleArn").build()).build();

    private static final SdkField IDEMPOTENCY_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(StartBackupJobRequest::idempotencyToken)).setter(setter(Builder::idempotencyToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IdempotencyToken").build()).build();

    private static final SdkField START_WINDOW_MINUTES_FIELD = SdkField. builder(MarshallingType.LONG)
            .getter(getter(StartBackupJobRequest::startWindowMinutes)).setter(setter(Builder::startWindowMinutes))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartWindowMinutes").build())
            .build();

    private static final SdkField COMPLETE_WINDOW_MINUTES_FIELD = SdkField. builder(MarshallingType.LONG)
            .getter(getter(StartBackupJobRequest::completeWindowMinutes)).setter(setter(Builder::completeWindowMinutes))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompleteWindowMinutes").build())
            .build();

    private static final SdkField LIFECYCLE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .getter(getter(StartBackupJobRequest::lifecycle)).setter(setter(Builder::lifecycle)).constructor(Lifecycle::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Lifecycle").build()).build();

    private static final SdkField> RECOVERY_POINT_TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .getter(getter(StartBackupJobRequest::recoveryPointTags))
            .setter(setter(Builder::recoveryPointTags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecoveryPointTags").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BACKUP_VAULT_NAME_FIELD,
            RESOURCE_ARN_FIELD, IAM_ROLE_ARN_FIELD, IDEMPOTENCY_TOKEN_FIELD, START_WINDOW_MINUTES_FIELD,
            COMPLETE_WINDOW_MINUTES_FIELD, LIFECYCLE_FIELD, RECOVERY_POINT_TAGS_FIELD));

    private final String backupVaultName;

    private final String resourceArn;

    private final String iamRoleArn;

    private final String idempotencyToken;

    private final Long startWindowMinutes;

    private final Long completeWindowMinutes;

    private final Lifecycle lifecycle;

    private final Map recoveryPointTags;

    private StartBackupJobRequest(BuilderImpl builder) {
        super(builder);
        this.backupVaultName = builder.backupVaultName;
        this.resourceArn = builder.resourceArn;
        this.iamRoleArn = builder.iamRoleArn;
        this.idempotencyToken = builder.idempotencyToken;
        this.startWindowMinutes = builder.startWindowMinutes;
        this.completeWindowMinutes = builder.completeWindowMinutes;
        this.lifecycle = builder.lifecycle;
        this.recoveryPointTags = builder.recoveryPointTags;
    }

    /**
     * 

* 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 AWS Region where they are created. They consist of lowercase 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 AWS Region where they are created. They consist of * lowercase letters, numbers, and hyphens. */ public String backupVaultName() { return backupVaultName; } /** *

* An Amazon Resource Name (ARN) that uniquely identifies a resource. The format of the ARN depends on the resource * type. *

* * @return An Amazon Resource Name (ARN) that uniquely identifies a resource. The format of the ARN depends on the * resource type. */ public String resourceArn() { return resourceArn; } /** *

* Specifies the IAM role ARN used to create the target recovery point; for example, * arn:aws:iam::123456789012:role/S3Access. *

* * @return Specifies the IAM role ARN used to create the target recovery point; for example, * arn:aws:iam::123456789012:role/S3Access. */ public String iamRoleArn() { return iamRoleArn; } /** *

* A customer chosen string that can be used to distinguish between calls to StartBackupJob. * Idempotency tokens time out after one hour. Therefore, if you call StartBackupJob multiple times * with the same idempotency token within one hour, AWS Backup recognizes that you are requesting only one backup * job and initiates only one. If you change the idempotency token for each call, AWS Backup recognizes that you are * requesting to start multiple backups. *

* * @return A customer chosen string that can be used to distinguish between calls to StartBackupJob. * Idempotency tokens time out after one hour. Therefore, if you call StartBackupJob multiple * times with the same idempotency token within one hour, AWS Backup recognizes that you are requesting only * one backup job and initiates only one. If you change the idempotency token for each call, AWS Backup * recognizes that you are requesting to start multiple backups. */ public String idempotencyToken() { return idempotencyToken; } /** *

* The amount of time in minutes before beginning a backup. *

* * @return The amount of time in minutes before beginning a backup. */ public Long startWindowMinutes() { return startWindowMinutes; } /** *

* The amount of time AWS Backup attempts a backup before canceling the job and returning an error. *

* * @return The amount of time AWS Backup attempts a backup before canceling the job and returning an error. */ public Long completeWindowMinutes() { return completeWindowMinutes; } /** *

* The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. AWS Backup * will transition and expire backups automatically according to the lifecycle that you define. *

*

* Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. Therefore, the * “expire after days” setting must be 90 days greater than the “transition to cold after days” setting. The * “transition to cold after days” setting cannot be changed after a backup has been transitioned to cold. *

* * @return The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. AWS * Backup will transition and expire backups automatically according to the lifecycle that you define.

*

* Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. Therefore, * the “expire after days” setting must be 90 days greater than the “transition to cold after days” setting. * The “transition to cold after days” setting cannot be changed after a backup has been transitioned to * cold. */ public Lifecycle lifecycle() { return lifecycle; } /** *

* To help organize your resources, you can assign your own metadata to the resources that you create. Each tag is a * key-value pair. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return To help organize your resources, you can assign your own metadata to the resources that you create. Each * tag is a key-value pair. */ public Map recoveryPointTags() { return recoveryPointTags; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(backupVaultName()); hashCode = 31 * hashCode + Objects.hashCode(resourceArn()); hashCode = 31 * hashCode + Objects.hashCode(iamRoleArn()); hashCode = 31 * hashCode + Objects.hashCode(idempotencyToken()); hashCode = 31 * hashCode + Objects.hashCode(startWindowMinutes()); hashCode = 31 * hashCode + Objects.hashCode(completeWindowMinutes()); hashCode = 31 * hashCode + Objects.hashCode(lifecycle()); hashCode = 31 * hashCode + Objects.hashCode(recoveryPointTags()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof StartBackupJobRequest)) { return false; } StartBackupJobRequest other = (StartBackupJobRequest) obj; return Objects.equals(backupVaultName(), other.backupVaultName()) && Objects.equals(resourceArn(), other.resourceArn()) && Objects.equals(iamRoleArn(), other.iamRoleArn()) && Objects.equals(idempotencyToken(), other.idempotencyToken()) && Objects.equals(startWindowMinutes(), other.startWindowMinutes()) && Objects.equals(completeWindowMinutes(), other.completeWindowMinutes()) && Objects.equals(lifecycle(), other.lifecycle()) && Objects.equals(recoveryPointTags(), other.recoveryPointTags()); } /** * 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 String toString() { return ToString.builder("StartBackupJobRequest").add("BackupVaultName", backupVaultName()) .add("ResourceArn", resourceArn()).add("IamRoleArn", iamRoleArn()).add("IdempotencyToken", idempotencyToken()) .add("StartWindowMinutes", startWindowMinutes()).add("CompleteWindowMinutes", completeWindowMinutes()) .add("Lifecycle", lifecycle()) .add("RecoveryPointTags", recoveryPointTags() == null ? null : "*** Sensitive Data Redacted ***").build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "BackupVaultName": return Optional.ofNullable(clazz.cast(backupVaultName())); case "ResourceArn": return Optional.ofNullable(clazz.cast(resourceArn())); case "IamRoleArn": return Optional.ofNullable(clazz.cast(iamRoleArn())); case "IdempotencyToken": return Optional.ofNullable(clazz.cast(idempotencyToken())); case "StartWindowMinutes": return Optional.ofNullable(clazz.cast(startWindowMinutes())); case "CompleteWindowMinutes": return Optional.ofNullable(clazz.cast(completeWindowMinutes())); case "Lifecycle": return Optional.ofNullable(clazz.cast(lifecycle())); case "RecoveryPointTags": return Optional.ofNullable(clazz.cast(recoveryPointTags())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StartBackupJobRequest) 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 AWS Region where they are created. They consist of * lowercase 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 AWS Region where they are created. They consist * of lowercase letters, numbers, and hyphens. * @return Returns a reference to this object so that method calls can be chained together. */ Builder backupVaultName(String backupVaultName); /** *

* An Amazon Resource Name (ARN) that uniquely identifies a resource. The format of the ARN depends on the * resource type. *

* * @param resourceArn * An Amazon Resource Name (ARN) that uniquely identifies a resource. The format of the ARN depends on * the resource type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceArn(String resourceArn); /** *

* Specifies the IAM role ARN used to create the target recovery point; for example, * arn:aws:iam::123456789012:role/S3Access. *

* * @param iamRoleArn * Specifies the IAM role ARN used to create the target recovery point; for example, * arn:aws:iam::123456789012:role/S3Access. * @return Returns a reference to this object so that method calls can be chained together. */ Builder iamRoleArn(String iamRoleArn); /** *

* A customer chosen string that can be used to distinguish between calls to StartBackupJob. * Idempotency tokens time out after one hour. Therefore, if you call StartBackupJob multiple times * with the same idempotency token within one hour, AWS Backup recognizes that you are requesting only one * backup job and initiates only one. If you change the idempotency token for each call, AWS Backup recognizes * that you are requesting to start multiple backups. *

* * @param idempotencyToken * A customer chosen string that can be used to distinguish between calls to StartBackupJob. * Idempotency tokens time out after one hour. Therefore, if you call StartBackupJob * multiple times with the same idempotency token within one hour, AWS Backup recognizes that you are * requesting only one backup job and initiates only one. If you change the idempotency token for each * call, AWS Backup recognizes that you are requesting to start multiple backups. * @return Returns a reference to this object so that method calls can be chained together. */ Builder idempotencyToken(String idempotencyToken); /** *

* The amount of time in minutes before beginning a backup. *

* * @param startWindowMinutes * The amount of time in minutes before beginning a backup. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startWindowMinutes(Long startWindowMinutes); /** *

* The amount of time AWS Backup attempts a backup before canceling the job and returning an error. *

* * @param completeWindowMinutes * The amount of time AWS Backup attempts a backup before canceling the job and returning an error. * @return Returns a reference to this object so that method calls can be chained together. */ Builder completeWindowMinutes(Long completeWindowMinutes); /** *

* The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. AWS * Backup will transition and expire backups automatically according to the lifecycle that you define. *

*

* Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. Therefore, the * “expire after days” setting must be 90 days greater than the “transition to cold after days” setting. The * “transition to cold after days” setting cannot be changed after a backup has been transitioned to cold. *

* * @param lifecycle * The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. * AWS Backup will transition and expire backups automatically according to the lifecycle that you * define.

*

* Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. * Therefore, the “expire after days” setting must be 90 days greater than the “transition to cold after * days” setting. The “transition to cold after days” setting cannot be changed after a backup has been * transitioned to cold. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lifecycle(Lifecycle lifecycle); /** *

* The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. AWS * Backup will transition and expire backups automatically according to the lifecycle that you define. *

*

* Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. Therefore, the * “expire after days” setting must be 90 days greater than the “transition to cold after days” setting. The * “transition to cold after days” setting cannot be changed after a backup has been transitioned to cold. *

* This is a convenience that creates an instance of the {@link Lifecycle.Builder} avoiding the need to create * one manually via {@link Lifecycle#builder()}. * * When the {@link Consumer} completes, {@link Lifecycle.Builder#build()} is called immediately and its result * is passed to {@link #lifecycle(Lifecycle)}. * * @param lifecycle * a consumer that will call methods on {@link Lifecycle.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #lifecycle(Lifecycle) */ default Builder lifecycle(Consumer lifecycle) { return lifecycle(Lifecycle.builder().applyMutation(lifecycle).build()); } /** *

* To help organize your resources, you can assign your own metadata to the resources that you create. Each tag * is a key-value pair. *

* * @param recoveryPointTags * To help organize your resources, you can assign your own metadata to the resources that you create. * Each tag is a key-value pair. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recoveryPointTags(Map recoveryPointTags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends BackupRequest.BuilderImpl implements Builder { private String backupVaultName; private String resourceArn; private String iamRoleArn; private String idempotencyToken; private Long startWindowMinutes; private Long completeWindowMinutes; private Lifecycle lifecycle; private Map recoveryPointTags = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(StartBackupJobRequest model) { super(model); backupVaultName(model.backupVaultName); resourceArn(model.resourceArn); iamRoleArn(model.iamRoleArn); idempotencyToken(model.idempotencyToken); startWindowMinutes(model.startWindowMinutes); completeWindowMinutes(model.completeWindowMinutes); lifecycle(model.lifecycle); recoveryPointTags(model.recoveryPointTags); } public final String getBackupVaultName() { return backupVaultName; } @Override public final Builder backupVaultName(String backupVaultName) { this.backupVaultName = backupVaultName; return this; } public final void setBackupVaultName(String backupVaultName) { this.backupVaultName = backupVaultName; } public final String getResourceArn() { return resourceArn; } @Override public final Builder resourceArn(String resourceArn) { this.resourceArn = resourceArn; return this; } public final void setResourceArn(String resourceArn) { this.resourceArn = resourceArn; } public final String getIamRoleArn() { return iamRoleArn; } @Override public final Builder iamRoleArn(String iamRoleArn) { this.iamRoleArn = iamRoleArn; return this; } public final void setIamRoleArn(String iamRoleArn) { this.iamRoleArn = iamRoleArn; } public final String getIdempotencyToken() { return idempotencyToken; } @Override public final Builder idempotencyToken(String idempotencyToken) { this.idempotencyToken = idempotencyToken; return this; } public final void setIdempotencyToken(String idempotencyToken) { this.idempotencyToken = idempotencyToken; } public final Long getStartWindowMinutes() { return startWindowMinutes; } @Override public final Builder startWindowMinutes(Long startWindowMinutes) { this.startWindowMinutes = startWindowMinutes; return this; } public final void setStartWindowMinutes(Long startWindowMinutes) { this.startWindowMinutes = startWindowMinutes; } public final Long getCompleteWindowMinutes() { return completeWindowMinutes; } @Override public final Builder completeWindowMinutes(Long completeWindowMinutes) { this.completeWindowMinutes = completeWindowMinutes; return this; } public final void setCompleteWindowMinutes(Long completeWindowMinutes) { this.completeWindowMinutes = completeWindowMinutes; } public final Lifecycle.Builder getLifecycle() { return lifecycle != null ? lifecycle.toBuilder() : null; } @Override public final Builder lifecycle(Lifecycle lifecycle) { this.lifecycle = lifecycle; return this; } public final void setLifecycle(Lifecycle.BuilderImpl lifecycle) { this.lifecycle = lifecycle != null ? lifecycle.build() : null; } public final Map getRecoveryPointTags() { return recoveryPointTags; } @Override public final Builder recoveryPointTags(Map recoveryPointTags) { this.recoveryPointTags = TagsCopier.copy(recoveryPointTags); return this; } public final void setRecoveryPointTags(Map recoveryPointTags) { this.recoveryPointTags = TagsCopier.copy(recoveryPointTags); } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public StartBackupJobRequest build() { return new StartBackupJobRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy