
software.amazon.awssdk.services.kinesisvideo.model.UpdateDataRetentionRequest 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.kinesisvideo.model;
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.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.LocationTrait;
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 UpdateDataRetentionRequest extends KinesisVideoRequest implements
ToCopyableBuilder {
private static final SdkField STREAM_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StreamName").getter(getter(UpdateDataRetentionRequest::streamName)).setter(setter(Builder::streamName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StreamName").build()).build();
private static final SdkField STREAM_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StreamARN").getter(getter(UpdateDataRetentionRequest::streamARN)).setter(setter(Builder::streamARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StreamARN").build()).build();
private static final SdkField CURRENT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CurrentVersion").getter(getter(UpdateDataRetentionRequest::currentVersion))
.setter(setter(Builder::currentVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CurrentVersion").build()).build();
private static final SdkField OPERATION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Operation").getter(getter(UpdateDataRetentionRequest::operationAsString))
.setter(setter(Builder::operation))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Operation").build()).build();
private static final SdkField DATA_RETENTION_CHANGE_IN_HOURS_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("DataRetentionChangeInHours")
.getter(getter(UpdateDataRetentionRequest::dataRetentionChangeInHours))
.setter(setter(Builder::dataRetentionChangeInHours))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataRetentionChangeInHours").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STREAM_NAME_FIELD,
STREAM_ARN_FIELD, CURRENT_VERSION_FIELD, OPERATION_FIELD, DATA_RETENTION_CHANGE_IN_HOURS_FIELD));
private final String streamName;
private final String streamARN;
private final String currentVersion;
private final String operation;
private final Integer dataRetentionChangeInHours;
private UpdateDataRetentionRequest(BuilderImpl builder) {
super(builder);
this.streamName = builder.streamName;
this.streamARN = builder.streamARN;
this.currentVersion = builder.currentVersion;
this.operation = builder.operation;
this.dataRetentionChangeInHours = builder.dataRetentionChangeInHours;
}
/**
*
* The name of the stream whose retention period you want to change.
*
*
* @return The name of the stream whose retention period you want to change.
*/
public final String streamName() {
return streamName;
}
/**
*
* The Amazon Resource Name (ARN) of the stream whose retention period you want to change.
*
*
* @return The Amazon Resource Name (ARN) of the stream whose retention period you want to change.
*/
public final String streamARN() {
return streamARN;
}
/**
*
* The version of the stream whose retention period you want to change. To get the version, call either the
* DescribeStream
or the ListStreams
API.
*
*
* @return The version of the stream whose retention period you want to change. To get the version, call either the
* DescribeStream
or the ListStreams
API.
*/
public final String currentVersion() {
return currentVersion;
}
/**
*
* Indicates whether you want to increase or decrease the retention period.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #operation} will
* return {@link UpdateDataRetentionOperation#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #operationAsString}.
*
*
* @return Indicates whether you want to increase or decrease the retention period.
* @see UpdateDataRetentionOperation
*/
public final UpdateDataRetentionOperation operation() {
return UpdateDataRetentionOperation.fromValue(operation);
}
/**
*
* Indicates whether you want to increase or decrease the retention period.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #operation} will
* return {@link UpdateDataRetentionOperation#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #operationAsString}.
*
*
* @return Indicates whether you want to increase or decrease the retention period.
* @see UpdateDataRetentionOperation
*/
public final String operationAsString() {
return operation;
}
/**
*
* The retention period, in hours. The value you specify replaces the current value. The maximum value for this
* parameter is 87600 (ten years).
*
*
* @return The retention period, in hours. The value you specify replaces the current value. The maximum value for
* this parameter is 87600 (ten years).
*/
public final Integer dataRetentionChangeInHours() {
return dataRetentionChangeInHours;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(streamName());
hashCode = 31 * hashCode + Objects.hashCode(streamARN());
hashCode = 31 * hashCode + Objects.hashCode(currentVersion());
hashCode = 31 * hashCode + Objects.hashCode(operationAsString());
hashCode = 31 * hashCode + Objects.hashCode(dataRetentionChangeInHours());
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 UpdateDataRetentionRequest)) {
return false;
}
UpdateDataRetentionRequest other = (UpdateDataRetentionRequest) obj;
return Objects.equals(streamName(), other.streamName()) && Objects.equals(streamARN(), other.streamARN())
&& Objects.equals(currentVersion(), other.currentVersion())
&& Objects.equals(operationAsString(), other.operationAsString())
&& Objects.equals(dataRetentionChangeInHours(), other.dataRetentionChangeInHours());
}
/**
* 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("UpdateDataRetentionRequest").add("StreamName", streamName()).add("StreamARN", streamARN())
.add("CurrentVersion", currentVersion()).add("Operation", operationAsString())
.add("DataRetentionChangeInHours", dataRetentionChangeInHours()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StreamName":
return Optional.ofNullable(clazz.cast(streamName()));
case "StreamARN":
return Optional.ofNullable(clazz.cast(streamARN()));
case "CurrentVersion":
return Optional.ofNullable(clazz.cast(currentVersion()));
case "Operation":
return Optional.ofNullable(clazz.cast(operationAsString()));
case "DataRetentionChangeInHours":
return Optional.ofNullable(clazz.cast(dataRetentionChangeInHours()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function