software.amazon.awssdk.services.mediaconnect.model.UpdateFailoverConfig 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.mediaconnect.model;
import java.io.Serializable;
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 settings for source failover
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateFailoverConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField FAILOVER_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FailoverMode").getter(getter(UpdateFailoverConfig::failoverModeAsString))
.setter(setter(Builder::failoverMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("failoverMode").build()).build();
private static final SdkField RECOVERY_WINDOW_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("RecoveryWindow").getter(getter(UpdateFailoverConfig::recoveryWindow))
.setter(setter(Builder::recoveryWindow))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("recoveryWindow").build()).build();
private static final SdkField SOURCE_PRIORITY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SourcePriority")
.getter(getter(UpdateFailoverConfig::sourcePriority)).setter(setter(Builder::sourcePriority))
.constructor(SourcePriority::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sourcePriority").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(UpdateFailoverConfig::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("state").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FAILOVER_MODE_FIELD,
RECOVERY_WINDOW_FIELD, SOURCE_PRIORITY_FIELD, STATE_FIELD));
private static final long serialVersionUID = 1L;
private final String failoverMode;
private final Integer recoveryWindow;
private final SourcePriority sourcePriority;
private final String state;
private UpdateFailoverConfig(BuilderImpl builder) {
this.failoverMode = builder.failoverMode;
this.recoveryWindow = builder.recoveryWindow;
this.sourcePriority = builder.sourcePriority;
this.state = builder.state;
}
/**
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream, allowing
* graceful recovery from any single-source loss. FAILOVER allows switching between different streams.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #failoverMode} will
* return {@link FailoverMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #failoverModeAsString}.
*
*
* @return The type of failover you choose for this flow. MERGE combines the source streams into a single stream,
* allowing graceful recovery from any single-source loss. FAILOVER allows switching between different
* streams.
* @see FailoverMode
*/
public final FailoverMode failoverMode() {
return FailoverMode.fromValue(failoverMode);
}
/**
* The type of failover you choose for this flow. MERGE combines the source streams into a single stream, allowing
* graceful recovery from any single-source loss. FAILOVER allows switching between different streams.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #failoverMode} will
* return {@link FailoverMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #failoverModeAsString}.
*
*
* @return The type of failover you choose for this flow. MERGE combines the source streams into a single stream,
* allowing graceful recovery from any single-source loss. FAILOVER allows switching between different
* streams.
* @see FailoverMode
*/
public final String failoverModeAsString() {
return failoverMode;
}
/**
* Recovery window time to look for dash-7 packets
*
* @return Recovery window time to look for dash-7 packets
*/
public final Integer recoveryWindow() {
return recoveryWindow;
}
/**
* The priority you want to assign to a source. You can have a primary stream and a backup stream or two equally
* prioritized streams.
*
* @return The priority you want to assign to a source. You can have a primary stream and a backup stream or two
* equally prioritized streams.
*/
public final SourcePriority sourcePriority() {
return sourcePriority;
}
/**
* Returns the value of the State property for this object.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link State#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The value of the State property for this object.
* @see State
*/
public final State state() {
return State.fromValue(state);
}
/**
* Returns the value of the State property for this object.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link State#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The value of the State property for this object.
* @see State
*/
public final String stateAsString() {
return state;
}
@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(failoverModeAsString());
hashCode = 31 * hashCode + Objects.hashCode(recoveryWindow());
hashCode = 31 * hashCode + Objects.hashCode(sourcePriority());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
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 UpdateFailoverConfig)) {
return false;
}
UpdateFailoverConfig other = (UpdateFailoverConfig) obj;
return Objects.equals(failoverModeAsString(), other.failoverModeAsString())
&& Objects.equals(recoveryWindow(), other.recoveryWindow())
&& Objects.equals(sourcePriority(), other.sourcePriority())
&& Objects.equals(stateAsString(), other.stateAsString());
}
/**
* 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("UpdateFailoverConfig").add("FailoverMode", failoverModeAsString())
.add("RecoveryWindow", recoveryWindow()).add("SourcePriority", sourcePriority()).add("State", stateAsString())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FailoverMode":
return Optional.ofNullable(clazz.cast(failoverModeAsString()));
case "RecoveryWindow":
return Optional.ofNullable(clazz.cast(recoveryWindow()));
case "SourcePriority":
return Optional.ofNullable(clazz.cast(sourcePriority()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function