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

com.azure.resourcemanager.keyvault.models.ManagedHsmKeyRotationPolicyAttributes Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Key Vault Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

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.keyvault.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * The ManagedHsmKeyRotationPolicyAttributes model.
 */
@Fluent
public final class ManagedHsmKeyRotationPolicyAttributes
    implements JsonSerializable {
    /*
     * Creation time in seconds since 1970-01-01T00:00:00Z.
     */
    private Long created;

    /*
     * Last updated time in seconds since 1970-01-01T00:00:00Z.
     */
    private Long updated;

    /*
     * The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'.
     */
    private String expiryTime;

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

    /**
     * Get the created property: Creation time in seconds since 1970-01-01T00:00:00Z.
     * 
     * @return the created value.
     */
    public Long created() {
        return this.created;
    }

    /**
     * Get the updated property: Last updated time in seconds since 1970-01-01T00:00:00Z.
     * 
     * @return the updated value.
     */
    public Long updated() {
        return this.updated;
    }

    /**
     * Get the expiryTime property: The expiration time for the new key version. It should be in ISO8601 format. Eg:
     * 'P90D', 'P1Y'.
     * 
     * @return the expiryTime value.
     */
    public String expiryTime() {
        return this.expiryTime;
    }

    /**
     * Set the expiryTime property: The expiration time for the new key version. It should be in ISO8601 format. Eg:
     * 'P90D', 'P1Y'.
     * 
     * @param expiryTime the expiryTime value to set.
     * @return the ManagedHsmKeyRotationPolicyAttributes object itself.
     */
    public ManagedHsmKeyRotationPolicyAttributes withExpiryTime(String expiryTime) {
        this.expiryTime = expiryTime;
        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("expiryTime", this.expiryTime);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of ManagedHsmKeyRotationPolicyAttributes from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ManagedHsmKeyRotationPolicyAttributes 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 ManagedHsmKeyRotationPolicyAttributes.
     */
    public static ManagedHsmKeyRotationPolicyAttributes fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ManagedHsmKeyRotationPolicyAttributes deserializedManagedHsmKeyRotationPolicyAttributes
                = new ManagedHsmKeyRotationPolicyAttributes();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("created".equals(fieldName)) {
                    deserializedManagedHsmKeyRotationPolicyAttributes.created = reader.getNullable(JsonReader::getLong);
                } else if ("updated".equals(fieldName)) {
                    deserializedManagedHsmKeyRotationPolicyAttributes.updated = reader.getNullable(JsonReader::getLong);
                } else if ("expiryTime".equals(fieldName)) {
                    deserializedManagedHsmKeyRotationPolicyAttributes.expiryTime = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedManagedHsmKeyRotationPolicyAttributes;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy