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

software.amazon.awssdk.services.mediatailor.model.AvailMatchingCriteria 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.mediatailor.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.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;

/**
 * 

* MediaTailor only places (consumes) prefetched ads if the ad break meets the criteria defined by the dynamic * variables. This gives you granular control over which ad break to place the prefetched ads into. *

*

* As an example, let's say that you set DynamicVariable to scte.event_id and Operator to EQUALS, and your playback * configuration has an ADS URL of * https://my.ads.server.com/path?&podId=[scte.avail_num]&event=[scte.event_id]& * ;duration=[session.avail_duration_secs]. And the prefetch request to the ADS contains these values * https://my.ads.server.com/path?&podId=3&event=my-awesome-event&duration=30. MediaTailor will only insert * the prefetched ads into the ad break if has a SCTE marker with an event id of my-awesome-event, since it must match * the event id that MediaTailor uses to query the ADS. *

*

* You can specify up to five AvailMatchingCriteria. If you specify multiple AvailMatchingCriteria, MediaTailor combines * them to match using a logical AND. You can model logical OR combinations by creating multiple prefetch schedules. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AvailMatchingCriteria implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DYNAMIC_VARIABLE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DynamicVariable").getter(getter(AvailMatchingCriteria::dynamicVariable)) .setter(setter(Builder::dynamicVariable)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DynamicVariable").build()).build(); private static final SdkField OPERATOR_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Operator").getter(getter(AvailMatchingCriteria::operatorAsString)).setter(setter(Builder::operator)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Operator").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DYNAMIC_VARIABLE_FIELD, OPERATOR_FIELD)); private static final long serialVersionUID = 1L; private final String dynamicVariable; private final String operator; private AvailMatchingCriteria(BuilderImpl builder) { this.dynamicVariable = builder.dynamicVariable; this.operator = builder.operator; } /** *

* The dynamic variable(s) that MediaTailor should use as avail matching criteria. MediaTailor only places the * prefetched ads into the avail if the avail matches the criteria defined by the dynamic variable. For information * about dynamic variables, see Using * dynamic ad variables in the MediaTailor User Guide. *

*

* You can include up to 100 dynamic variables. *

* * @return The dynamic variable(s) that MediaTailor should use as avail matching criteria. MediaTailor only places * the prefetched ads into the avail if the avail matches the criteria defined by the dynamic variable. For * information about dynamic variables, see Using dynamic ad variables in * the MediaTailor User Guide.

*

* You can include up to 100 dynamic variables. */ public final String dynamicVariable() { return dynamicVariable; } /** *

* For the DynamicVariable specified in AvailMatchingCriteria, the Operator that is used for the comparison. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #operator} will * return {@link Operator#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #operatorAsString}. *

* * @return For the DynamicVariable specified in AvailMatchingCriteria, the Operator that is used for the comparison. * @see Operator */ public final Operator operator() { return Operator.fromValue(operator); } /** *

* For the DynamicVariable specified in AvailMatchingCriteria, the Operator that is used for the comparison. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #operator} will * return {@link Operator#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #operatorAsString}. *

* * @return For the DynamicVariable specified in AvailMatchingCriteria, the Operator that is used for the comparison. * @see Operator */ public final String operatorAsString() { return operator; } @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(dynamicVariable()); hashCode = 31 * hashCode + Objects.hashCode(operatorAsString()); 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 AvailMatchingCriteria)) { return false; } AvailMatchingCriteria other = (AvailMatchingCriteria) obj; return Objects.equals(dynamicVariable(), other.dynamicVariable()) && Objects.equals(operatorAsString(), other.operatorAsString()); } /** * 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("AvailMatchingCriteria").add("DynamicVariable", dynamicVariable()) .add("Operator", operatorAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "DynamicVariable": return Optional.ofNullable(clazz.cast(dynamicVariable())); case "Operator": return Optional.ofNullable(clazz.cast(operatorAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AvailMatchingCriteria) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The dynamic variable(s) that MediaTailor should use as avail matching criteria. MediaTailor only places the * prefetched ads into the avail if the avail matches the criteria defined by the dynamic variable. For * information about dynamic variables, see Using dynamic ad variables in the * MediaTailor User Guide. *

*

* You can include up to 100 dynamic variables. *

* * @param dynamicVariable * The dynamic variable(s) that MediaTailor should use as avail matching criteria. MediaTailor only * places the prefetched ads into the avail if the avail matches the criteria defined by the dynamic * variable. For information about dynamic variables, see Using dynamic ad variables * in the MediaTailor User Guide.

*

* You can include up to 100 dynamic variables. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dynamicVariable(String dynamicVariable); /** *

* For the DynamicVariable specified in AvailMatchingCriteria, the Operator that is used for the comparison. *

* * @param operator * For the DynamicVariable specified in AvailMatchingCriteria, the Operator that is used for the * comparison. * @see Operator * @return Returns a reference to this object so that method calls can be chained together. * @see Operator */ Builder operator(String operator); /** *

* For the DynamicVariable specified in AvailMatchingCriteria, the Operator that is used for the comparison. *

* * @param operator * For the DynamicVariable specified in AvailMatchingCriteria, the Operator that is used for the * comparison. * @see Operator * @return Returns a reference to this object so that method calls can be chained together. * @see Operator */ Builder operator(Operator operator); } static final class BuilderImpl implements Builder { private String dynamicVariable; private String operator; private BuilderImpl() { } private BuilderImpl(AvailMatchingCriteria model) { dynamicVariable(model.dynamicVariable); operator(model.operator); } public final String getDynamicVariable() { return dynamicVariable; } public final void setDynamicVariable(String dynamicVariable) { this.dynamicVariable = dynamicVariable; } @Override public final Builder dynamicVariable(String dynamicVariable) { this.dynamicVariable = dynamicVariable; return this; } public final String getOperator() { return operator; } public final void setOperator(String operator) { this.operator = operator; } @Override public final Builder operator(String operator) { this.operator = operator; return this; } @Override public final Builder operator(Operator operator) { this.operator(operator == null ? null : operator.toString()); return this; } @Override public AvailMatchingCriteria build() { return new AvailMatchingCriteria(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy