software.amazon.awssdk.services.elastictranscoder.model.PipelineOutputConfig Maven / Gradle / Ivy
Show all versions of elastictranscoder 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.elastictranscoder.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 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.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The PipelineOutputConfig
structure.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PipelineOutputConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField BUCKET_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Bucket")
.getter(getter(PipelineOutputConfig::bucket)).setter(setter(Builder::bucket))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Bucket").build()).build();
private static final SdkField STORAGE_CLASS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StorageClass").getter(getter(PipelineOutputConfig::storageClass)).setter(setter(Builder::storageClass))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageClass").build()).build();
private static final SdkField> PERMISSIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Permissions")
.getter(getter(PipelineOutputConfig::permissions))
.setter(setter(Builder::permissions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Permissions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Permission::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BUCKET_FIELD,
STORAGE_CLASS_FIELD, PERMISSIONS_FIELD));
private static final long serialVersionUID = 1L;
private final String bucket;
private final String storageClass;
private final List permissions;
private PipelineOutputConfig(BuilderImpl builder) {
this.bucket = builder.bucket;
this.storageClass = builder.storageClass;
this.permissions = builder.permissions;
}
/**
*
* The Amazon S3 bucket in which you want Elastic Transcoder to save the transcoded files. Specify this value when
* all of the following are true:
*
*
* -
*
* You want to save transcoded files, thumbnails (if any), and playlists (if any) together in one bucket.
*
*
* -
*
* You do not want to specify the users or groups who have access to the transcoded files, thumbnails, and
* playlists.
*
*
* -
*
* You do not want to specify the permissions that Elastic Transcoder grants to the files.
*
*
* -
*
* You want to associate the transcoded files and thumbnails with the Amazon S3 Standard storage class.
*
*
*
*
* If you want to save transcoded files and playlists in one bucket and thumbnails in another bucket, specify which
* users can access the transcoded files or the permissions the users have, or change the Amazon S3 storage class,
* omit OutputBucket and specify values for ContentConfig
and ThumbnailConfig
instead.
*
*
* @return The Amazon S3 bucket in which you want Elastic Transcoder to save the transcoded files. Specify this
* value when all of the following are true:
*
* -
*
* You want to save transcoded files, thumbnails (if any), and playlists (if any) together in one bucket.
*
*
* -
*
* You do not want to specify the users or groups who have access to the transcoded files, thumbnails, and
* playlists.
*
*
* -
*
* You do not want to specify the permissions that Elastic Transcoder grants to the files.
*
*
* -
*
* You want to associate the transcoded files and thumbnails with the Amazon S3 Standard storage class.
*
*
*
*
* If you want to save transcoded files and playlists in one bucket and thumbnails in another bucket,
* specify which users can access the transcoded files or the permissions the users have, or change the
* Amazon S3 storage class, omit OutputBucket and specify values for ContentConfig
and
* ThumbnailConfig
instead.
*/
public final String bucket() {
return bucket;
}
/**
*
* The Amazon S3 storage class, Standard
or ReducedRedundancy
, that you want Elastic
* Transcoder to assign to the video files and playlists that it stores in your Amazon S3 bucket.
*
*
* @return The Amazon S3 storage class, Standard
or ReducedRedundancy
, that you want
* Elastic Transcoder to assign to the video files and playlists that it stores in your Amazon S3 bucket.
*/
public final String storageClass() {
return storageClass;
}
/**
* For responses, this returns true if the service returned a value for the Permissions 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 hasPermissions() {
return permissions != null && !(permissions instanceof SdkAutoConstructList);
}
/**
*
* Optional. The Permissions
object specifies which users and/or predefined Amazon S3 groups you want
* to have access to transcoded files and playlists, and the type of access you want them to have. You can grant
* permissions to a maximum of 30 users and/or predefined Amazon S3 groups.
*
*
* If you include Permissions
, Elastic Transcoder grants only the permissions that you specify. It does
* not grant full permissions to the owner of the role specified by Role
. If you want that user to have
* full control, you must explicitly grant full control to the user.
*
*
* If you omit Permissions
, Elastic Transcoder grants full control over the transcoded files and
* playlists to the owner of the role specified by Role
, and grants no other permissions to any other
* user or group.
*
*
* 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 #hasPermissions} method.
*
*
* @return Optional. The Permissions
object specifies which users and/or predefined Amazon S3 groups
* you want to have access to transcoded files and playlists, and the type of access you want them to have.
* You can grant permissions to a maximum of 30 users and/or predefined Amazon S3 groups.
*
* If you include Permissions
, Elastic Transcoder grants only the permissions that you specify.
* It does not grant full permissions to the owner of the role specified by Role
. If you want
* that user to have full control, you must explicitly grant full control to the user.
*
*
* If you omit Permissions
, Elastic Transcoder grants full control over the transcoded files
* and playlists to the owner of the role specified by Role
, and grants no other permissions to
* any other user or group.
*/
public final List permissions() {
return permissions;
}
@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(bucket());
hashCode = 31 * hashCode + Objects.hashCode(storageClass());
hashCode = 31 * hashCode + Objects.hashCode(hasPermissions() ? permissions() : 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 PipelineOutputConfig)) {
return false;
}
PipelineOutputConfig other = (PipelineOutputConfig) obj;
return Objects.equals(bucket(), other.bucket()) && Objects.equals(storageClass(), other.storageClass())
&& hasPermissions() == other.hasPermissions() && Objects.equals(permissions(), other.permissions());
}
/**
* 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("PipelineOutputConfig").add("Bucket", bucket()).add("StorageClass", storageClass())
.add("Permissions", hasPermissions() ? permissions() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Bucket":
return Optional.ofNullable(clazz.cast(bucket()));
case "StorageClass":
return Optional.ofNullable(clazz.cast(storageClass()));
case "Permissions":
return Optional.ofNullable(clazz.cast(permissions()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* -
*
* You want to save transcoded files, thumbnails (if any), and playlists (if any) together in one bucket.
*
*
* -
*
* You do not want to specify the users or groups who have access to the transcoded files, thumbnails,
* and playlists.
*
*
* -
*
* You do not want to specify the permissions that Elastic Transcoder grants to the files.
*
*
* -
*
* You want to associate the transcoded files and thumbnails with the Amazon S3 Standard storage class.
*
*
*
*
* If you want to save transcoded files and playlists in one bucket and thumbnails in another bucket,
* specify which users can access the transcoded files or the permissions the users have, or change the
* Amazon S3 storage class, omit OutputBucket and specify values for ContentConfig
and
* ThumbnailConfig
instead.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder bucket(String bucket);
/**
*
* The Amazon S3 storage class, Standard
or ReducedRedundancy
, that you want Elastic
* Transcoder to assign to the video files and playlists that it stores in your Amazon S3 bucket.
*
*
* @param storageClass
* The Amazon S3 storage class, Standard
or ReducedRedundancy
, that you want
* Elastic Transcoder to assign to the video files and playlists that it stores in your Amazon S3 bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder storageClass(String storageClass);
/**
*
* Optional. The Permissions
object specifies which users and/or predefined Amazon S3 groups you
* want to have access to transcoded files and playlists, and the type of access you want them to have. You can
* grant permissions to a maximum of 30 users and/or predefined Amazon S3 groups.
*
*
* If you include Permissions
, Elastic Transcoder grants only the permissions that you specify. It
* does not grant full permissions to the owner of the role specified by Role
. If you want that
* user to have full control, you must explicitly grant full control to the user.
*
*
* If you omit Permissions
, Elastic Transcoder grants full control over the transcoded files and
* playlists to the owner of the role specified by Role
, and grants no other permissions to any
* other user or group.
*
*
* @param permissions
* Optional. The Permissions
object specifies which users and/or predefined Amazon S3 groups
* you want to have access to transcoded files and playlists, and the type of access you want them to
* have. You can grant permissions to a maximum of 30 users and/or predefined Amazon S3 groups.
*
* If you include Permissions
, Elastic Transcoder grants only the permissions that you
* specify. It does not grant full permissions to the owner of the role specified by Role
.
* If you want that user to have full control, you must explicitly grant full control to the user.
*
*
* If you omit Permissions
, Elastic Transcoder grants full control over the transcoded files
* and playlists to the owner of the role specified by Role
, and grants no other permissions
* to any other user or group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder permissions(Collection permissions);
/**
*
* Optional. The Permissions
object specifies which users and/or predefined Amazon S3 groups you
* want to have access to transcoded files and playlists, and the type of access you want them to have. You can
* grant permissions to a maximum of 30 users and/or predefined Amazon S3 groups.
*
*
* If you include Permissions
, Elastic Transcoder grants only the permissions that you specify. It
* does not grant full permissions to the owner of the role specified by Role
. If you want that
* user to have full control, you must explicitly grant full control to the user.
*
*
* If you omit Permissions
, Elastic Transcoder grants full control over the transcoded files and
* playlists to the owner of the role specified by Role
, and grants no other permissions to any
* other user or group.
*
*
* @param permissions
* Optional. The Permissions
object specifies which users and/or predefined Amazon S3 groups
* you want to have access to transcoded files and playlists, and the type of access you want them to
* have. You can grant permissions to a maximum of 30 users and/or predefined Amazon S3 groups.
*
* If you include Permissions
, Elastic Transcoder grants only the permissions that you
* specify. It does not grant full permissions to the owner of the role specified by Role
.
* If you want that user to have full control, you must explicitly grant full control to the user.
*
*
* If you omit Permissions
, Elastic Transcoder grants full control over the transcoded files
* and playlists to the owner of the role specified by Role
, and grants no other permissions
* to any other user or group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder permissions(Permission... permissions);
/**
*
* Optional. The Permissions
object specifies which users and/or predefined Amazon S3 groups you
* want to have access to transcoded files and playlists, and the type of access you want them to have. You can
* grant permissions to a maximum of 30 users and/or predefined Amazon S3 groups.
*
*
* If you include Permissions
, Elastic Transcoder grants only the permissions that you specify. It
* does not grant full permissions to the owner of the role specified by Role
. If you want that
* user to have full control, you must explicitly grant full control to the user.
*
*
* If you omit Permissions
, Elastic Transcoder grants full control over the transcoded files and
* playlists to the owner of the role specified by Role
, and grants no other permissions to any
* other user or group.
*
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.elastictranscoder.model.Permission.Builder} avoiding the need to
* create one manually via {@link software.amazon.awssdk.services.elastictranscoder.model.Permission#builder()}.
*
*
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.elastictranscoder.model.Permission.Builder#build()} is called
* immediately and its result is passed to {@link #permissions(List)}.
*
* @param permissions
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.elastictranscoder.model.Permission.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #permissions(java.util.Collection)
*/
Builder permissions(Consumer... permissions);
}
static final class BuilderImpl implements Builder {
private String bucket;
private String storageClass;
private List permissions = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(PipelineOutputConfig model) {
bucket(model.bucket);
storageClass(model.storageClass);
permissions(model.permissions);
}
public final String getBucket() {
return bucket;
}
public final void setBucket(String bucket) {
this.bucket = bucket;
}
@Override
public final Builder bucket(String bucket) {
this.bucket = bucket;
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;
}
public final List getPermissions() {
List result = PermissionsCopier.copyToBuilder(this.permissions);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setPermissions(Collection permissions) {
this.permissions = PermissionsCopier.copyFromBuilder(permissions);
}
@Override
public final Builder permissions(Collection permissions) {
this.permissions = PermissionsCopier.copy(permissions);
return this;
}
@Override
@SafeVarargs
public final Builder permissions(Permission... permissions) {
permissions(Arrays.asList(permissions));
return this;
}
@Override
@SafeVarargs
public final Builder permissions(Consumer... permissions) {
permissions(Stream.of(permissions).map(c -> Permission.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
@Override
public PipelineOutputConfig build() {
return new PipelineOutputConfig(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}