java.lang.Object
software.amazon.awssdk.services.dlm.model.Script
All Implemented Interfaces:
Serializable, SdkPojo, ToCopyableBuilder<Script.Builder,Script>

@Generated("software.amazon.awssdk:codegen") public final class Script extends Object implements SdkPojo, Serializable, ToCopyableBuilder<Script.Builder,Script>

[Custom snapshot policies that target instances only] Information about pre and/or post scripts for a snapshot lifecycle policy that targets instances. For more information, see Automating application-consistent snapshots with pre and post scripts.

See Also:
  • Method Details

    • stages

      public final List<StageValues> stages()

      Indicate which scripts Amazon Data Lifecycle Manager should run on target instances. Pre scripts run before Amazon Data Lifecycle Manager initiates snapshot creation. Post scripts run after Amazon Data Lifecycle Manager initiates snapshot creation.

      • To run a pre script only, specify PRE. In this case, Amazon Data Lifecycle Manager calls the SSM document with the pre-script parameter before initiating snapshot creation.

      • To run a post script only, specify POST. In this case, Amazon Data Lifecycle Manager calls the SSM document with the post-script parameter after initiating snapshot creation.

      • To run both pre and post scripts, specify both PRE and POST. In this case, Amazon Data Lifecycle Manager calls the SSM document with the pre-script parameter before initiating snapshot creation, and then it calls the SSM document again with the post-script parameter after initiating snapshot creation.

      If you are automating VSS Backups, omit this parameter.

      Default: PRE and POST

      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 hasStages() method.

      Returns:
      Indicate which scripts Amazon Data Lifecycle Manager should run on target instances. Pre scripts run before Amazon Data Lifecycle Manager initiates snapshot creation. Post scripts run after Amazon Data Lifecycle Manager initiates snapshot creation.

      • To run a pre script only, specify PRE. In this case, Amazon Data Lifecycle Manager calls the SSM document with the pre-script parameter before initiating snapshot creation.

      • To run a post script only, specify POST. In this case, Amazon Data Lifecycle Manager calls the SSM document with the post-script parameter after initiating snapshot creation.

      • To run both pre and post scripts, specify both PRE and POST. In this case, Amazon Data Lifecycle Manager calls the SSM document with the pre-script parameter before initiating snapshot creation, and then it calls the SSM document again with the post-script parameter after initiating snapshot creation.

      If you are automating VSS Backups, omit this parameter.

      Default: PRE and POST

    • hasStages

      public final boolean hasStages()
      For responses, this returns true if the service returned a value for the Stages property. This DOES NOT check that the value is non-empty (for which, you should check the 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.
    • stagesAsStrings

      public final List<String> stagesAsStrings()

      Indicate which scripts Amazon Data Lifecycle Manager should run on target instances. Pre scripts run before Amazon Data Lifecycle Manager initiates snapshot creation. Post scripts run after Amazon Data Lifecycle Manager initiates snapshot creation.

      • To run a pre script only, specify PRE. In this case, Amazon Data Lifecycle Manager calls the SSM document with the pre-script parameter before initiating snapshot creation.

      • To run a post script only, specify POST. In this case, Amazon Data Lifecycle Manager calls the SSM document with the post-script parameter after initiating snapshot creation.

      • To run both pre and post scripts, specify both PRE and POST. In this case, Amazon Data Lifecycle Manager calls the SSM document with the pre-script parameter before initiating snapshot creation, and then it calls the SSM document again with the post-script parameter after initiating snapshot creation.

      If you are automating VSS Backups, omit this parameter.

      Default: PRE and POST

      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 hasStages() method.

      Returns:
      Indicate which scripts Amazon Data Lifecycle Manager should run on target instances. Pre scripts run before Amazon Data Lifecycle Manager initiates snapshot creation. Post scripts run after Amazon Data Lifecycle Manager initiates snapshot creation.

      • To run a pre script only, specify PRE. In this case, Amazon Data Lifecycle Manager calls the SSM document with the pre-script parameter before initiating snapshot creation.

      • To run a post script only, specify POST. In this case, Amazon Data Lifecycle Manager calls the SSM document with the post-script parameter after initiating snapshot creation.

      • To run both pre and post scripts, specify both PRE and POST. In this case, Amazon Data Lifecycle Manager calls the SSM document with the pre-script parameter before initiating snapshot creation, and then it calls the SSM document again with the post-script parameter after initiating snapshot creation.

      If you are automating VSS Backups, omit this parameter.

      Default: PRE and POST

    • executionHandlerService

      public final ExecutionHandlerServiceValues executionHandlerService()

      Indicates the service used to execute the pre and/or post scripts.

      • If you are using custom SSM documents or automating application-consistent snapshots of SAP HANA workloads, specify AWS_SYSTEMS_MANAGER.

      • If you are automating VSS Backups, omit this parameter.

      Default: AWS_SYSTEMS_MANAGER

      If the service returns an enum value that is not available in the current SDK version, executionHandlerService will return ExecutionHandlerServiceValues.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from executionHandlerServiceAsString().

      Returns:
      Indicates the service used to execute the pre and/or post scripts.

      • If you are using custom SSM documents or automating application-consistent snapshots of SAP HANA workloads, specify AWS_SYSTEMS_MANAGER.

      • If you are automating VSS Backups, omit this parameter.

      Default: AWS_SYSTEMS_MANAGER

      See Also:
    • executionHandlerServiceAsString

      public final String executionHandlerServiceAsString()

      Indicates the service used to execute the pre and/or post scripts.

      • If you are using custom SSM documents or automating application-consistent snapshots of SAP HANA workloads, specify AWS_SYSTEMS_MANAGER.

      • If you are automating VSS Backups, omit this parameter.

      Default: AWS_SYSTEMS_MANAGER

      If the service returns an enum value that is not available in the current SDK version, executionHandlerService will return ExecutionHandlerServiceValues.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from executionHandlerServiceAsString().

      Returns:
      Indicates the service used to execute the pre and/or post scripts.

      • If you are using custom SSM documents or automating application-consistent snapshots of SAP HANA workloads, specify AWS_SYSTEMS_MANAGER.

      • If you are automating VSS Backups, omit this parameter.

      Default: AWS_SYSTEMS_MANAGER

      See Also:
    • executionHandler

      public final String executionHandler()

      The SSM document that includes the pre and/or post scripts to run.

      • If you are automating VSS backups, specify AWS_VSS_BACKUP. In this case, Amazon Data Lifecycle Manager automatically uses the AWSEC2-CreateVssSnapshot SSM document.

      • If you are automating application-consistent snapshots for SAP HANA workloads, specify AWSSystemsManagerSAP-CreateDLMSnapshotForSAPHANA.

      • If you are using a custom SSM document that you own, specify either the name or ARN of the SSM document. If you are using a custom SSM document that is shared with you, specify the ARN of the SSM document.

      Returns:
      The SSM document that includes the pre and/or post scripts to run.

      • If you are automating VSS backups, specify AWS_VSS_BACKUP. In this case, Amazon Data Lifecycle Manager automatically uses the AWSEC2-CreateVssSnapshot SSM document.

      • If you are automating application-consistent snapshots for SAP HANA workloads, specify AWSSystemsManagerSAP-CreateDLMSnapshotForSAPHANA.

      • If you are using a custom SSM document that you own, specify either the name or ARN of the SSM document. If you are using a custom SSM document that is shared with you, specify the ARN of the SSM document.

    • executeOperationOnScriptFailure

      public final Boolean executeOperationOnScriptFailure()

      Indicates whether Amazon Data Lifecycle Manager should default to crash-consistent snapshots if the pre script fails.

      • To default to crash consistent snapshot if the pre script fails, specify true.

      • To skip the instance for snapshot creation if the pre script fails, specify false.

      This parameter is supported only if you run a pre script. If you run a post script only, omit this parameter.

      Default: true

      Returns:
      Indicates whether Amazon Data Lifecycle Manager should default to crash-consistent snapshots if the pre script fails.

      • To default to crash consistent snapshot if the pre script fails, specify true.

      • To skip the instance for snapshot creation if the pre script fails, specify false.

      This parameter is supported only if you run a pre script. If you run a post script only, omit this parameter.

      Default: true

    • executionTimeout

      public final Integer executionTimeout()

      Specifies a timeout period, in seconds, after which Amazon Data Lifecycle Manager fails the script run attempt if it has not completed. If a script does not complete within its timeout period, Amazon Data Lifecycle Manager fails the attempt. The timeout period applies to the pre and post scripts individually.

      If you are automating VSS Backups, omit this parameter.

      Default: 10

      Returns:
      Specifies a timeout period, in seconds, after which Amazon Data Lifecycle Manager fails the script run attempt if it has not completed. If a script does not complete within its timeout period, Amazon Data Lifecycle Manager fails the attempt. The timeout period applies to the pre and post scripts individually.

      If you are automating VSS Backups, omit this parameter.

      Default: 10

    • maximumRetryCount

      public final Integer maximumRetryCount()

      Specifies the number of times Amazon Data Lifecycle Manager should retry scripts that fail.

      • If the pre script fails, Amazon Data Lifecycle Manager retries the entire snapshot creation process, including running the pre and post scripts.

      • If the post script fails, Amazon Data Lifecycle Manager retries the post script only; in this case, the pre script will have completed and the snapshot might have been created.

      If you do not want Amazon Data Lifecycle Manager to retry failed scripts, specify 0.

      Default: 0

      Returns:
      Specifies the number of times Amazon Data Lifecycle Manager should retry scripts that fail.

      • If the pre script fails, Amazon Data Lifecycle Manager retries the entire snapshot creation process, including running the pre and post scripts.

      • If the post script fails, Amazon Data Lifecycle Manager retries the post script only; in this case, the pre script will have completed and the snapshot might have been created.

      If you do not want Amazon Data Lifecycle Manager to retry failed scripts, specify 0.

      Default: 0

    • toBuilder

      public Script.Builder toBuilder()
      Description copied from interface: ToCopyableBuilder
      Take this object and create a builder that contains all of the current property values of this object.
      Specified by:
      toBuilder in interface ToCopyableBuilder<Script.Builder,Script>
      Returns:
      a builder for type T
    • builder

      public static Script.Builder builder()
    • serializableBuilderClass

      public static Class<? extends Script.Builder> serializableBuilderClass()
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equalsBySdkFields

      public final boolean equalsBySdkFields(Object obj)
      Description copied from interface: SdkPojo
      Indicates whether some other object is "equal to" this one by SDK fields. An SDK field is a modeled, non-inherited field in an SdkPojo class, and is generated based on a service model.

      If an SdkPojo class does not have any inherited fields, equalsBySdkFields and equals are essentially the same.

      Specified by:
      equalsBySdkFields in interface SdkPojo
      Parameters:
      obj - the object to be compared with
      Returns:
      true if the other object equals to this object by sdk fields, false otherwise.
    • toString

      public final String toString()
      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.
      Overrides:
      toString in class Object
    • getValueForField

      public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
    • sdkFields

      public final List<SdkField<?>> sdkFields()
      Specified by:
      sdkFields in interface SdkPojo
      Returns:
      List of SdkField in this POJO. May be empty list but should never be null.