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

software.amazon.awssdk.services.s3.model.DeleteObjectsRequest Maven / Gradle / Ivy

/*
 * 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.s3.model;

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.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.PayloadTrait;
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 DeleteObjectsRequest extends S3Request implements
        ToCopyableBuilder {
    private static final SdkField BUCKET_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(DeleteObjectsRequest::bucket))
            .setter(setter(Builder::bucket))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("Bucket")
                    .unmarshallLocationName("Bucket").build()).build();

    private static final SdkField DELETE_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO)
            .getter(getter(DeleteObjectsRequest::delete))
            .setter(setter(Builder::delete))
            .constructor(Delete::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Delete")
                    .unmarshallLocationName("Delete").build(), PayloadTrait.create()).build();

    private static final SdkField MFA_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(DeleteObjectsRequest::mfa))
            .setter(setter(Builder::mfa))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-mfa")
                    .unmarshallLocationName("x-amz-mfa").build()).build();

    private static final SdkField REQUEST_PAYER_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(DeleteObjectsRequest::requestPayerAsString))
            .setter(setter(Builder::requestPayer))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-request-payer")
                    .unmarshallLocationName("x-amz-request-payer").build()).build();

    private static final SdkField BYPASS_GOVERNANCE_RETENTION_FIELD = SdkField
            . builder(MarshallingType.BOOLEAN)
            .getter(getter(DeleteObjectsRequest::bypassGovernanceRetention))
            .setter(setter(Builder::bypassGovernanceRetention))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-bypass-governance-retention")
                    .unmarshallLocationName("x-amz-bypass-governance-retention").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BUCKET_FIELD, DELETE_FIELD,
            MFA_FIELD, REQUEST_PAYER_FIELD, BYPASS_GOVERNANCE_RETENTION_FIELD));

    private final String bucket;

    private final Delete delete;

    private final String mfa;

    private final String requestPayer;

    private final Boolean bypassGovernanceRetention;

    private DeleteObjectsRequest(BuilderImpl builder) {
        super(builder);
        this.bucket = builder.bucket;
        this.delete = builder.delete;
        this.mfa = builder.mfa;
        this.requestPayer = builder.requestPayer;
        this.bypassGovernanceRetention = builder.bypassGovernanceRetention;
    }

    /**
     * 

* The bucket name containing the objects to delete. *

*

* When using this API with an access point, you must direct requests to the access point hostname. The access point * hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When * using this operation using an access point through the AWS SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using Access Points in the * Amazon Simple Storage Service Developer Guide. *

* * @return The bucket name containing the objects to delete.

*

* When using this API with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * operation using an access point through the AWS SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using Access Points * in the Amazon Simple Storage Service Developer Guide. */ public String bucket() { return bucket; } /** *

* Container for the request. *

* * @return Container for the request. */ public Delete delete() { return delete; } /** *

* The concatenation of the authentication device's serial number, a space, and the value that is displayed on your * authentication device. Required to permanently delete a versioned object if versioning is configured with MFA * delete enabled. *

* * @return The concatenation of the authentication device's serial number, a space, and the value that is displayed * on your authentication device. Required to permanently delete a versioned object if versioning is * configured with MFA delete enabled. */ public String mfa() { return mfa; } /** * Returns the value of the RequestPayer property for this object. *

* If the service returns an enum value that is not available in the current SDK version, {@link #requestPayer} will * return {@link RequestPayer#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #requestPayerAsString}. *

* * @return The value of the RequestPayer property for this object. * @see RequestPayer */ public RequestPayer requestPayer() { return RequestPayer.fromValue(requestPayer); } /** * Returns the value of the RequestPayer property for this object. *

* If the service returns an enum value that is not available in the current SDK version, {@link #requestPayer} will * return {@link RequestPayer#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #requestPayerAsString}. *

* * @return The value of the RequestPayer property for this object. * @see RequestPayer */ public String requestPayerAsString() { return requestPayer; } /** *

* Specifies whether you want to delete this object even if it has a Governance-type Object Lock in place. You must * have sufficient permissions to perform this operation. *

* * @return Specifies whether you want to delete this object even if it has a Governance-type Object Lock in place. * You must have sufficient permissions to perform this operation. */ public Boolean bypassGovernanceRetention() { return bypassGovernanceRetention; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(bucket()); hashCode = 31 * hashCode + Objects.hashCode(delete()); hashCode = 31 * hashCode + Objects.hashCode(mfa()); hashCode = 31 * hashCode + Objects.hashCode(requestPayerAsString()); hashCode = 31 * hashCode + Objects.hashCode(bypassGovernanceRetention()); return hashCode; } @Override public boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DeleteObjectsRequest)) { return false; } DeleteObjectsRequest other = (DeleteObjectsRequest) obj; return Objects.equals(bucket(), other.bucket()) && Objects.equals(delete(), other.delete()) && Objects.equals(mfa(), other.mfa()) && Objects.equals(requestPayerAsString(), other.requestPayerAsString()) && Objects.equals(bypassGovernanceRetention(), other.bypassGovernanceRetention()); } /** * 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("DeleteObjectsRequest").add("Bucket", bucket()).add("Delete", delete()).add("MFA", mfa()) .add("RequestPayer", requestPayerAsString()).add("BypassGovernanceRetention", bypassGovernanceRetention()) .build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Bucket": return Optional.ofNullable(clazz.cast(bucket())); case "Delete": return Optional.ofNullable(clazz.cast(delete())); case "MFA": return Optional.ofNullable(clazz.cast(mfa())); case "RequestPayer": return Optional.ofNullable(clazz.cast(requestPayerAsString())); case "BypassGovernanceRetention": return Optional.ofNullable(clazz.cast(bypassGovernanceRetention())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DeleteObjectsRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends S3Request.Builder, SdkPojo, CopyableBuilder { /** *

* The bucket name containing the objects to delete. *

*

* When using this API with an access point, you must direct requests to the access point hostname. The access * point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this operation * using an access point through the AWS SDKs, you provide the access point ARN in place of the bucket name. For * more information about access point ARNs, see Using Access Points in * the Amazon Simple Storage Service Developer Guide. *

* * @param bucket * The bucket name containing the objects to delete.

*

* When using this API with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * operation using an access point through the AWS SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using Access * Points in the Amazon Simple Storage Service Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder bucket(String bucket); /** *

* Container for the request. *

* * @param delete * Container for the request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder delete(Delete delete); /** *

* Container for the request. *

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

* The concatenation of the authentication device's serial number, a space, and the value that is displayed on * your authentication device. Required to permanently delete a versioned object if versioning is configured * with MFA delete enabled. *

* * @param mfa * The concatenation of the authentication device's serial number, a space, and the value that is * displayed on your authentication device. Required to permanently delete a versioned object if * versioning is configured with MFA delete enabled. * @return Returns a reference to this object so that method calls can be chained together. */ Builder mfa(String mfa); /** * Sets the value of the RequestPayer property for this object. * * @param requestPayer * The new value for the RequestPayer property for this object. * @see RequestPayer * @return Returns a reference to this object so that method calls can be chained together. * @see RequestPayer */ Builder requestPayer(String requestPayer); /** * Sets the value of the RequestPayer property for this object. * * @param requestPayer * The new value for the RequestPayer property for this object. * @see RequestPayer * @return Returns a reference to this object so that method calls can be chained together. * @see RequestPayer */ Builder requestPayer(RequestPayer requestPayer); /** *

* Specifies whether you want to delete this object even if it has a Governance-type Object Lock in place. You * must have sufficient permissions to perform this operation. *

* * @param bypassGovernanceRetention * Specifies whether you want to delete this object even if it has a Governance-type Object Lock in * place. You must have sufficient permissions to perform this operation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder bypassGovernanceRetention(Boolean bypassGovernanceRetention); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends S3Request.BuilderImpl implements Builder { private String bucket; private Delete delete; private String mfa; private String requestPayer; private Boolean bypassGovernanceRetention; private BuilderImpl() { } private BuilderImpl(DeleteObjectsRequest model) { super(model); bucket(model.bucket); delete(model.delete); mfa(model.mfa); requestPayer(model.requestPayer); bypassGovernanceRetention(model.bypassGovernanceRetention); } public final String getBucket() { return bucket; } @Override public final Builder bucket(String bucket) { this.bucket = bucket; return this; } public final void setBucket(String bucket) { this.bucket = bucket; } public final Delete.Builder getDelete() { return delete != null ? delete.toBuilder() : null; } @Override public final Builder delete(Delete delete) { this.delete = delete; return this; } public final void setDelete(Delete.BuilderImpl delete) { this.delete = delete != null ? delete.build() : null; } public final String getMfa() { return mfa; } @Override public final Builder mfa(String mfa) { this.mfa = mfa; return this; } public final void setMfa(String mfa) { this.mfa = mfa; } public final String getRequestPayer() { return requestPayer; } @Override public final Builder requestPayer(String requestPayer) { this.requestPayer = requestPayer; return this; } @Override public final Builder requestPayer(RequestPayer requestPayer) { this.requestPayer(requestPayer == null ? null : requestPayer.toString()); return this; } public final void setRequestPayer(String requestPayer) { this.requestPayer = requestPayer; } public final Boolean getBypassGovernanceRetention() { return bypassGovernanceRetention; } @Override public final Builder bypassGovernanceRetention(Boolean bypassGovernanceRetention) { this.bypassGovernanceRetention = bypassGovernanceRetention; return this; } public final void setBypassGovernanceRetention(Boolean bypassGovernanceRetention) { this.bypassGovernanceRetention = bypassGovernanceRetention; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public DeleteObjectsRequest build() { return new DeleteObjectsRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy