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

software.amazon.awssdk.services.chime.model.Channel 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.chime.model;

import java.io.Serializable;
import java.time.Instant;
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 details of a channel. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Channel implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") .getter(getter(Channel::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField CHANNEL_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ChannelArn").getter(getter(Channel::channelArn)).setter(setter(Builder::channelArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChannelArn").build()).build(); private static final SdkField MODE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Mode") .getter(getter(Channel::modeAsString)).setter(setter(Builder::mode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Mode").build()).build(); private static final SdkField PRIVACY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Privacy") .getter(getter(Channel::privacyAsString)).setter(setter(Builder::privacy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Privacy").build()).build(); private static final SdkField METADATA_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Metadata").getter(getter(Channel::metadata)).setter(setter(Builder::metadata)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metadata").build()).build(); private static final SdkField CREATED_BY_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("CreatedBy").getter(getter(Channel::createdBy)).setter(setter(Builder::createdBy)) .constructor(Identity::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedBy").build()).build(); private static final SdkField CREATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CreatedTimestamp").getter(getter(Channel::createdTimestamp)).setter(setter(Builder::createdTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimestamp").build()).build(); private static final SdkField LAST_MESSAGE_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastMessageTimestamp").getter(getter(Channel::lastMessageTimestamp)) .setter(setter(Builder::lastMessageTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastMessageTimestamp").build()) .build(); private static final SdkField LAST_UPDATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastUpdatedTimestamp").getter(getter(Channel::lastUpdatedTimestamp)) .setter(setter(Builder::lastUpdatedTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTimestamp").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, CHANNEL_ARN_FIELD, MODE_FIELD, PRIVACY_FIELD, METADATA_FIELD, CREATED_BY_FIELD, CREATED_TIMESTAMP_FIELD, LAST_MESSAGE_TIMESTAMP_FIELD, LAST_UPDATED_TIMESTAMP_FIELD)); private static final long serialVersionUID = 1L; private final String name; private final String channelArn; private final String mode; private final String privacy; private final String metadata; private final Identity createdBy; private final Instant createdTimestamp; private final Instant lastMessageTimestamp; private final Instant lastUpdatedTimestamp; private Channel(BuilderImpl builder) { this.name = builder.name; this.channelArn = builder.channelArn; this.mode = builder.mode; this.privacy = builder.privacy; this.metadata = builder.metadata; this.createdBy = builder.createdBy; this.createdTimestamp = builder.createdTimestamp; this.lastMessageTimestamp = builder.lastMessageTimestamp; this.lastUpdatedTimestamp = builder.lastUpdatedTimestamp; } /** *

* The name of the channel. *

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

* The ARN of the channel. *

* * @return The ARN of the channel. */ public final String channelArn() { return channelArn; } /** *

* The mode of the channel. *

*

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

* * @return The mode of the channel. * @see ChannelMode */ public final ChannelMode mode() { return ChannelMode.fromValue(mode); } /** *

* The mode of the channel. *

*

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

* * @return The mode of the channel. * @see ChannelMode */ public final String modeAsString() { return mode; } /** *

* The channel's privacy setting. *

*

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

* * @return The channel's privacy setting. * @see ChannelPrivacy */ public final ChannelPrivacy privacy() { return ChannelPrivacy.fromValue(privacy); } /** *

* The channel's privacy setting. *

*

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

* * @return The channel's privacy setting. * @see ChannelPrivacy */ public final String privacyAsString() { return privacy; } /** *

* The channel's metadata. *

* * @return The channel's metadata. */ public final String metadata() { return metadata; } /** *

* The AppInstanceUser who created the channel. *

* * @return The AppInstanceUser who created the channel. */ public final Identity createdBy() { return createdBy; } /** *

* The time at which the AppInstanceUser created the channel. *

* * @return The time at which the AppInstanceUser created the channel. */ public final Instant createdTimestamp() { return createdTimestamp; } /** *

* The time at which a member sent the last message in the channel. *

* * @return The time at which a member sent the last message in the channel. */ public final Instant lastMessageTimestamp() { return lastMessageTimestamp; } /** *

* The time at which a channel was last updated. *

* * @return The time at which a channel was last updated. */ public final Instant lastUpdatedTimestamp() { return lastUpdatedTimestamp; } @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 + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(channelArn()); hashCode = 31 * hashCode + Objects.hashCode(modeAsString()); hashCode = 31 * hashCode + Objects.hashCode(privacyAsString()); hashCode = 31 * hashCode + Objects.hashCode(metadata()); hashCode = 31 * hashCode + Objects.hashCode(createdBy()); hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(lastMessageTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTimestamp()); 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 Channel)) { return false; } Channel other = (Channel) obj; return Objects.equals(name(), other.name()) && Objects.equals(channelArn(), other.channelArn()) && Objects.equals(modeAsString(), other.modeAsString()) && Objects.equals(privacyAsString(), other.privacyAsString()) && Objects.equals(metadata(), other.metadata()) && Objects.equals(createdBy(), other.createdBy()) && Objects.equals(createdTimestamp(), other.createdTimestamp()) && Objects.equals(lastMessageTimestamp(), other.lastMessageTimestamp()) && Objects.equals(lastUpdatedTimestamp(), other.lastUpdatedTimestamp()); } /** * 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("Channel").add("Name", name() == null ? null : "*** Sensitive Data Redacted ***") .add("ChannelArn", channelArn()).add("Mode", modeAsString()).add("Privacy", privacyAsString()) .add("Metadata", metadata() == null ? null : "*** Sensitive Data Redacted ***").add("CreatedBy", createdBy()) .add("CreatedTimestamp", createdTimestamp()).add("LastMessageTimestamp", lastMessageTimestamp()) .add("LastUpdatedTimestamp", lastUpdatedTimestamp()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Name": return Optional.ofNullable(clazz.cast(name())); case "ChannelArn": return Optional.ofNullable(clazz.cast(channelArn())); case "Mode": return Optional.ofNullable(clazz.cast(modeAsString())); case "Privacy": return Optional.ofNullable(clazz.cast(privacyAsString())); case "Metadata": return Optional.ofNullable(clazz.cast(metadata())); case "CreatedBy": return Optional.ofNullable(clazz.cast(createdBy())); case "CreatedTimestamp": return Optional.ofNullable(clazz.cast(createdTimestamp())); case "LastMessageTimestamp": return Optional.ofNullable(clazz.cast(lastMessageTimestamp())); case "LastUpdatedTimestamp": return Optional.ofNullable(clazz.cast(lastUpdatedTimestamp())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Channel) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the channel. *

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

* The ARN of the channel. *

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

* The mode of the channel. *

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

* The mode of the channel. *

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

* The channel's privacy setting. *

* * @param privacy * The channel's privacy setting. * @see ChannelPrivacy * @return Returns a reference to this object so that method calls can be chained together. * @see ChannelPrivacy */ Builder privacy(String privacy); /** *

* The channel's privacy setting. *

* * @param privacy * The channel's privacy setting. * @see ChannelPrivacy * @return Returns a reference to this object so that method calls can be chained together. * @see ChannelPrivacy */ Builder privacy(ChannelPrivacy privacy); /** *

* The channel's metadata. *

* * @param metadata * The channel's metadata. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metadata(String metadata); /** *

* The AppInstanceUser who created the channel. *

* * @param createdBy * The AppInstanceUser who created the channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdBy(Identity createdBy); /** *

* The AppInstanceUser who created the channel. *

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

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

* The time at which the AppInstanceUser created the channel. *

* * @param createdTimestamp * The time at which the AppInstanceUser created the channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdTimestamp(Instant createdTimestamp); /** *

* The time at which a member sent the last message in the channel. *

* * @param lastMessageTimestamp * The time at which a member sent the last message in the channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastMessageTimestamp(Instant lastMessageTimestamp); /** *

* The time at which a channel was last updated. *

* * @param lastUpdatedTimestamp * The time at which a channel was last updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdatedTimestamp(Instant lastUpdatedTimestamp); } static final class BuilderImpl implements Builder { private String name; private String channelArn; private String mode; private String privacy; private String metadata; private Identity createdBy; private Instant createdTimestamp; private Instant lastMessageTimestamp; private Instant lastUpdatedTimestamp; private BuilderImpl() { } private BuilderImpl(Channel model) { name(model.name); channelArn(model.channelArn); mode(model.mode); privacy(model.privacy); metadata(model.metadata); createdBy(model.createdBy); createdTimestamp(model.createdTimestamp); lastMessageTimestamp(model.lastMessageTimestamp); lastUpdatedTimestamp(model.lastUpdatedTimestamp); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getChannelArn() { return channelArn; } public final void setChannelArn(String channelArn) { this.channelArn = channelArn; } @Override public final Builder channelArn(String channelArn) { this.channelArn = channelArn; return this; } public final String getMode() { return mode; } public final void setMode(String mode) { this.mode = mode; } @Override public final Builder mode(String mode) { this.mode = mode; return this; } @Override public final Builder mode(ChannelMode mode) { this.mode(mode == null ? null : mode.toString()); return this; } public final String getPrivacy() { return privacy; } public final void setPrivacy(String privacy) { this.privacy = privacy; } @Override public final Builder privacy(String privacy) { this.privacy = privacy; return this; } @Override public final Builder privacy(ChannelPrivacy privacy) { this.privacy(privacy == null ? null : privacy.toString()); return this; } public final String getMetadata() { return metadata; } public final void setMetadata(String metadata) { this.metadata = metadata; } @Override public final Builder metadata(String metadata) { this.metadata = metadata; return this; } public final Identity.Builder getCreatedBy() { return createdBy != null ? createdBy.toBuilder() : null; } public final void setCreatedBy(Identity.BuilderImpl createdBy) { this.createdBy = createdBy != null ? createdBy.build() : null; } @Override public final Builder createdBy(Identity createdBy) { this.createdBy = createdBy; return this; } public final Instant getCreatedTimestamp() { return createdTimestamp; } public final void setCreatedTimestamp(Instant createdTimestamp) { this.createdTimestamp = createdTimestamp; } @Override public final Builder createdTimestamp(Instant createdTimestamp) { this.createdTimestamp = createdTimestamp; return this; } public final Instant getLastMessageTimestamp() { return lastMessageTimestamp; } public final void setLastMessageTimestamp(Instant lastMessageTimestamp) { this.lastMessageTimestamp = lastMessageTimestamp; } @Override public final Builder lastMessageTimestamp(Instant lastMessageTimestamp) { this.lastMessageTimestamp = lastMessageTimestamp; return this; } public final Instant getLastUpdatedTimestamp() { return lastUpdatedTimestamp; } public final void setLastUpdatedTimestamp(Instant lastUpdatedTimestamp) { this.lastUpdatedTimestamp = lastUpdatedTimestamp; } @Override public final Builder lastUpdatedTimestamp(Instant lastUpdatedTimestamp) { this.lastUpdatedTimestamp = lastUpdatedTimestamp; return this; } @Override public Channel build() { return new Channel(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy