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

software.amazon.awssdk.services.mediatailor.model.CreateChannelResponse 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.mediatailor.model;

import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.traits.MapTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 CreateChannelResponse extends MediaTailorResponse implements
        ToCopyableBuilder {
    private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
            .getter(getter(CreateChannelResponse::arn)).setter(setter(Builder::arn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();

    private static final SdkField CHANNEL_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ChannelName").getter(getter(CreateChannelResponse::channelName)).setter(setter(Builder::channelName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChannelName").build()).build();

    private static final SdkField CHANNEL_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ChannelState").getter(getter(CreateChannelResponse::channelStateAsString))
            .setter(setter(Builder::channelState))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChannelState").build()).build();

    private static final SdkField CREATION_TIME_FIELD = SdkField
            . builder(MarshallingType.INSTANT)
            .memberName("CreationTime")
            .getter(getter(CreateChannelResponse::creationTime))
            .setter(setter(Builder::creationTime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build(),
                    TimestampFormatTrait.create(TimestampFormatTrait.Format.UNIX_TIMESTAMP)).build();

    private static final SdkField FILLER_SLATE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("FillerSlate").getter(getter(CreateChannelResponse::fillerSlate)).setter(setter(Builder::fillerSlate))
            .constructor(SlateSource::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FillerSlate").build()).build();

    private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField
            . builder(MarshallingType.INSTANT)
            .memberName("LastModifiedTime")
            .getter(getter(CreateChannelResponse::lastModifiedTime))
            .setter(setter(Builder::lastModifiedTime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build(),
                    TimestampFormatTrait.create(TimestampFormatTrait.Format.UNIX_TIMESTAMP)).build();

    private static final SdkField> OUTPUTS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("Outputs")
            .getter(getter(CreateChannelResponse::outputs))
            .setter(setter(Builder::outputs))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Outputs").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(ResponseOutputItem::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField PLAYBACK_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("PlaybackMode").getter(getter(CreateChannelResponse::playbackMode)).setter(setter(Builder::playbackMode))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PlaybackMode").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("Tags")
            .getter(getter(CreateChannelResponse::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField TIER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Tier")
            .getter(getter(CreateChannelResponse::tier)).setter(setter(Builder::tier))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tier").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, CHANNEL_NAME_FIELD,
            CHANNEL_STATE_FIELD, CREATION_TIME_FIELD, FILLER_SLATE_FIELD, LAST_MODIFIED_TIME_FIELD, OUTPUTS_FIELD,
            PLAYBACK_MODE_FIELD, TAGS_FIELD, TIER_FIELD));

    private final String arn;

    private final String channelName;

    private final String channelState;

    private final Instant creationTime;

    private final SlateSource fillerSlate;

    private final Instant lastModifiedTime;

    private final List outputs;

    private final String playbackMode;

    private final Map tags;

    private final String tier;

    private CreateChannelResponse(BuilderImpl builder) {
        super(builder);
        this.arn = builder.arn;
        this.channelName = builder.channelName;
        this.channelState = builder.channelState;
        this.creationTime = builder.creationTime;
        this.fillerSlate = builder.fillerSlate;
        this.lastModifiedTime = builder.lastModifiedTime;
        this.outputs = builder.outputs;
        this.playbackMode = builder.playbackMode;
        this.tags = builder.tags;
        this.tier = builder.tier;
    }

    /**
     * 

* The Amazon Resource Name (ARN) to assign to the channel. *

* * @return The Amazon Resource Name (ARN) to assign to the channel. */ public final String arn() { return arn; } /** *

* The name to assign to the channel. *

* * @return The name to assign to the channel. */ public final String channelName() { return channelName; } /** *

* Indicates whether the channel is in a running state or not. *

*

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

* * @return Indicates whether the channel is in a running state or not. * @see ChannelState */ public final ChannelState channelState() { return ChannelState.fromValue(channelState); } /** *

* Indicates whether the channel is in a running state or not. *

*

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

* * @return Indicates whether the channel is in a running state or not. * @see ChannelState */ public final String channelStateAsString() { return channelState; } /** *

* The timestamp of when the channel was created. *

* * @return The timestamp of when the channel was created. */ public final Instant creationTime() { return creationTime; } /** *

* Contains information about the slate used to fill gaps between programs in the schedule. *

* * @return Contains information about the slate used to fill gaps between programs in the schedule. */ public final SlateSource fillerSlate() { return fillerSlate; } /** *

* The timestamp of when the channel was last modified. *

* * @return The timestamp of when the channel was last modified. */ public final Instant lastModifiedTime() { return lastModifiedTime; } /** * For responses, this returns true if the service returned a value for the Outputs 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 hasOutputs() { return outputs != null && !(outputs instanceof SdkAutoConstructList); } /** *

* The output properties to assign to the channel. *

*

* 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 #hasOutputs} method. *

* * @return The output properties to assign to the channel. */ public final List outputs() { return outputs; } /** *

* The playback mode to assign to the channel. *

* * @return The playback mode to assign to the channel. */ public final String playbackMode() { return playbackMode; } /** * For responses, this returns true if the service returned a value for the Tags 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 hasTags() { return tags != null && !(tags instanceof SdkAutoConstructMap); } /** *

* The tags to assign to the channel. Tags are key-value pairs that you can associate with Amazon resources to help * with organization, access control, and cost tracking. For more information, see Tagging AWS Elemental MediaTailor * Resources. *

*

* 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 #hasTags} method. *

* * @return The tags to assign to the channel. Tags are key-value pairs that you can associate with Amazon resources * to help with organization, access control, and cost tracking. For more information, see Tagging AWS Elemental MediaTailor * Resources. */ public final Map tags() { return tags; } /** *

* The tier of the channel. *

* * @return The tier of the channel. */ public final String tier() { return tier; } @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(arn()); hashCode = 31 * hashCode + Objects.hashCode(channelName()); hashCode = 31 * hashCode + Objects.hashCode(channelStateAsString()); hashCode = 31 * hashCode + Objects.hashCode(creationTime()); hashCode = 31 * hashCode + Objects.hashCode(fillerSlate()); hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime()); hashCode = 31 * hashCode + Objects.hashCode(hasOutputs() ? outputs() : null); hashCode = 31 * hashCode + Objects.hashCode(playbackMode()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(tier()); 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 CreateChannelResponse)) { return false; } CreateChannelResponse other = (CreateChannelResponse) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(channelName(), other.channelName()) && Objects.equals(channelStateAsString(), other.channelStateAsString()) && Objects.equals(creationTime(), other.creationTime()) && Objects.equals(fillerSlate(), other.fillerSlate()) && Objects.equals(lastModifiedTime(), other.lastModifiedTime()) && hasOutputs() == other.hasOutputs() && Objects.equals(outputs(), other.outputs()) && Objects.equals(playbackMode(), other.playbackMode()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && Objects.equals(tier(), other.tier()); } /** * 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("CreateChannelResponse").add("Arn", arn()).add("ChannelName", channelName()) .add("ChannelState", channelStateAsString()).add("CreationTime", creationTime()) .add("FillerSlate", fillerSlate()).add("LastModifiedTime", lastModifiedTime()) .add("Outputs", hasOutputs() ? outputs() : null).add("PlaybackMode", playbackMode()) .add("Tags", hasTags() ? tags() : null).add("Tier", tier()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Arn": return Optional.ofNullable(clazz.cast(arn())); case "ChannelName": return Optional.ofNullable(clazz.cast(channelName())); case "ChannelState": return Optional.ofNullable(clazz.cast(channelStateAsString())); case "CreationTime": return Optional.ofNullable(clazz.cast(creationTime())); case "FillerSlate": return Optional.ofNullable(clazz.cast(fillerSlate())); case "LastModifiedTime": return Optional.ofNullable(clazz.cast(lastModifiedTime())); case "Outputs": return Optional.ofNullable(clazz.cast(outputs())); case "PlaybackMode": return Optional.ofNullable(clazz.cast(playbackMode())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); case "Tier": return Optional.ofNullable(clazz.cast(tier())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CreateChannelResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends MediaTailorResponse.Builder, SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) to assign to the channel. *

* * @param arn * The Amazon Resource Name (ARN) to assign to the channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

* The name to assign to the channel. *

* * @param channelName * The name to assign to the channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder channelName(String channelName); /** *

* Indicates whether the channel is in a running state or not. *

* * @param channelState * Indicates whether the channel is in a running state or not. * @see ChannelState * @return Returns a reference to this object so that method calls can be chained together. * @see ChannelState */ Builder channelState(String channelState); /** *

* Indicates whether the channel is in a running state or not. *

* * @param channelState * Indicates whether the channel is in a running state or not. * @see ChannelState * @return Returns a reference to this object so that method calls can be chained together. * @see ChannelState */ Builder channelState(ChannelState channelState); /** *

* The timestamp of when the channel was created. *

* * @param creationTime * The timestamp of when the channel was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder creationTime(Instant creationTime); /** *

* Contains information about the slate used to fill gaps between programs in the schedule. *

* * @param fillerSlate * Contains information about the slate used to fill gaps between programs in the schedule. * @return Returns a reference to this object so that method calls can be chained together. */ Builder fillerSlate(SlateSource fillerSlate); /** *

* Contains information about the slate used to fill gaps between programs in the schedule. *

* This is a convenience method that creates an instance of the {@link SlateSource.Builder} avoiding the need to * create one manually via {@link SlateSource#builder()}. * *

* When the {@link Consumer} completes, {@link SlateSource.Builder#build()} is called immediately and its result * is passed to {@link #fillerSlate(SlateSource)}. * * @param fillerSlate * a consumer that will call methods on {@link SlateSource.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #fillerSlate(SlateSource) */ default Builder fillerSlate(Consumer fillerSlate) { return fillerSlate(SlateSource.builder().applyMutation(fillerSlate).build()); } /** *

* The timestamp of when the channel was last modified. *

* * @param lastModifiedTime * The timestamp of when the channel was last modified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedTime(Instant lastModifiedTime); /** *

* The output properties to assign to the channel. *

* * @param outputs * The output properties to assign to the channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder outputs(Collection outputs); /** *

* The output properties to assign to the channel. *

* * @param outputs * The output properties to assign to the channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder outputs(ResponseOutputItem... outputs); /** *

* The output properties to assign to the channel. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.mediatailor.model.ResponseOutputItem.Builder} avoiding the need to * create one manually via * {@link software.amazon.awssdk.services.mediatailor.model.ResponseOutputItem#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.mediatailor.model.ResponseOutputItem.Builder#build()} is called * immediately and its result is passed to {@link #outputs(List)}. * * @param outputs * a consumer that will call methods on * {@link software.amazon.awssdk.services.mediatailor.model.ResponseOutputItem.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #outputs(java.util.Collection) */ Builder outputs(Consumer... outputs); /** *

* The playback mode to assign to the channel. *

* * @param playbackMode * The playback mode to assign to the channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder playbackMode(String playbackMode); /** *

* The tags to assign to the channel. Tags are key-value pairs that you can associate with Amazon resources to * help with organization, access control, and cost tracking. For more information, see Tagging AWS Elemental MediaTailor * Resources. *

* * @param tags * The tags to assign to the channel. Tags are key-value pairs that you can associate with Amazon * resources to help with organization, access control, and cost tracking. For more information, see Tagging AWS Elemental * MediaTailor Resources. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); /** *

* The tier of the channel. *

* * @param tier * The tier of the channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tier(String tier); } static final class BuilderImpl extends MediaTailorResponse.BuilderImpl implements Builder { private String arn; private String channelName; private String channelState; private Instant creationTime; private SlateSource fillerSlate; private Instant lastModifiedTime; private List outputs = DefaultSdkAutoConstructList.getInstance(); private String playbackMode; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private String tier; private BuilderImpl() { } private BuilderImpl(CreateChannelResponse model) { super(model); arn(model.arn); channelName(model.channelName); channelState(model.channelState); creationTime(model.creationTime); fillerSlate(model.fillerSlate); lastModifiedTime(model.lastModifiedTime); outputs(model.outputs); playbackMode(model.playbackMode); tags(model.tags); tier(model.tier); } public final String getArn() { return arn; } public final void setArn(String arn) { this.arn = arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final String getChannelName() { return channelName; } public final void setChannelName(String channelName) { this.channelName = channelName; } @Override public final Builder channelName(String channelName) { this.channelName = channelName; return this; } public final String getChannelState() { return channelState; } public final void setChannelState(String channelState) { this.channelState = channelState; } @Override public final Builder channelState(String channelState) { this.channelState = channelState; return this; } @Override public final Builder channelState(ChannelState channelState) { this.channelState(channelState == null ? null : channelState.toString()); return this; } public final Instant getCreationTime() { return creationTime; } public final void setCreationTime(Instant creationTime) { this.creationTime = creationTime; } @Override public final Builder creationTime(Instant creationTime) { this.creationTime = creationTime; return this; } public final SlateSource.Builder getFillerSlate() { return fillerSlate != null ? fillerSlate.toBuilder() : null; } public final void setFillerSlate(SlateSource.BuilderImpl fillerSlate) { this.fillerSlate = fillerSlate != null ? fillerSlate.build() : null; } @Override public final Builder fillerSlate(SlateSource fillerSlate) { this.fillerSlate = fillerSlate; return this; } public final Instant getLastModifiedTime() { return lastModifiedTime; } public final void setLastModifiedTime(Instant lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; } @Override public final Builder lastModifiedTime(Instant lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; return this; } public final List getOutputs() { List result = ResponseOutputsCopier.copyToBuilder(this.outputs); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setOutputs(Collection outputs) { this.outputs = ResponseOutputsCopier.copyFromBuilder(outputs); } @Override public final Builder outputs(Collection outputs) { this.outputs = ResponseOutputsCopier.copy(outputs); return this; } @Override @SafeVarargs public final Builder outputs(ResponseOutputItem... outputs) { outputs(Arrays.asList(outputs)); return this; } @Override @SafeVarargs public final Builder outputs(Consumer... outputs) { outputs(Stream.of(outputs).map(c -> ResponseOutputItem.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final String getPlaybackMode() { return playbackMode; } public final void setPlaybackMode(String playbackMode) { this.playbackMode = playbackMode; } @Override public final Builder playbackMode(String playbackMode) { this.playbackMode = playbackMode; return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = ___mapOf__stringCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = ___mapOf__stringCopier.copy(tags); return this; } public final String getTier() { return tier; } public final void setTier(String tier) { this.tier = tier; } @Override public final Builder tier(String tier) { this.tier = tier; return this; } @Override public CreateChannelResponse build() { return new CreateChannelResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy