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

com.azure.resourcemanager.mediaservices.fluent.models.ContentKeyPolicyInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for MediaServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This Swagger was generated by the API Framework. Package tag package-account-2023-01.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.mediaservices.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyOption;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.UUID;

/**
 * A Content Key Policy resource.
 */
@Fluent
public final class ContentKeyPolicyInner extends ProxyResource {
    /*
     * The properties of the Content Key Policy.
     */
    private ContentKeyPolicyPropertiesInner innerProperties;

    /*
     * The system metadata relating to this resource.
     */
    private SystemData systemData;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

    /**
     * Creates an instance of ContentKeyPolicyInner class.
     */
    public ContentKeyPolicyInner() {
    }

    /**
     * Get the innerProperties property: The properties of the Content Key Policy.
     * 
     * @return the innerProperties value.
     */
    private ContentKeyPolicyPropertiesInner innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: The system metadata relating to this resource.
     * 
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * Get the policyId property: The legacy Policy ID.
     * 
     * @return the policyId value.
     */
    public UUID policyId() {
        return this.innerProperties() == null ? null : this.innerProperties().policyId();
    }

    /**
     * Get the created property: The creation date of the Policy.
     * 
     * @return the created value.
     */
    public OffsetDateTime created() {
        return this.innerProperties() == null ? null : this.innerProperties().created();
    }

    /**
     * Get the lastModified property: The last modified date of the Policy.
     * 
     * @return the lastModified value.
     */
    public OffsetDateTime lastModified() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModified();
    }

    /**
     * Get the description property: A description for the Policy.
     * 
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: A description for the Policy.
     * 
     * @param description the description value to set.
     * @return the ContentKeyPolicyInner object itself.
     */
    public ContentKeyPolicyInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ContentKeyPolicyPropertiesInner();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the options property: The Key Policy options.
     * 
     * @return the options value.
     */
    public List options() {
        return this.innerProperties() == null ? null : this.innerProperties().options();
    }

    /**
     * Set the options property: The Key Policy options.
     * 
     * @param options the options value to set.
     * @return the ContentKeyPolicyInner object itself.
     */
    public ContentKeyPolicyInner withOptions(List options) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ContentKeyPolicyPropertiesInner();
        }
        this.innerProperties().withOptions(options);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of ContentKeyPolicyInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ContentKeyPolicyInner if the JsonReader was pointing to an instance of it, or null if it
     * was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the ContentKeyPolicyInner.
     */
    public static ContentKeyPolicyInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ContentKeyPolicyInner deserializedContentKeyPolicyInner = new ContentKeyPolicyInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedContentKeyPolicyInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedContentKeyPolicyInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedContentKeyPolicyInner.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedContentKeyPolicyInner.innerProperties
                        = ContentKeyPolicyPropertiesInner.fromJson(reader);
                } else if ("systemData".equals(fieldName)) {
                    deserializedContentKeyPolicyInner.systemData = SystemData.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedContentKeyPolicyInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy