All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.mediaconnect.model.FailoverConfig 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 FailoverConfig implements SdkPojo, Serializable, ToCopyableBuilder {
    private static final SdkField FAILOVER_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("FailoverMode").getter(getter(FailoverConfig::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(FailoverConfig::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(FailoverConfig::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(FailoverConfig::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 FailoverConfig(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; } /** * Search window time to look for dash-7 packets * * @return Search 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 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 FailoverConfig)) { return false; } FailoverConfig other = (FailoverConfig) 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("FailoverConfig").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 getter(Function g) { return obj -> g.apply((FailoverConfig) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** * 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. * * @param 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. * @see FailoverMode * @return Returns a reference to this object so that method calls can be chained together. * @see FailoverMode */ Builder failoverMode(String 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. * * @param 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. * @see FailoverMode * @return Returns a reference to this object so that method calls can be chained together. * @see FailoverMode */ Builder failoverMode(FailoverMode failoverMode); /** * Search window time to look for dash-7 packets * * @param recoveryWindow * Search window time to look for dash-7 packets * @return Returns a reference to this object so that method calls can be chained together. */ Builder recoveryWindow(Integer 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. * * @param sourcePriority * 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 Returns a reference to this object so that method calls can be chained together. */ Builder sourcePriority(SourcePriority sourcePriority); /** * The priority you want to assign to a source. You can have a primary stream and a backup stream or two equally * prioritized streams. This is a convenience that creates an instance of the {@link SourcePriority.Builder} * avoiding the need to create one manually via {@link SourcePriority#builder()}. * * When the {@link Consumer} completes, {@link SourcePriority.Builder#build()} is called immediately and its * result is passed to {@link #sourcePriority(SourcePriority)}. * * @param sourcePriority * a consumer that will call methods on {@link SourcePriority.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #sourcePriority(SourcePriority) */ default Builder sourcePriority(Consumer sourcePriority) { return sourcePriority(SourcePriority.builder().applyMutation(sourcePriority).build()); } /** * Sets the value of the State property for this object. * * @param state * The new value for the State property for this object. * @see State * @return Returns a reference to this object so that method calls can be chained together. * @see State */ Builder state(String state); /** * Sets the value of the State property for this object. * * @param state * The new value for the State property for this object. * @see State * @return Returns a reference to this object so that method calls can be chained together. * @see State */ Builder state(State state); } static final class BuilderImpl implements Builder { private String failoverMode; private Integer recoveryWindow; private SourcePriority sourcePriority; private String state; private BuilderImpl() { } private BuilderImpl(FailoverConfig model) { failoverMode(model.failoverMode); recoveryWindow(model.recoveryWindow); sourcePriority(model.sourcePriority); state(model.state); } public final String getFailoverMode() { return failoverMode; } @Override public final Builder failoverMode(String failoverMode) { this.failoverMode = failoverMode; return this; } @Override public final Builder failoverMode(FailoverMode failoverMode) { this.failoverMode(failoverMode == null ? null : failoverMode.toString()); return this; } public final void setFailoverMode(String failoverMode) { this.failoverMode = failoverMode; } public final Integer getRecoveryWindow() { return recoveryWindow; } @Override public final Builder recoveryWindow(Integer recoveryWindow) { this.recoveryWindow = recoveryWindow; return this; } public final void setRecoveryWindow(Integer recoveryWindow) { this.recoveryWindow = recoveryWindow; } public final SourcePriority.Builder getSourcePriority() { return sourcePriority != null ? sourcePriority.toBuilder() : null; } @Override public final Builder sourcePriority(SourcePriority sourcePriority) { this.sourcePriority = sourcePriority; return this; } public final void setSourcePriority(SourcePriority.BuilderImpl sourcePriority) { this.sourcePriority = sourcePriority != null ? sourcePriority.build() : null; } public final String getState() { return state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(State state) { this.state(state == null ? null : state.toString()); return this; } public final void setState(String state) { this.state = state; } @Override public FailoverConfig build() { return new FailoverConfig(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy