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

com.azure.resourcemanager.mediaservices.models.AkamaiSignatureHeaderAuthenticationKey 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.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Akamai Signature Header authentication key.
 */
@Fluent
public final class AkamaiSignatureHeaderAuthenticationKey
    implements JsonSerializable {
    /*
     * identifier of the key
     */
    private String identifier;

    /*
     * authentication key
     */
    private String base64Key;

    /*
     * The expiration time of the authentication key.
     */
    private OffsetDateTime expiration;

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

    /**
     * Get the identifier property: identifier of the key.
     * 
     * @return the identifier value.
     */
    public String identifier() {
        return this.identifier;
    }

    /**
     * Set the identifier property: identifier of the key.
     * 
     * @param identifier the identifier value to set.
     * @return the AkamaiSignatureHeaderAuthenticationKey object itself.
     */
    public AkamaiSignatureHeaderAuthenticationKey withIdentifier(String identifier) {
        this.identifier = identifier;
        return this;
    }

    /**
     * Get the base64Key property: authentication key.
     * 
     * @return the base64Key value.
     */
    public String base64Key() {
        return this.base64Key;
    }

    /**
     * Set the base64Key property: authentication key.
     * 
     * @param base64Key the base64Key value to set.
     * @return the AkamaiSignatureHeaderAuthenticationKey object itself.
     */
    public AkamaiSignatureHeaderAuthenticationKey withBase64Key(String base64Key) {
        this.base64Key = base64Key;
        return this;
    }

    /**
     * Get the expiration property: The expiration time of the authentication key.
     * 
     * @return the expiration value.
     */
    public OffsetDateTime expiration() {
        return this.expiration;
    }

    /**
     * Set the expiration property: The expiration time of the authentication key.
     * 
     * @param expiration the expiration value to set.
     * @return the AkamaiSignatureHeaderAuthenticationKey object itself.
     */
    public AkamaiSignatureHeaderAuthenticationKey withExpiration(OffsetDateTime expiration) {
        this.expiration = expiration;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("identifier", this.identifier);
        jsonWriter.writeStringField("base64Key", this.base64Key);
        jsonWriter.writeStringField("expiration",
            this.expiration == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiration));
        return jsonWriter.writeEndObject();
    }

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

                if ("identifier".equals(fieldName)) {
                    deserializedAkamaiSignatureHeaderAuthenticationKey.identifier = reader.getString();
                } else if ("base64Key".equals(fieldName)) {
                    deserializedAkamaiSignatureHeaderAuthenticationKey.base64Key = reader.getString();
                } else if ("expiration".equals(fieldName)) {
                    deserializedAkamaiSignatureHeaderAuthenticationKey.expiration = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAkamaiSignatureHeaderAuthenticationKey;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy