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

software.amazon.awssdk.services.mediastoredata.model.PutObjectRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Elemental MediaStore Data module holds the client classes that are used for communicating with AWS Elemental MediaStore Data Plane Service

There is a newer version: 2.29.39
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.mediastoredata.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class PutObjectRequest extends MediaStoreDataRequest implements
        ToCopyableBuilder {
    private static final SdkField PATH_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Path")
            .getter(getter(PutObjectRequest::path)).setter(setter(Builder::path))
            .traits(LocationTrait.builder().location(MarshallLocation.GREEDY_PATH).locationName("Path").build()).build();

    private static final SdkField CONTENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ContentType").getter(getter(PutObjectRequest::contentType)).setter(setter(Builder::contentType))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Content-Type").build()).build();

    private static final SdkField CACHE_CONTROL_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("CacheControl").getter(getter(PutObjectRequest::cacheControl)).setter(setter(Builder::cacheControl))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Cache-Control").build()).build();

    private static final SdkField STORAGE_CLASS_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("StorageClass").getter(getter(PutObjectRequest::storageClassAsString))
            .setter(setter(Builder::storageClass))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-storage-class").build())
            .build();

    private static final SdkField UPLOAD_AVAILABILITY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("UploadAvailability").getter(getter(PutObjectRequest::uploadAvailabilityAsString))
            .setter(setter(Builder::uploadAvailability))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-upload-availability").build())
            .build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PATH_FIELD,
            CONTENT_TYPE_FIELD, CACHE_CONTROL_FIELD, STORAGE_CLASS_FIELD, UPLOAD_AVAILABILITY_FIELD));

    private final String path;

    private final String contentType;

    private final String cacheControl;

    private final String storageClass;

    private final String uploadAvailability;

    private PutObjectRequest(BuilderImpl builder) {
        super(builder);
        this.path = builder.path;
        this.contentType = builder.contentType;
        this.cacheControl = builder.cacheControl;
        this.storageClass = builder.storageClass;
        this.uploadAvailability = builder.uploadAvailability;
    }

    /**
     * 

* The path (including the file name) where the object is stored in the container. Format: <folder * name>/<folder name>/<file name> *

*

* For example, to upload the file mlaw.avi to the folder path premium\canada in the * container movies, enter the path premium/canada/mlaw.avi. *

*

* Do not include the container name in this path. *

*

* If the path includes any folders that don't exist yet, the service creates them. For example, suppose you have an * existing premium/usa subfolder. If you specify premium/canada, the service creates a * canada subfolder in the premium folder. You then have two subfolders, usa * and canada, in the premium folder. *

*

* There is no correlation between the path to the source and the path (folders) in the container in AWS Elemental * MediaStore. *

*

* For more information about folders and how they exist in a container, see the AWS Elemental MediaStore User Guide. *

*

* The file name is the name that is assigned to the file that you upload. The file can have the same name inside * and outside of AWS Elemental MediaStore, or it can have the same name. The file name can include or omit an * extension. *

* * @return The path (including the file name) where the object is stored in the container. Format: <folder * name>/<folder name>/<file name>

*

* For example, to upload the file mlaw.avi to the folder path premium\canada in * the container movies, enter the path premium/canada/mlaw.avi. *

*

* Do not include the container name in this path. *

*

* If the path includes any folders that don't exist yet, the service creates them. For example, suppose you * have an existing premium/usa subfolder. If you specify premium/canada, the * service creates a canada subfolder in the premium folder. You then have two * subfolders, usa and canada, in the premium folder. *

*

* There is no correlation between the path to the source and the path (folders) in the container in AWS * Elemental MediaStore. *

*

* For more information about folders and how they exist in a container, see the AWS Elemental MediaStore User Guide. *

*

* The file name is the name that is assigned to the file that you upload. The file can have the same name * inside and outside of AWS Elemental MediaStore, or it can have the same name. The file name can include * or omit an extension. */ public final String path() { return path; } /** *

* The content type of the object. *

* * @return The content type of the object. */ public final String contentType() { return contentType; } /** *

* An optional CacheControl header that allows the caller to control the object's cache behavior. * Headers can be passed in as specified in the HTTP at https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9. *

*

* Headers with a custom user-defined value are also accepted. *

* * @return An optional CacheControl header that allows the caller to control the object's cache * behavior. Headers can be passed in as specified in the HTTP at https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.

*

* Headers with a custom user-defined value are also accepted. */ public final String cacheControl() { return cacheControl; } /** *

* Indicates the storage class of a Put request. Defaults to high-performance temporal storage class, * and objects are persisted into durable storage shortly after being received. *

*

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

* * @return Indicates the storage class of a Put request. Defaults to high-performance temporal storage * class, and objects are persisted into durable storage shortly after being received. * @see StorageClass */ public final StorageClass storageClass() { return StorageClass.fromValue(storageClass); } /** *

* Indicates the storage class of a Put request. Defaults to high-performance temporal storage class, * and objects are persisted into durable storage shortly after being received. *

*

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

* * @return Indicates the storage class of a Put request. Defaults to high-performance temporal storage * class, and objects are persisted into durable storage shortly after being received. * @see StorageClass */ public final String storageClassAsString() { return storageClass; } /** *

* Indicates the availability of an object while it is still uploading. If the value is set to * streaming, the object is available for downloading after some initial buffering but before the * object is uploaded completely. If the value is set to standard, the object is available for * downloading only when it is uploaded completely. The default value for this header is standard. *

*

* To use this header, you must also set the HTTP Transfer-Encoding header to chunked. *

*

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

* * @return Indicates the availability of an object while it is still uploading. If the value is set to * streaming, the object is available for downloading after some initial buffering but before * the object is uploaded completely. If the value is set to standard, the object is available * for downloading only when it is uploaded completely. The default value for this header is * standard.

*

* To use this header, you must also set the HTTP Transfer-Encoding header to * chunked. * @see UploadAvailability */ public final UploadAvailability uploadAvailability() { return UploadAvailability.fromValue(uploadAvailability); } /** *

* Indicates the availability of an object while it is still uploading. If the value is set to * streaming, the object is available for downloading after some initial buffering but before the * object is uploaded completely. If the value is set to standard, the object is available for * downloading only when it is uploaded completely. The default value for this header is standard. *

*

* To use this header, you must also set the HTTP Transfer-Encoding header to chunked. *

*

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

* * @return Indicates the availability of an object while it is still uploading. If the value is set to * streaming, the object is available for downloading after some initial buffering but before * the object is uploaded completely. If the value is set to standard, the object is available * for downloading only when it is uploaded completely. The default value for this header is * standard.

*

* To use this header, you must also set the HTTP Transfer-Encoding header to * chunked. * @see UploadAvailability */ public final String uploadAvailabilityAsString() { return uploadAvailability; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(path()); hashCode = 31 * hashCode + Objects.hashCode(contentType()); hashCode = 31 * hashCode + Objects.hashCode(cacheControl()); hashCode = 31 * hashCode + Objects.hashCode(storageClassAsString()); hashCode = 31 * hashCode + Objects.hashCode(uploadAvailabilityAsString()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PutObjectRequest)) { return false; } PutObjectRequest other = (PutObjectRequest) obj; return Objects.equals(path(), other.path()) && Objects.equals(contentType(), other.contentType()) && Objects.equals(cacheControl(), other.cacheControl()) && Objects.equals(storageClassAsString(), other.storageClassAsString()) && Objects.equals(uploadAvailabilityAsString(), other.uploadAvailabilityAsString()); } /** * 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("PutObjectRequest").add("Path", path()).add("ContentType", contentType()) .add("CacheControl", cacheControl()).add("StorageClass", storageClassAsString()) .add("UploadAvailability", uploadAvailabilityAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Path": return Optional.ofNullable(clazz.cast(path())); case "ContentType": return Optional.ofNullable(clazz.cast(contentType())); case "CacheControl": return Optional.ofNullable(clazz.cast(cacheControl())); case "StorageClass": return Optional.ofNullable(clazz.cast(storageClassAsString())); case "UploadAvailability": return Optional.ofNullable(clazz.cast(uploadAvailabilityAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((PutObjectRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends MediaStoreDataRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The path (including the file name) where the object is stored in the container. Format: <folder * name>/<folder name>/<file name> *

*

* For example, to upload the file mlaw.avi to the folder path premium\canada in the * container movies, enter the path premium/canada/mlaw.avi. *

*

* Do not include the container name in this path. *

*

* If the path includes any folders that don't exist yet, the service creates them. For example, suppose you * have an existing premium/usa subfolder. If you specify premium/canada, the service * creates a canada subfolder in the premium folder. You then have two subfolders, * usa and canada, in the premium folder. *

*

* There is no correlation between the path to the source and the path (folders) in the container in AWS * Elemental MediaStore. *

*

* For more information about folders and how they exist in a container, see the AWS Elemental MediaStore User Guide. *

*

* The file name is the name that is assigned to the file that you upload. The file can have the same name * inside and outside of AWS Elemental MediaStore, or it can have the same name. The file name can include or * omit an extension. *

* * @param path * The path (including the file name) where the object is stored in the container. Format: <folder * name>/<folder name>/<file name>

*

* For example, to upload the file mlaw.avi to the folder path premium\canada * in the container movies, enter the path premium/canada/mlaw.avi. *

*

* Do not include the container name in this path. *

*

* If the path includes any folders that don't exist yet, the service creates them. For example, suppose * you have an existing premium/usa subfolder. If you specify premium/canada, * the service creates a canada subfolder in the premium folder. You then have * two subfolders, usa and canada, in the premium folder. *

*

* There is no correlation between the path to the source and the path (folders) in the container in AWS * Elemental MediaStore. *

*

* For more information about folders and how they exist in a container, see the AWS Elemental MediaStore User Guide. *

*

* The file name is the name that is assigned to the file that you upload. The file can have the same * name inside and outside of AWS Elemental MediaStore, or it can have the same name. The file name can * include or omit an extension. * @return Returns a reference to this object so that method calls can be chained together. */ Builder path(String path); /** *

* The content type of the object. *

* * @param contentType * The content type of the object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder contentType(String contentType); /** *

* An optional CacheControl header that allows the caller to control the object's cache behavior. * Headers can be passed in as specified in the HTTP at https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9. *

*

* Headers with a custom user-defined value are also accepted. *

* * @param cacheControl * An optional CacheControl header that allows the caller to control the object's cache * behavior. Headers can be passed in as specified in the HTTP at https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.

*

* Headers with a custom user-defined value are also accepted. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cacheControl(String cacheControl); /** *

* Indicates the storage class of a Put request. Defaults to high-performance temporal storage * class, and objects are persisted into durable storage shortly after being received. *

* * @param storageClass * Indicates the storage class of a Put request. Defaults to high-performance temporal * storage class, and objects are persisted into durable storage shortly after being received. * @see StorageClass * @return Returns a reference to this object so that method calls can be chained together. * @see StorageClass */ Builder storageClass(String storageClass); /** *

* Indicates the storage class of a Put request. Defaults to high-performance temporal storage * class, and objects are persisted into durable storage shortly after being received. *

* * @param storageClass * Indicates the storage class of a Put request. Defaults to high-performance temporal * storage class, and objects are persisted into durable storage shortly after being received. * @see StorageClass * @return Returns a reference to this object so that method calls can be chained together. * @see StorageClass */ Builder storageClass(StorageClass storageClass); /** *

* Indicates the availability of an object while it is still uploading. If the value is set to * streaming, the object is available for downloading after some initial buffering but before the * object is uploaded completely. If the value is set to standard, the object is available for * downloading only when it is uploaded completely. The default value for this header is standard. *

*

* To use this header, you must also set the HTTP Transfer-Encoding header to chunked. *

* * @param uploadAvailability * Indicates the availability of an object while it is still uploading. If the value is set to * streaming, the object is available for downloading after some initial buffering but * before the object is uploaded completely. If the value is set to standard, the object is * available for downloading only when it is uploaded completely. The default value for this header is * standard.

*

* To use this header, you must also set the HTTP Transfer-Encoding header to * chunked. * @see UploadAvailability * @return Returns a reference to this object so that method calls can be chained together. * @see UploadAvailability */ Builder uploadAvailability(String uploadAvailability); /** *

* Indicates the availability of an object while it is still uploading. If the value is set to * streaming, the object is available for downloading after some initial buffering but before the * object is uploaded completely. If the value is set to standard, the object is available for * downloading only when it is uploaded completely. The default value for this header is standard. *

*

* To use this header, you must also set the HTTP Transfer-Encoding header to chunked. *

* * @param uploadAvailability * Indicates the availability of an object while it is still uploading. If the value is set to * streaming, the object is available for downloading after some initial buffering but * before the object is uploaded completely. If the value is set to standard, the object is * available for downloading only when it is uploaded completely. The default value for this header is * standard.

*

* To use this header, you must also set the HTTP Transfer-Encoding header to * chunked. * @see UploadAvailability * @return Returns a reference to this object so that method calls can be chained together. * @see UploadAvailability */ Builder uploadAvailability(UploadAvailability uploadAvailability); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends MediaStoreDataRequest.BuilderImpl implements Builder { private String path; private String contentType; private String cacheControl; private String storageClass; private String uploadAvailability; private BuilderImpl() { } private BuilderImpl(PutObjectRequest model) { super(model); path(model.path); contentType(model.contentType); cacheControl(model.cacheControl); storageClass(model.storageClass); uploadAvailability(model.uploadAvailability); } public final String getPath() { return path; } public final void setPath(String path) { this.path = path; } @Override public final Builder path(String path) { this.path = path; return this; } public final String getContentType() { return contentType; } public final void setContentType(String contentType) { this.contentType = contentType; } @Override public final Builder contentType(String contentType) { this.contentType = contentType; return this; } public final String getCacheControl() { return cacheControl; } public final void setCacheControl(String cacheControl) { this.cacheControl = cacheControl; } @Override public final Builder cacheControl(String cacheControl) { this.cacheControl = cacheControl; return this; } public final String getStorageClass() { return storageClass; } public final void setStorageClass(String storageClass) { this.storageClass = storageClass; } @Override public final Builder storageClass(String storageClass) { this.storageClass = storageClass; return this; } @Override public final Builder storageClass(StorageClass storageClass) { this.storageClass(storageClass == null ? null : storageClass.toString()); return this; } public final String getUploadAvailability() { return uploadAvailability; } public final void setUploadAvailability(String uploadAvailability) { this.uploadAvailability = uploadAvailability; } @Override public final Builder uploadAvailability(String uploadAvailability) { this.uploadAvailability = uploadAvailability; return this; } @Override public final Builder uploadAvailability(UploadAvailability uploadAvailability) { this.uploadAvailability(uploadAvailability == null ? null : uploadAvailability.toString()); return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public PutObjectRequest build() { return new PutObjectRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy