software.amazon.awssdk.services.s3control.model.S3InitiateRestoreObjectOperation Maven / Gradle / Ivy
Show all versions of s3control Show documentation
/*
* 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.s3control.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Contains the configuration parameters for an S3 Initiate Restore Object job. S3 Batch Operations passes every object
* to the underlying POST Object restore API. For more information about the parameters for this operation, see RestoreObject.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class S3InitiateRestoreObjectOperation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField EXPIRATION_IN_DAYS_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("ExpirationInDays")
.getter(getter(S3InitiateRestoreObjectOperation::expirationInDays))
.setter(setter(Builder::expirationInDays))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpirationInDays")
.unmarshallLocationName("ExpirationInDays").build()).build();
private static final SdkField GLACIER_JOB_TIER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("GlacierJobTier")
.getter(getter(S3InitiateRestoreObjectOperation::glacierJobTierAsString))
.setter(setter(Builder::glacierJobTier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlacierJobTier")
.unmarshallLocationName("GlacierJobTier").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(EXPIRATION_IN_DAYS_FIELD,
GLACIER_JOB_TIER_FIELD));
private static final long serialVersionUID = 1L;
private final Integer expirationInDays;
private final String glacierJobTier;
private S3InitiateRestoreObjectOperation(BuilderImpl builder) {
this.expirationInDays = builder.expirationInDays;
this.glacierJobTier = builder.glacierJobTier;
}
/**
*
* This argument specifies how long the S3 Glacier or S3 Glacier Deep Archive object remains available in Amazon S3.
* S3 Initiate Restore Object jobs that target S3 Glacier and S3 Glacier Deep Archive objects require
* ExpirationInDays
set to 1 or greater.
*
*
* Conversely, do not set ExpirationInDays
when creating S3 Initiate Restore Object jobs that
* target S3 Intelligent-Tiering Archive Access and Deep Archive Access tier objects. Objects in S3
* Intelligent-Tiering archive access tiers are not subject to restore expiry, so specifying
* ExpirationInDays
results in restore request failure.
*
*
* S3 Batch Operations jobs can operate either on S3 Glacier and S3 Glacier Deep Archive storage class objects or on
* S3 Intelligent-Tiering Archive Access and Deep Archive Access storage tier objects, but not both types in the
* same job. If you need to restore objects of both types you must create separate Batch Operations jobs.
*
*
* @return This argument specifies how long the S3 Glacier or S3 Glacier Deep Archive object remains available in
* Amazon S3. S3 Initiate Restore Object jobs that target S3 Glacier and S3 Glacier Deep Archive objects
* require ExpirationInDays
set to 1 or greater.
*
* Conversely, do not set ExpirationInDays
when creating S3 Initiate Restore Object jobs
* that target S3 Intelligent-Tiering Archive Access and Deep Archive Access tier objects. Objects in S3
* Intelligent-Tiering archive access tiers are not subject to restore expiry, so specifying
* ExpirationInDays
results in restore request failure.
*
*
* S3 Batch Operations jobs can operate either on S3 Glacier and S3 Glacier Deep Archive storage class
* objects or on S3 Intelligent-Tiering Archive Access and Deep Archive Access storage tier objects, but not
* both types in the same job. If you need to restore objects of both types you must create separate
* Batch Operations jobs.
*/
public final Integer expirationInDays() {
return expirationInDays;
}
/**
*
* S3 Batch Operations supports STANDARD
and BULK
retrieval tiers, but not the
* EXPEDITED
retrieval tier.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #glacierJobTier}
* will return {@link S3GlacierJobTier#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #glacierJobTierAsString}.
*
*
* @return S3 Batch Operations supports STANDARD
and BULK
retrieval tiers, but not the
* EXPEDITED
retrieval tier.
* @see S3GlacierJobTier
*/
public final S3GlacierJobTier glacierJobTier() {
return S3GlacierJobTier.fromValue(glacierJobTier);
}
/**
*
* S3 Batch Operations supports STANDARD
and BULK
retrieval tiers, but not the
* EXPEDITED
retrieval tier.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #glacierJobTier}
* will return {@link S3GlacierJobTier#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #glacierJobTierAsString}.
*
*
* @return S3 Batch Operations supports STANDARD
and BULK
retrieval tiers, but not the
* EXPEDITED
retrieval tier.
* @see S3GlacierJobTier
*/
public final String glacierJobTierAsString() {
return glacierJobTier;
}
@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 + Objects.hashCode(expirationInDays());
hashCode = 31 * hashCode + Objects.hashCode(glacierJobTierAsString());
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 S3InitiateRestoreObjectOperation)) {
return false;
}
S3InitiateRestoreObjectOperation other = (S3InitiateRestoreObjectOperation) obj;
return Objects.equals(expirationInDays(), other.expirationInDays())
&& Objects.equals(glacierJobTierAsString(), other.glacierJobTierAsString());
}
/**
* 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("S3InitiateRestoreObjectOperation").add("ExpirationInDays", expirationInDays())
.add("GlacierJobTier", glacierJobTierAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ExpirationInDays":
return Optional.ofNullable(clazz.cast(expirationInDays()));
case "GlacierJobTier":
return Optional.ofNullable(clazz.cast(glacierJobTierAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function