
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.HashMap;
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 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 static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
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 number of hours to adjust the current retention by. The value you specify is added to or subtracted from the
* current value, depending on the operation
.
*
*
* The minimum value for data retention is 0 and the maximum value is 87600 (ten years).
*
*
* @return The number of hours to adjust the current retention by. The value you specify is added to or subtracted
* from the current value, depending on the operation
.
*
* The minimum value for data retention is 0 and the maximum value 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;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("StreamName", STREAM_NAME_FIELD);
map.put("StreamARN", STREAM_ARN_FIELD);
map.put("CurrentVersion", CURRENT_VERSION_FIELD);
map.put("Operation", OPERATION_FIELD);
map.put("DataRetentionChangeInHours", DATA_RETENTION_CHANGE_IN_HOURS_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function
*
* The minimum value for data retention is 0 and the maximum value is 87600 (ten years).
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dataRetentionChangeInHours(Integer dataRetentionChangeInHours);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends KinesisVideoRequest.BuilderImpl implements Builder {
private String streamName;
private String streamARN;
private String currentVersion;
private String operation;
private Integer dataRetentionChangeInHours;
private BuilderImpl() {
}
private BuilderImpl(UpdateDataRetentionRequest model) {
super(model);
streamName(model.streamName);
streamARN(model.streamARN);
currentVersion(model.currentVersion);
operation(model.operation);
dataRetentionChangeInHours(model.dataRetentionChangeInHours);
}
public final String getStreamName() {
return streamName;
}
public final void setStreamName(String streamName) {
this.streamName = streamName;
}
@Override
public final Builder streamName(String streamName) {
this.streamName = streamName;
return this;
}
public final String getStreamARN() {
return streamARN;
}
public final void setStreamARN(String streamARN) {
this.streamARN = streamARN;
}
@Override
public final Builder streamARN(String streamARN) {
this.streamARN = streamARN;
return this;
}
public final String getCurrentVersion() {
return currentVersion;
}
public final void setCurrentVersion(String currentVersion) {
this.currentVersion = currentVersion;
}
@Override
public final Builder currentVersion(String currentVersion) {
this.currentVersion = currentVersion;
return this;
}
public final String getOperation() {
return operation;
}
public final void setOperation(String operation) {
this.operation = operation;
}
@Override
public final Builder operation(String operation) {
this.operation = operation;
return this;
}
@Override
public final Builder operation(UpdateDataRetentionOperation operation) {
this.operation(operation == null ? null : operation.toString());
return this;
}
public final Integer getDataRetentionChangeInHours() {
return dataRetentionChangeInHours;
}
public final void setDataRetentionChangeInHours(Integer dataRetentionChangeInHours) {
this.dataRetentionChangeInHours = dataRetentionChangeInHours;
}
@Override
public final Builder dataRetentionChangeInHours(Integer dataRetentionChangeInHours) {
this.dataRetentionChangeInHours = dataRetentionChangeInHours;
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public UpdateDataRetentionRequest build() {
return new UpdateDataRetentionRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}