
software.amazon.awssdk.services.elastictranscoder.model.Artwork 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.elastictranscoder.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.Consumer;
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;
/**
*
* The file to be used as album art. There can be multiple artworks associated with an audio file, to a maximum of 20.
*
*
* To remove artwork or leave the artwork empty, you can either set Artwork
to null, or set the
* Merge Policy
to "Replace" and use an empty Artwork
array.
*
*
* To pass through existing artwork unchanged, set the Merge Policy
to "Prepend", "Append", or "Fallback",
* and use an empty Artwork
array.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Artwork implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField INPUT_KEY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InputKey").getter(getter(Artwork::inputKey)).setter(setter(Builder::inputKey))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InputKey").build()).build();
private static final SdkField MAX_WIDTH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MaxWidth").getter(getter(Artwork::maxWidth)).setter(setter(Builder::maxWidth))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxWidth").build()).build();
private static final SdkField MAX_HEIGHT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MaxHeight").getter(getter(Artwork::maxHeight)).setter(setter(Builder::maxHeight))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxHeight").build()).build();
private static final SdkField SIZING_POLICY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SizingPolicy").getter(getter(Artwork::sizingPolicy)).setter(setter(Builder::sizingPolicy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SizingPolicy").build()).build();
private static final SdkField PADDING_POLICY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PaddingPolicy").getter(getter(Artwork::paddingPolicy)).setter(setter(Builder::paddingPolicy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PaddingPolicy").build()).build();
private static final SdkField ALBUM_ART_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AlbumArtFormat").getter(getter(Artwork::albumArtFormat)).setter(setter(Builder::albumArtFormat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlbumArtFormat").build()).build();
private static final SdkField ENCRYPTION_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Encryption").getter(getter(Artwork::encryption)).setter(setter(Builder::encryption))
.constructor(Encryption::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Encryption").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INPUT_KEY_FIELD,
MAX_WIDTH_FIELD, MAX_HEIGHT_FIELD, SIZING_POLICY_FIELD, PADDING_POLICY_FIELD, ALBUM_ART_FORMAT_FIELD,
ENCRYPTION_FIELD));
private static final long serialVersionUID = 1L;
private final String inputKey;
private final String maxWidth;
private final String maxHeight;
private final String sizingPolicy;
private final String paddingPolicy;
private final String albumArtFormat;
private final Encryption encryption;
private Artwork(BuilderImpl builder) {
this.inputKey = builder.inputKey;
this.maxWidth = builder.maxWidth;
this.maxHeight = builder.maxHeight;
this.sizingPolicy = builder.sizingPolicy;
this.paddingPolicy = builder.paddingPolicy;
this.albumArtFormat = builder.albumArtFormat;
this.encryption = builder.encryption;
}
/**
*
* The name of the file to be used as album art. To determine which Amazon S3 bucket contains the specified file,
* Elastic Transcoder checks the pipeline specified by PipelineId
; the InputBucket
object
* in that pipeline identifies the bucket.
*
*
* If the file name includes a prefix, for example, cooking/pie.jpg
, include the prefix in the key. If
* the file isn't in the specified bucket, Elastic Transcoder returns an error.
*
*
* @return The name of the file to be used as album art. To determine which Amazon S3 bucket contains the specified
* file, Elastic Transcoder checks the pipeline specified by PipelineId
; the
* InputBucket
object in that pipeline identifies the bucket.
*
* If the file name includes a prefix, for example, cooking/pie.jpg
, include the prefix in the
* key. If the file isn't in the specified bucket, Elastic Transcoder returns an error.
*/
public final String inputKey() {
return inputKey;
}
/**
*
* The maximum width of the output album art in pixels. If you specify auto
, Elastic Transcoder uses
* 600 as the default value. If you specify a numeric value, enter an even integer between 32 and 4096, inclusive.
*
*
* @return The maximum width of the output album art in pixels. If you specify auto
, Elastic Transcoder
* uses 600 as the default value. If you specify a numeric value, enter an even integer between 32 and 4096,
* inclusive.
*/
public final String maxWidth() {
return maxWidth;
}
/**
*
* The maximum height of the output album art in pixels. If you specify auto
, Elastic Transcoder uses
* 600 as the default value. If you specify a numeric value, enter an even integer between 32 and 3072, inclusive.
*
*
* @return The maximum height of the output album art in pixels. If you specify auto
, Elastic
* Transcoder uses 600 as the default value. If you specify a numeric value, enter an even integer between
* 32 and 3072, inclusive.
*/
public final String maxHeight() {
return maxHeight;
}
/**
*
* Specify one of the following values to control scaling of the output album art:
*
*
* -
*
* Fit:
Elastic Transcoder scales the output art so it matches the value that you specified in either
* MaxWidth
or MaxHeight
without exceeding the other value.
*
*
* -
*
* Fill:
Elastic Transcoder scales the output art so it matches the value that you specified in either
* MaxWidth
or MaxHeight
and matches or exceeds the other value. Elastic Transcoder
* centers the output art and then crops it in the dimension (if any) that exceeds the maximum value.
*
*
* -
*
* Stretch:
Elastic Transcoder stretches the output art to match the values that you specified for
* MaxWidth
and MaxHeight
. If the relative proportions of the input art and the output art
* are different, the output art will be distorted.
*
*
* -
*
* Keep:
Elastic Transcoder does not scale the output art. If either dimension of the input art exceeds
* the values that you specified for MaxWidth
and MaxHeight
, Elastic Transcoder crops the
* output art.
*
*
* -
*
* ShrinkToFit:
Elastic Transcoder scales the output art down so that its dimensions match the values
* that you specified for at least one of MaxWidth
and MaxHeight
without exceeding either
* value. If you specify this option, Elastic Transcoder does not scale the art up.
*
*
* -
*
* ShrinkToFill
Elastic Transcoder scales the output art down so that its dimensions match the values
* that you specified for at least one of MaxWidth
and MaxHeight
without dropping below
* either value. If you specify this option, Elastic Transcoder does not scale the art up.
*
*
*
*
* @return Specify one of the following values to control scaling of the output album art:
*
* -
*
* Fit:
Elastic Transcoder scales the output art so it matches the value that you specified in
* either MaxWidth
or MaxHeight
without exceeding the other value.
*
*
* -
*
* Fill:
Elastic Transcoder scales the output art so it matches the value that you specified in
* either MaxWidth
or MaxHeight
and matches or exceeds the other value. Elastic
* Transcoder centers the output art and then crops it in the dimension (if any) that exceeds the maximum
* value.
*
*
* -
*
* Stretch:
Elastic Transcoder stretches the output art to match the values that you specified
* for MaxWidth
and MaxHeight
. If the relative proportions of the input art and
* the output art are different, the output art will be distorted.
*
*
* -
*
* Keep:
Elastic Transcoder does not scale the output art. If either dimension of the input art
* exceeds the values that you specified for MaxWidth
and MaxHeight
, Elastic
* Transcoder crops the output art.
*
*
* -
*
* ShrinkToFit:
Elastic Transcoder scales the output art down so that its dimensions match the
* values that you specified for at least one of MaxWidth
and MaxHeight
without
* exceeding either value. If you specify this option, Elastic Transcoder does not scale the art up.
*
*
* -
*
* ShrinkToFill
Elastic Transcoder scales the output art down so that its dimensions match the
* values that you specified for at least one of MaxWidth
and MaxHeight
without
* dropping below either value. If you specify this option, Elastic Transcoder does not scale the art up.
*
*
*/
public final String sizingPolicy() {
return sizingPolicy;
}
/**
*
* When you set PaddingPolicy
to Pad
, Elastic Transcoder may add white bars to the top and
* bottom and/or left and right sides of the output album art to make the total size of the output art match the
* values that you specified for MaxWidth
and MaxHeight
.
*
*
* @return When you set PaddingPolicy
to Pad
, Elastic Transcoder may add white bars to the
* top and bottom and/or left and right sides of the output album art to make the total size of the output
* art match the values that you specified for MaxWidth
and MaxHeight
.
*/
public final String paddingPolicy() {
return paddingPolicy;
}
/**
*
* The format of album art, if any. Valid formats are .jpg
and .png
.
*
*
* @return The format of album art, if any. Valid formats are .jpg
and .png
.
*/
public final String albumArtFormat() {
return albumArtFormat;
}
/**
*
* The encryption settings, if any, that you want Elastic Transcoder to apply to your artwork.
*
*
* @return The encryption settings, if any, that you want Elastic Transcoder to apply to your artwork.
*/
public final Encryption encryption() {
return encryption;
}
@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(inputKey());
hashCode = 31 * hashCode + Objects.hashCode(maxWidth());
hashCode = 31 * hashCode + Objects.hashCode(maxHeight());
hashCode = 31 * hashCode + Objects.hashCode(sizingPolicy());
hashCode = 31 * hashCode + Objects.hashCode(paddingPolicy());
hashCode = 31 * hashCode + Objects.hashCode(albumArtFormat());
hashCode = 31 * hashCode + Objects.hashCode(encryption());
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 Artwork)) {
return false;
}
Artwork other = (Artwork) obj;
return Objects.equals(inputKey(), other.inputKey()) && Objects.equals(maxWidth(), other.maxWidth())
&& Objects.equals(maxHeight(), other.maxHeight()) && Objects.equals(sizingPolicy(), other.sizingPolicy())
&& Objects.equals(paddingPolicy(), other.paddingPolicy())
&& Objects.equals(albumArtFormat(), other.albumArtFormat()) && Objects.equals(encryption(), other.encryption());
}
/**
* 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("Artwork").add("InputKey", inputKey()).add("MaxWidth", maxWidth()).add("MaxHeight", maxHeight())
.add("SizingPolicy", sizingPolicy()).add("PaddingPolicy", paddingPolicy())
.add("AlbumArtFormat", albumArtFormat()).add("Encryption", encryption()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "InputKey":
return Optional.ofNullable(clazz.cast(inputKey()));
case "MaxWidth":
return Optional.ofNullable(clazz.cast(maxWidth()));
case "MaxHeight":
return Optional.ofNullable(clazz.cast(maxHeight()));
case "SizingPolicy":
return Optional.ofNullable(clazz.cast(sizingPolicy()));
case "PaddingPolicy":
return Optional.ofNullable(clazz.cast(paddingPolicy()));
case "AlbumArtFormat":
return Optional.ofNullable(clazz.cast(albumArtFormat()));
case "Encryption":
return Optional.ofNullable(clazz.cast(encryption()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function