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

software.amazon.awssdk.services.mediaconvert.model.StaticKeyProvider Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Elemental MediaConvert module holds the client classes that are used for communicating with AWS Elemental MediaConvert Service

There is a newer version: 2.29.15
Show newest version
/*
 * 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.mediaconvert.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;

/**
 * Use these settings to set up encryption with a static key provider.
 */
@Generated("software.amazon.awssdk:codegen")
public final class StaticKeyProvider implements SdkPojo, Serializable,
        ToCopyableBuilder {
    private static final SdkField KEY_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("KeyFormat").getter(getter(StaticKeyProvider::keyFormat)).setter(setter(Builder::keyFormat))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("keyFormat").build()).build();

    private static final SdkField KEY_FORMAT_VERSIONS_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("KeyFormatVersions").getter(getter(StaticKeyProvider::keyFormatVersions))
            .setter(setter(Builder::keyFormatVersions))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("keyFormatVersions").build()).build();

    private static final SdkField STATIC_KEY_VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("StaticKeyValue").getter(getter(StaticKeyProvider::staticKeyValue))
            .setter(setter(Builder::staticKeyValue))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("staticKeyValue").build()).build();

    private static final SdkField URL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Url")
            .getter(getter(StaticKeyProvider::url)).setter(setter(Builder::url))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("url").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(KEY_FORMAT_FIELD,
            KEY_FORMAT_VERSIONS_FIELD, STATIC_KEY_VALUE_FIELD, URL_FIELD));

    private static final long serialVersionUID = 1L;

    private final String keyFormat;

    private final String keyFormatVersions;

    private final String staticKeyValue;

    private final String url;

    private StaticKeyProvider(BuilderImpl builder) {
        this.keyFormat = builder.keyFormat;
        this.keyFormatVersions = builder.keyFormatVersions;
        this.staticKeyValue = builder.staticKeyValue;
        this.url = builder.url;
    }

    /**
     * Relates to DRM implementation. Sets the value of the KEYFORMAT attribute. Must be 'identity' or a reverse DNS
     * string. May be omitted to indicate an implicit value of 'identity'.
     * 
     * @return Relates to DRM implementation. Sets the value of the KEYFORMAT attribute. Must be 'identity' or a reverse
     *         DNS string. May be omitted to indicate an implicit value of 'identity'.
     */
    public final String keyFormat() {
        return keyFormat;
    }

    /**
     * Relates to DRM implementation. Either a single positive integer version value or a slash delimited list of
     * version values (1/2/3).
     * 
     * @return Relates to DRM implementation. Either a single positive integer version value or a slash delimited list
     *         of version values (1/2/3).
     */
    public final String keyFormatVersions() {
        return keyFormatVersions;
    }

    /**
     * Relates to DRM implementation. Use a 32-character hexidecimal string to specify Key Value.
     * 
     * @return Relates to DRM implementation. Use a 32-character hexidecimal string to specify Key Value.
     */
    public final String staticKeyValue() {
        return staticKeyValue;
    }

    /**
     * Relates to DRM implementation. The location of the license server used for protecting content.
     * 
     * @return Relates to DRM implementation. The location of the license server used for protecting content.
     */
    public final String url() {
        return url;
    }

    @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(keyFormat());
        hashCode = 31 * hashCode + Objects.hashCode(keyFormatVersions());
        hashCode = 31 * hashCode + Objects.hashCode(staticKeyValue());
        hashCode = 31 * hashCode + Objects.hashCode(url());
        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 StaticKeyProvider)) {
            return false;
        }
        StaticKeyProvider other = (StaticKeyProvider) obj;
        return Objects.equals(keyFormat(), other.keyFormat()) && Objects.equals(keyFormatVersions(), other.keyFormatVersions())
                && Objects.equals(staticKeyValue(), other.staticKeyValue()) && Objects.equals(url(), other.url());
    }

    /**
     * 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("StaticKeyProvider").add("KeyFormat", keyFormat()).add("KeyFormatVersions", keyFormatVersions())
                .add("StaticKeyValue", staticKeyValue()).add("Url", url()).build();
    }

    public final  Optional getValueForField(String fieldName, Class clazz) {
        switch (fieldName) {
        case "KeyFormat":
            return Optional.ofNullable(clazz.cast(keyFormat()));
        case "KeyFormatVersions":
            return Optional.ofNullable(clazz.cast(keyFormatVersions()));
        case "StaticKeyValue":
            return Optional.ofNullable(clazz.cast(staticKeyValue()));
        case "Url":
            return Optional.ofNullable(clazz.cast(url()));
        default:
            return Optional.empty();
        }
    }

    @Override
    public final List> sdkFields() {
        return SDK_FIELDS;
    }

    private static  Function getter(Function g) {
        return obj -> g.apply((StaticKeyProvider) obj);
    }

    private static  BiConsumer setter(BiConsumer s) {
        return (obj, val) -> s.accept((Builder) obj, val);
    }

    public interface Builder extends SdkPojo, CopyableBuilder {
        /**
         * Relates to DRM implementation. Sets the value of the KEYFORMAT attribute. Must be 'identity' or a reverse DNS
         * string. May be omitted to indicate an implicit value of 'identity'.
         * 
         * @param keyFormat
         *        Relates to DRM implementation. Sets the value of the KEYFORMAT attribute. Must be 'identity' or a
         *        reverse DNS string. May be omitted to indicate an implicit value of 'identity'.
         * @return Returns a reference to this object so that method calls can be chained together.
         */
        Builder keyFormat(String keyFormat);

        /**
         * Relates to DRM implementation. Either a single positive integer version value or a slash delimited list of
         * version values (1/2/3).
         * 
         * @param keyFormatVersions
         *        Relates to DRM implementation. Either a single positive integer version value or a slash delimited
         *        list of version values (1/2/3).
         * @return Returns a reference to this object so that method calls can be chained together.
         */
        Builder keyFormatVersions(String keyFormatVersions);

        /**
         * Relates to DRM implementation. Use a 32-character hexidecimal string to specify Key Value.
         * 
         * @param staticKeyValue
         *        Relates to DRM implementation. Use a 32-character hexidecimal string to specify Key Value.
         * @return Returns a reference to this object so that method calls can be chained together.
         */
        Builder staticKeyValue(String staticKeyValue);

        /**
         * Relates to DRM implementation. The location of the license server used for protecting content.
         * 
         * @param url
         *        Relates to DRM implementation. The location of the license server used for protecting content.
         * @return Returns a reference to this object so that method calls can be chained together.
         */
        Builder url(String url);
    }

    static final class BuilderImpl implements Builder {
        private String keyFormat;

        private String keyFormatVersions;

        private String staticKeyValue;

        private String url;

        private BuilderImpl() {
        }

        private BuilderImpl(StaticKeyProvider model) {
            keyFormat(model.keyFormat);
            keyFormatVersions(model.keyFormatVersions);
            staticKeyValue(model.staticKeyValue);
            url(model.url);
        }

        public final String getKeyFormat() {
            return keyFormat;
        }

        public final void setKeyFormat(String keyFormat) {
            this.keyFormat = keyFormat;
        }

        @Override
        public final Builder keyFormat(String keyFormat) {
            this.keyFormat = keyFormat;
            return this;
        }

        public final String getKeyFormatVersions() {
            return keyFormatVersions;
        }

        public final void setKeyFormatVersions(String keyFormatVersions) {
            this.keyFormatVersions = keyFormatVersions;
        }

        @Override
        public final Builder keyFormatVersions(String keyFormatVersions) {
            this.keyFormatVersions = keyFormatVersions;
            return this;
        }

        public final String getStaticKeyValue() {
            return staticKeyValue;
        }

        public final void setStaticKeyValue(String staticKeyValue) {
            this.staticKeyValue = staticKeyValue;
        }

        @Override
        public final Builder staticKeyValue(String staticKeyValue) {
            this.staticKeyValue = staticKeyValue;
            return this;
        }

        public final String getUrl() {
            return url;
        }

        public final void setUrl(String url) {
            this.url = url;
        }

        @Override
        public final Builder url(String url) {
            this.url = url;
            return this;
        }

        @Override
        public StaticKeyProvider build() {
            return new StaticKeyProvider(this);
        }

        @Override
        public List> sdkFields() {
            return SDK_FIELDS;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy