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

software.amazon.awssdk.services.backup.model.BackupRuleInput 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.30.1
Show newest version
/*
 * 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.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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;

/**
 * 

* Specifies a scheduled task used to back up a selection of resources. *

*/ @Generated("software.amazon.awssdk:codegen") public final class BackupRuleInput implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField RULE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RuleName").getter(getter(BackupRuleInput::ruleName)).setter(setter(Builder::ruleName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RuleName").build()).build(); private static final SdkField TARGET_BACKUP_VAULT_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TargetBackupVaultName").getter(getter(BackupRuleInput::targetBackupVaultName)) .setter(setter(Builder::targetBackupVaultName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetBackupVaultName").build()) .build(); private static final SdkField SCHEDULE_EXPRESSION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ScheduleExpression").getter(getter(BackupRuleInput::scheduleExpression)) .setter(setter(Builder::scheduleExpression)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleExpression").build()) .build(); private static final SdkField START_WINDOW_MINUTES_FIELD = SdkField. builder(MarshallingType.LONG) .memberName("StartWindowMinutes").getter(getter(BackupRuleInput::startWindowMinutes)) .setter(setter(Builder::startWindowMinutes)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartWindowMinutes").build()) .build(); private static final SdkField COMPLETION_WINDOW_MINUTES_FIELD = SdkField. builder(MarshallingType.LONG) .memberName("CompletionWindowMinutes").getter(getter(BackupRuleInput::completionWindowMinutes)) .setter(setter(Builder::completionWindowMinutes)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletionWindowMinutes").build()) .build(); private static final SdkField LIFECYCLE_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("Lifecycle").getter(getter(BackupRuleInput::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) .memberName("RecoveryPointTags") .getter(getter(BackupRuleInput::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 SdkField> COPY_ACTIONS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("CopyActions") .getter(getter(BackupRuleInput::copyActions)) .setter(setter(Builder::copyActions)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CopyActions").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(CopyAction::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField ENABLE_CONTINUOUS_BACKUP_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("EnableContinuousBackup").getter(getter(BackupRuleInput::enableContinuousBackup)) .setter(setter(Builder::enableContinuousBackup)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnableContinuousBackup").build()) .build(); private static final SdkField SCHEDULE_EXPRESSION_TIMEZONE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("ScheduleExpressionTimezone") .getter(getter(BackupRuleInput::scheduleExpressionTimezone)) .setter(setter(Builder::scheduleExpressionTimezone)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleExpressionTimezone").build()) .build(); private static final SdkField> INDEX_ACTIONS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("IndexActions") .getter(getter(BackupRuleInput::indexActions)) .setter(setter(Builder::indexActions)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IndexActions").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(IndexAction::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RULE_NAME_FIELD, TARGET_BACKUP_VAULT_NAME_FIELD, SCHEDULE_EXPRESSION_FIELD, START_WINDOW_MINUTES_FIELD, COMPLETION_WINDOW_MINUTES_FIELD, LIFECYCLE_FIELD, RECOVERY_POINT_TAGS_FIELD, COPY_ACTIONS_FIELD, ENABLE_CONTINUOUS_BACKUP_FIELD, SCHEDULE_EXPRESSION_TIMEZONE_FIELD, INDEX_ACTIONS_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String ruleName; private final String targetBackupVaultName; private final String scheduleExpression; private final Long startWindowMinutes; private final Long completionWindowMinutes; private final Lifecycle lifecycle; private final Map recoveryPointTags; private final List copyActions; private final Boolean enableContinuousBackup; private final String scheduleExpressionTimezone; private final List indexActions; private BackupRuleInput(BuilderImpl builder) { this.ruleName = builder.ruleName; this.targetBackupVaultName = builder.targetBackupVaultName; this.scheduleExpression = builder.scheduleExpression; this.startWindowMinutes = builder.startWindowMinutes; this.completionWindowMinutes = builder.completionWindowMinutes; this.lifecycle = builder.lifecycle; this.recoveryPointTags = builder.recoveryPointTags; this.copyActions = builder.copyActions; this.enableContinuousBackup = builder.enableContinuousBackup; this.scheduleExpressionTimezone = builder.scheduleExpressionTimezone; this.indexActions = builder.indexActions; } /** *

* A display name for a backup rule. Must contain 1 to 50 alphanumeric or '-_.' characters. *

* * @return A display name for a backup rule. Must contain 1 to 50 alphanumeric or '-_.' characters. */ public final String ruleName() { return ruleName; } /** *

* 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. *

* * @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. */ public final String targetBackupVaultName() { return targetBackupVaultName; } /** *

* A CRON expression in UTC specifying when Backup initiates a backup job. *

* * @return A CRON expression in UTC specifying when Backup initiates a backup job. */ public final String scheduleExpression() { return scheduleExpression; } /** *

* A value in minutes after a backup is scheduled before a job will be canceled if it doesn't start successfully. * This value is optional. If this value is included, it must be at least 60 minutes to avoid errors. *

*

* This parameter has a maximum value of 100 years (52,560,000 minutes). *

*

* During the start window, the backup job status remains in CREATED status until it has successfully * begun or until the start window time has run out. If within the start window time Backup receives an error that * allows the job to be retried, Backup will automatically retry to begin the job at least every 10 minutes until * the backup successfully begins (the job status changes to RUNNING) or until the job status changes * to EXPIRED (which is expected to occur when the start window time is over). *

* * @return A value in minutes after a backup is scheduled before a job will be canceled if it doesn't start * successfully. This value is optional. If this value is included, it must be at least 60 minutes to avoid * errors.

*

* This parameter has a maximum value of 100 years (52,560,000 minutes). *

*

* During the start window, the backup job status remains in CREATED status until it has * successfully begun or until the start window time has run out. If within the start window time Backup * receives an error that allows the job to be retried, Backup will automatically retry to begin the job at * least every 10 minutes until the backup successfully begins (the job status changes to * RUNNING) or until the job status changes to EXPIRED (which is expected to occur * when the start window time is over). */ public final Long startWindowMinutes() { return startWindowMinutes; } /** *

* A value in minutes after a backup job is successfully started before it must be completed or it will be canceled * by Backup. This value is optional. *

* * @return A value in minutes after a backup job is successfully started before it must be completed or it will be * canceled by Backup. This value is optional. */ public final Long completionWindowMinutes() { return completionWindowMinutes; } /** *

* The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. 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 * “retention” 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 storage. *

*

* Resource types that can transition to cold storage are listed in the Feature availability by resource table. Backup ignores this expression for other resource types. *

*

* This parameter has a maximum value of 100 years (36,500 days). *

* * @return The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. * 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 “retention” 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 * storage. *

*

* Resource types that can transition to cold storage are listed in the Feature availability by resource table. Backup ignores this expression for other resource types. *

*

* This parameter has a maximum value of 100 years (36,500 days). */ public final Lifecycle lifecycle() { return lifecycle; } /** * For responses, this returns true if the service returned a value for the RecoveryPointTags 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 hasRecoveryPointTags() { return recoveryPointTags != null && !(recoveryPointTags instanceof SdkAutoConstructMap); } /** *

* The tags to assign to the resources. *

*

* 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 #hasRecoveryPointTags} method. *

* * @return The tags to assign to the resources. */ public final Map recoveryPointTags() { return recoveryPointTags; } /** * For responses, this returns true if the service returned a value for the CopyActions 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 hasCopyActions() { return copyActions != null && !(copyActions instanceof SdkAutoConstructList); } /** *

* An array of CopyAction objects, which contains the details of the copy operation. *

*

* 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 #hasCopyActions} method. *

* * @return An array of CopyAction objects, which contains the details of the copy operation. */ public final List copyActions() { return copyActions; } /** *

* Specifies whether Backup creates continuous backups. True causes Backup to create continuous backups capable of * point-in-time restore (PITR). False (or not specified) causes Backup to create snapshot backups. *

* * @return Specifies whether Backup creates continuous backups. True causes Backup to create continuous backups * capable of point-in-time restore (PITR). False (or not specified) causes Backup to create snapshot * backups. */ public final Boolean enableContinuousBackup() { return enableContinuousBackup; } /** *

* The timezone in which the schedule expression is set. By default, ScheduleExpressions are in UTC. You can modify * this to a specified timezone. *

* * @return The timezone in which the schedule expression is set. By default, ScheduleExpressions are in UTC. You can * modify this to a specified timezone. */ public final String scheduleExpressionTimezone() { return scheduleExpressionTimezone; } /** * For responses, this returns true if the service returned a value for the IndexActions 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 hasIndexActions() { return indexActions != null && !(indexActions instanceof SdkAutoConstructList); } /** *

* There can up to one IndexAction in each BackupRule, as each backup can have 0 or 1 backup index associated with * it. *

*

* Within the array is ResourceTypes. Only 1 resource type will be accepted for each BackupRule. Valid values: *

*
    *
  • *

    * EBS for Amazon Elastic Block Store *

    *
  • *
  • *

    * S3 for Amazon Simple Storage Service (Amazon S3) *

    *
  • *
*

* 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 #hasIndexActions} method. *

* * @return There can up to one IndexAction in each BackupRule, as each backup can have 0 or 1 backup index * associated with it.

*

* Within the array is ResourceTypes. Only 1 resource type will be accepted for each BackupRule. Valid * values: *

*
    *
  • *

    * EBS for Amazon Elastic Block Store *

    *
  • *
  • *

    * S3 for Amazon Simple Storage Service (Amazon S3) *

    *
  • */ public final List indexActions() { return indexActions; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(ruleName()); hashCode = 31 * hashCode + Objects.hashCode(targetBackupVaultName()); hashCode = 31 * hashCode + Objects.hashCode(scheduleExpression()); hashCode = 31 * hashCode + Objects.hashCode(startWindowMinutes()); hashCode = 31 * hashCode + Objects.hashCode(completionWindowMinutes()); hashCode = 31 * hashCode + Objects.hashCode(lifecycle()); hashCode = 31 * hashCode + Objects.hashCode(hasRecoveryPointTags() ? recoveryPointTags() : null); hashCode = 31 * hashCode + Objects.hashCode(hasCopyActions() ? copyActions() : null); hashCode = 31 * hashCode + Objects.hashCode(enableContinuousBackup()); hashCode = 31 * hashCode + Objects.hashCode(scheduleExpressionTimezone()); hashCode = 31 * hashCode + Objects.hashCode(hasIndexActions() ? indexActions() : null); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof BackupRuleInput)) { return false; } BackupRuleInput other = (BackupRuleInput) obj; return Objects.equals(ruleName(), other.ruleName()) && Objects.equals(targetBackupVaultName(), other.targetBackupVaultName()) && Objects.equals(scheduleExpression(), other.scheduleExpression()) && Objects.equals(startWindowMinutes(), other.startWindowMinutes()) && Objects.equals(completionWindowMinutes(), other.completionWindowMinutes()) && Objects.equals(lifecycle(), other.lifecycle()) && hasRecoveryPointTags() == other.hasRecoveryPointTags() && Objects.equals(recoveryPointTags(), other.recoveryPointTags()) && hasCopyActions() == other.hasCopyActions() && Objects.equals(copyActions(), other.copyActions()) && Objects.equals(enableContinuousBackup(), other.enableContinuousBackup()) && Objects.equals(scheduleExpressionTimezone(), other.scheduleExpressionTimezone()) && hasIndexActions() == other.hasIndexActions() && Objects.equals(indexActions(), other.indexActions()); } /** * 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("BackupRuleInput").add("RuleName", ruleName()) .add("TargetBackupVaultName", targetBackupVaultName()).add("ScheduleExpression", scheduleExpression()) .add("StartWindowMinutes", startWindowMinutes()).add("CompletionWindowMinutes", completionWindowMinutes()) .add("Lifecycle", lifecycle()) .add("RecoveryPointTags", recoveryPointTags() == null ? null : "*** Sensitive Data Redacted ***") .add("CopyActions", hasCopyActions() ? copyActions() : null) .add("EnableContinuousBackup", enableContinuousBackup()) .add("ScheduleExpressionTimezone", scheduleExpressionTimezone()) .add("IndexActions", hasIndexActions() ? indexActions() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "RuleName": return Optional.ofNullable(clazz.cast(ruleName())); case "TargetBackupVaultName": return Optional.ofNullable(clazz.cast(targetBackupVaultName())); case "ScheduleExpression": return Optional.ofNullable(clazz.cast(scheduleExpression())); case "StartWindowMinutes": return Optional.ofNullable(clazz.cast(startWindowMinutes())); case "CompletionWindowMinutes": return Optional.ofNullable(clazz.cast(completionWindowMinutes())); case "Lifecycle": return Optional.ofNullable(clazz.cast(lifecycle())); case "RecoveryPointTags": return Optional.ofNullable(clazz.cast(recoveryPointTags())); case "CopyActions": return Optional.ofNullable(clazz.cast(copyActions())); case "EnableContinuousBackup": return Optional.ofNullable(clazz.cast(enableContinuousBackup())); case "ScheduleExpressionTimezone": return Optional.ofNullable(clazz.cast(scheduleExpressionTimezone())); case "IndexActions": return Optional.ofNullable(clazz.cast(indexActions())); 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("RuleName", RULE_NAME_FIELD); map.put("TargetBackupVaultName", TARGET_BACKUP_VAULT_NAME_FIELD); map.put("ScheduleExpression", SCHEDULE_EXPRESSION_FIELD); map.put("StartWindowMinutes", START_WINDOW_MINUTES_FIELD); map.put("CompletionWindowMinutes", COMPLETION_WINDOW_MINUTES_FIELD); map.put("Lifecycle", LIFECYCLE_FIELD); map.put("RecoveryPointTags", RECOVERY_POINT_TAGS_FIELD); map.put("CopyActions", COPY_ACTIONS_FIELD); map.put("EnableContinuousBackup", ENABLE_CONTINUOUS_BACKUP_FIELD); map.put("ScheduleExpressionTimezone", SCHEDULE_EXPRESSION_TIMEZONE_FIELD); map.put("IndexActions", INDEX_ACTIONS_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((BackupRuleInput) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

    * A display name for a backup rule. Must contain 1 to 50 alphanumeric or '-_.' characters. *

    * * @param ruleName * A display name for a backup rule. Must contain 1 to 50 alphanumeric or '-_.' characters. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ruleName(String ruleName); /** *

    * 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. *

    * * @param targetBackupVaultName * 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. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetBackupVaultName(String targetBackupVaultName); /** *

    * A CRON expression in UTC specifying when Backup initiates a backup job. *

    * * @param scheduleExpression * A CRON expression in UTC specifying when Backup initiates a backup job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder scheduleExpression(String scheduleExpression); /** *

    * A value in minutes after a backup is scheduled before a job will be canceled if it doesn't start * successfully. This value is optional. If this value is included, it must be at least 60 minutes to avoid * errors. *

    *

    * This parameter has a maximum value of 100 years (52,560,000 minutes). *

    *

    * During the start window, the backup job status remains in CREATED status until it has * successfully begun or until the start window time has run out. If within the start window time Backup * receives an error that allows the job to be retried, Backup will automatically retry to begin the job at * least every 10 minutes until the backup successfully begins (the job status changes to RUNNING) * or until the job status changes to EXPIRED (which is expected to occur when the start window * time is over). *

    * * @param startWindowMinutes * A value in minutes after a backup is scheduled before a job will be canceled if it doesn't start * successfully. This value is optional. If this value is included, it must be at least 60 minutes to * avoid errors.

    *

    * This parameter has a maximum value of 100 years (52,560,000 minutes). *

    *

    * During the start window, the backup job status remains in CREATED status until it has * successfully begun or until the start window time has run out. If within the start window time Backup * receives an error that allows the job to be retried, Backup will automatically retry to begin the job * at least every 10 minutes until the backup successfully begins (the job status changes to * RUNNING) or until the job status changes to EXPIRED (which is expected to * occur when the start window time is over). * @return Returns a reference to this object so that method calls can be chained together. */ Builder startWindowMinutes(Long startWindowMinutes); /** *

    * A value in minutes after a backup job is successfully started before it must be completed or it will be * canceled by Backup. This value is optional. *

    * * @param completionWindowMinutes * A value in minutes after a backup job is successfully started before it must be completed or it will * be canceled by Backup. This value is optional. * @return Returns a reference to this object so that method calls can be chained together. */ Builder completionWindowMinutes(Long completionWindowMinutes); /** *

    * The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. 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 * “retention” 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 storage. *

    *

    * Resource types that can transition to cold storage are listed in the Feature availability by resource table. Backup ignores this expression for other resource types. *

    *

    * This parameter has a maximum value of 100 years (36,500 days). *

    * * @param lifecycle * The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. * 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 “retention” 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 storage. *

    *

    * Resource types that can transition to cold storage are listed in the Feature availability by resource table. Backup ignores this expression for other resource types. *

    *

    * This parameter has a maximum value of 100 years (36,500 days). * @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. 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 * “retention” 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 storage. *

    *

    * Resource types that can transition to cold storage are listed in the Feature availability by resource table. Backup ignores this expression for other resource types. *

    *

    * This parameter has a maximum value of 100 years (36,500 days). *

    * This is a convenience method 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()); } /** *

    * The tags to assign to the resources. *

    * * @param recoveryPointTags * The tags to assign to the resources. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recoveryPointTags(Map recoveryPointTags); /** *

    * An array of CopyAction objects, which contains the details of the copy operation. *

    * * @param copyActions * An array of CopyAction objects, which contains the details of the copy operation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder copyActions(Collection copyActions); /** *

    * An array of CopyAction objects, which contains the details of the copy operation. *

    * * @param copyActions * An array of CopyAction objects, which contains the details of the copy operation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder copyActions(CopyAction... copyActions); /** *

    * An array of CopyAction objects, which contains the details of the copy operation. *

    * This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.backup.model.CopyAction.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.backup.model.CopyAction#builder()}. * *

    * When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.backup.model.CopyAction.Builder#build()} is called immediately and its * result is passed to {@link #copyActions(List)}. * * @param copyActions * a consumer that will call methods on * {@link software.amazon.awssdk.services.backup.model.CopyAction.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #copyActions(java.util.Collection) */ Builder copyActions(Consumer... copyActions); /** *

    * Specifies whether Backup creates continuous backups. True causes Backup to create continuous backups capable * of point-in-time restore (PITR). False (or not specified) causes Backup to create snapshot backups. *

    * * @param enableContinuousBackup * Specifies whether Backup creates continuous backups. True causes Backup to create continuous backups * capable of point-in-time restore (PITR). False (or not specified) causes Backup to create snapshot * backups. * @return Returns a reference to this object so that method calls can be chained together. */ Builder enableContinuousBackup(Boolean enableContinuousBackup); /** *

    * The timezone in which the schedule expression is set. By default, ScheduleExpressions are in UTC. You can * modify this to a specified timezone. *

    * * @param scheduleExpressionTimezone * The timezone in which the schedule expression is set. By default, ScheduleExpressions are in UTC. You * can modify this to a specified timezone. * @return Returns a reference to this object so that method calls can be chained together. */ Builder scheduleExpressionTimezone(String scheduleExpressionTimezone); /** *

    * There can up to one IndexAction in each BackupRule, as each backup can have 0 or 1 backup index associated * with it. *

    *

    * Within the array is ResourceTypes. Only 1 resource type will be accepted for each BackupRule. Valid values: *

    *
      *
    • *

      * EBS for Amazon Elastic Block Store *

      *
    • *
    • *

      * S3 for Amazon Simple Storage Service (Amazon S3) *

      *
    • *
    * * @param indexActions * There can up to one IndexAction in each BackupRule, as each backup can have 0 or 1 backup index * associated with it.

    *

    * Within the array is ResourceTypes. Only 1 resource type will be accepted for each BackupRule. Valid * values: *

    *
      *
    • *

      * EBS for Amazon Elastic Block Store *

      *
    • *
    • *

      * S3 for Amazon Simple Storage Service (Amazon S3) *

      *
    • * @return Returns a reference to this object so that method calls can be chained together. */ Builder indexActions(Collection indexActions); /** *

      * There can up to one IndexAction in each BackupRule, as each backup can have 0 or 1 backup index associated * with it. *

      *

      * Within the array is ResourceTypes. Only 1 resource type will be accepted for each BackupRule. Valid values: *

      *
        *
      • *

        * EBS for Amazon Elastic Block Store *

        *
      • *
      • *

        * S3 for Amazon Simple Storage Service (Amazon S3) *

        *
      • *
      * * @param indexActions * There can up to one IndexAction in each BackupRule, as each backup can have 0 or 1 backup index * associated with it.

      *

      * Within the array is ResourceTypes. Only 1 resource type will be accepted for each BackupRule. Valid * values: *

      *
        *
      • *

        * EBS for Amazon Elastic Block Store *

        *
      • *
      • *

        * S3 for Amazon Simple Storage Service (Amazon S3) *

        *
      • * @return Returns a reference to this object so that method calls can be chained together. */ Builder indexActions(IndexAction... indexActions); /** *

        * There can up to one IndexAction in each BackupRule, as each backup can have 0 or 1 backup index associated * with it. *

        *

        * Within the array is ResourceTypes. Only 1 resource type will be accepted for each BackupRule. Valid values: *

        *
          *
        • *

          * EBS for Amazon Elastic Block Store *

          *
        • *
        • *

          * S3 for Amazon Simple Storage Service (Amazon S3) *

          *
        • *
        * This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.backup.model.IndexAction.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.backup.model.IndexAction#builder()}. * *

        * When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.backup.model.IndexAction.Builder#build()} is called immediately and * its result is passed to {@link #indexActions(List)}. * * @param indexActions * a consumer that will call methods on * {@link software.amazon.awssdk.services.backup.model.IndexAction.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #indexActions(java.util.Collection) */ Builder indexActions(Consumer... indexActions); } static final class BuilderImpl implements Builder { private String ruleName; private String targetBackupVaultName; private String scheduleExpression; private Long startWindowMinutes; private Long completionWindowMinutes; private Lifecycle lifecycle; private Map recoveryPointTags = DefaultSdkAutoConstructMap.getInstance(); private List copyActions = DefaultSdkAutoConstructList.getInstance(); private Boolean enableContinuousBackup; private String scheduleExpressionTimezone; private List indexActions = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(BackupRuleInput model) { ruleName(model.ruleName); targetBackupVaultName(model.targetBackupVaultName); scheduleExpression(model.scheduleExpression); startWindowMinutes(model.startWindowMinutes); completionWindowMinutes(model.completionWindowMinutes); lifecycle(model.lifecycle); recoveryPointTags(model.recoveryPointTags); copyActions(model.copyActions); enableContinuousBackup(model.enableContinuousBackup); scheduleExpressionTimezone(model.scheduleExpressionTimezone); indexActions(model.indexActions); } public final String getRuleName() { return ruleName; } public final void setRuleName(String ruleName) { this.ruleName = ruleName; } @Override public final Builder ruleName(String ruleName) { this.ruleName = ruleName; return this; } public final String getTargetBackupVaultName() { return targetBackupVaultName; } public final void setTargetBackupVaultName(String targetBackupVaultName) { this.targetBackupVaultName = targetBackupVaultName; } @Override public final Builder targetBackupVaultName(String targetBackupVaultName) { this.targetBackupVaultName = targetBackupVaultName; return this; } public final String getScheduleExpression() { return scheduleExpression; } public final void setScheduleExpression(String scheduleExpression) { this.scheduleExpression = scheduleExpression; } @Override public final Builder scheduleExpression(String scheduleExpression) { this.scheduleExpression = scheduleExpression; return this; } public final Long getStartWindowMinutes() { return startWindowMinutes; } public final void setStartWindowMinutes(Long startWindowMinutes) { this.startWindowMinutes = startWindowMinutes; } @Override public final Builder startWindowMinutes(Long startWindowMinutes) { this.startWindowMinutes = startWindowMinutes; return this; } public final Long getCompletionWindowMinutes() { return completionWindowMinutes; } public final void setCompletionWindowMinutes(Long completionWindowMinutes) { this.completionWindowMinutes = completionWindowMinutes; } @Override public final Builder completionWindowMinutes(Long completionWindowMinutes) { this.completionWindowMinutes = completionWindowMinutes; return this; } public final Lifecycle.Builder getLifecycle() { return lifecycle != null ? lifecycle.toBuilder() : null; } public final void setLifecycle(Lifecycle.BuilderImpl lifecycle) { this.lifecycle = lifecycle != null ? lifecycle.build() : null; } @Override public final Builder lifecycle(Lifecycle lifecycle) { this.lifecycle = lifecycle; return this; } public final Map getRecoveryPointTags() { if (recoveryPointTags instanceof SdkAutoConstructMap) { return null; } return recoveryPointTags; } public final void setRecoveryPointTags(Map recoveryPointTags) { this.recoveryPointTags = TagsCopier.copy(recoveryPointTags); } @Override public final Builder recoveryPointTags(Map recoveryPointTags) { this.recoveryPointTags = TagsCopier.copy(recoveryPointTags); return this; } public final List getCopyActions() { List result = CopyActionsCopier.copyToBuilder(this.copyActions); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setCopyActions(Collection copyActions) { this.copyActions = CopyActionsCopier.copyFromBuilder(copyActions); } @Override public final Builder copyActions(Collection copyActions) { this.copyActions = CopyActionsCopier.copy(copyActions); return this; } @Override @SafeVarargs public final Builder copyActions(CopyAction... copyActions) { copyActions(Arrays.asList(copyActions)); return this; } @Override @SafeVarargs public final Builder copyActions(Consumer... copyActions) { copyActions(Stream.of(copyActions).map(c -> CopyAction.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final Boolean getEnableContinuousBackup() { return enableContinuousBackup; } public final void setEnableContinuousBackup(Boolean enableContinuousBackup) { this.enableContinuousBackup = enableContinuousBackup; } @Override public final Builder enableContinuousBackup(Boolean enableContinuousBackup) { this.enableContinuousBackup = enableContinuousBackup; return this; } public final String getScheduleExpressionTimezone() { return scheduleExpressionTimezone; } public final void setScheduleExpressionTimezone(String scheduleExpressionTimezone) { this.scheduleExpressionTimezone = scheduleExpressionTimezone; } @Override public final Builder scheduleExpressionTimezone(String scheduleExpressionTimezone) { this.scheduleExpressionTimezone = scheduleExpressionTimezone; return this; } public final List getIndexActions() { List result = IndexActionsCopier.copyToBuilder(this.indexActions); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setIndexActions(Collection indexActions) { this.indexActions = IndexActionsCopier.copyFromBuilder(indexActions); } @Override public final Builder indexActions(Collection indexActions) { this.indexActions = IndexActionsCopier.copy(indexActions); return this; } @Override @SafeVarargs public final Builder indexActions(IndexAction... indexActions) { indexActions(Arrays.asList(indexActions)); return this; } @Override @SafeVarargs public final Builder indexActions(Consumer... indexActions) { indexActions(Stream.of(indexActions).map(c -> IndexAction.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public BackupRuleInput build() { return new BackupRuleInput(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy