software.amazon.awssdk.services.chime.model.ChannelBan 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 ban.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ChannelBan implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField MEMBER_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Member").getter(getter(ChannelBan::member)).setter(setter(Builder::member))
.constructor(Identity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Member").build()).build();
private static final SdkField CHANNEL_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ChannelArn").getter(getter(ChannelBan::channelArn)).setter(setter(Builder::channelArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChannelArn").build()).build();
private static final SdkField CREATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedTimestamp").getter(getter(ChannelBan::createdTimestamp))
.setter(setter(Builder::createdTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimestamp").build()).build();
private static final SdkField CREATED_BY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("CreatedBy").getter(getter(ChannelBan::createdBy)).setter(setter(Builder::createdBy))
.constructor(Identity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedBy").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MEMBER_FIELD,
CHANNEL_ARN_FIELD, CREATED_TIMESTAMP_FIELD, CREATED_BY_FIELD));
private static final long serialVersionUID = 1L;
private final Identity member;
private final String channelArn;
private final Instant createdTimestamp;
private final Identity createdBy;
private ChannelBan(BuilderImpl builder) {
this.member = builder.member;
this.channelArn = builder.channelArn;
this.createdTimestamp = builder.createdTimestamp;
this.createdBy = builder.createdBy;
}
/**
*
* The member being banned from the channel.
*
*
* @return The member being banned from the channel.
*/
public final Identity member() {
return member;
}
/**
*
* The ARN of the channel from which a member is being banned.
*
*
* @return The ARN of the channel from which a member is being banned.
*/
public final String channelArn() {
return channelArn;
}
/**
*
* The time at which the ban was created.
*
*
* @return The time at which the ban was created.
*/
public final Instant createdTimestamp() {
return createdTimestamp;
}
/**
*
* The AppInstanceUser who created the ban.
*
*
* @return The AppInstanceUser who created the ban.
*/
public final Identity createdBy() {
return createdBy;
}
@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(member());
hashCode = 31 * hashCode + Objects.hashCode(channelArn());
hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(createdBy());
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 ChannelBan)) {
return false;
}
ChannelBan other = (ChannelBan) obj;
return Objects.equals(member(), other.member()) && Objects.equals(channelArn(), other.channelArn())
&& Objects.equals(createdTimestamp(), other.createdTimestamp()) && Objects.equals(createdBy(), other.createdBy());
}
/**
* 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("ChannelBan").add("Member", member()).add("ChannelArn", channelArn())
.add("CreatedTimestamp", createdTimestamp()).add("CreatedBy", createdBy()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Member":
return Optional.ofNullable(clazz.cast(member()));
case "ChannelArn":
return Optional.ofNullable(clazz.cast(channelArn()));
case "CreatedTimestamp":
return Optional.ofNullable(clazz.cast(createdTimestamp()));
case "CreatedBy":
return Optional.ofNullable(clazz.cast(createdBy()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function © 2015 - 2025 Weber Informatics LLC | Privacy Policy