
software.amazon.awssdk.services.iotanalytics.model.CreateChannelRequest 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.iotanalytics.model;
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.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateChannelRequest extends IoTAnalyticsRequest implements
ToCopyableBuilder {
private static final SdkField CHANNEL_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateChannelRequest::channelName)).setter(setter(Builder::channelName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("channelName").build()).build();
private static final SdkField CHANNEL_STORAGE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(CreateChannelRequest::channelStorage))
.setter(setter(Builder::channelStorage)).constructor(ChannelStorage::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("channelStorage").build()).build();
private static final SdkField RETENTION_PERIOD_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(CreateChannelRequest::retentionPeriod))
.setter(setter(Builder::retentionPeriod)).constructor(RetentionPeriod::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("retentionPeriod").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(CreateChannelRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CHANNEL_NAME_FIELD,
CHANNEL_STORAGE_FIELD, RETENTION_PERIOD_FIELD, TAGS_FIELD));
private final String channelName;
private final ChannelStorage channelStorage;
private final RetentionPeriod retentionPeriod;
private final List tags;
private CreateChannelRequest(BuilderImpl builder) {
super(builder);
this.channelName = builder.channelName;
this.channelStorage = builder.channelStorage;
this.retentionPeriod = builder.retentionPeriod;
this.tags = builder.tags;
}
/**
*
* The name of the channel.
*
*
* @return The name of the channel.
*/
public String channelName() {
return channelName;
}
/**
*
* Where channel data is stored. You may choose one of "serviceManagedS3" or "customerManagedS3" storage. If not
* specified, the default is "serviceManagedS3". This cannot be changed after creation of the channel.
*
*
* @return Where channel data is stored. You may choose one of "serviceManagedS3" or "customerManagedS3" storage. If
* not specified, the default is "serviceManagedS3". This cannot be changed after creation of the channel.
*/
public ChannelStorage channelStorage() {
return channelStorage;
}
/**
*
* How long, in days, message data is kept for the channel. When "customerManagedS3" storage is selected, this
* parameter is ignored.
*
*
* @return How long, in days, message data is kept for the channel. When "customerManagedS3" storage is selected,
* this parameter is ignored.
*/
public RetentionPeriod retentionPeriod() {
return retentionPeriod;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* Metadata which can be used to manage the channel.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return Metadata which can be used to manage the channel.
*/
public List tags() {
return tags;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(channelName());
hashCode = 31 * hashCode + Objects.hashCode(channelStorage());
hashCode = 31 * hashCode + Objects.hashCode(retentionPeriod());
hashCode = 31 * hashCode + Objects.hashCode(tags());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateChannelRequest)) {
return false;
}
CreateChannelRequest other = (CreateChannelRequest) obj;
return Objects.equals(channelName(), other.channelName()) && Objects.equals(channelStorage(), other.channelStorage())
&& Objects.equals(retentionPeriod(), other.retentionPeriod()) && Objects.equals(tags(), other.tags());
}
/**
* 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 String toString() {
return ToString.builder("CreateChannelRequest").add("ChannelName", channelName()).add("ChannelStorage", channelStorage())
.add("RetentionPeriod", retentionPeriod()).add("Tags", tags()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "channelName":
return Optional.ofNullable(clazz.cast(channelName()));
case "channelStorage":
return Optional.ofNullable(clazz.cast(channelStorage()));
case "retentionPeriod":
return Optional.ofNullable(clazz.cast(retentionPeriod()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy