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

com.azure.resourcemanager.keyvault.models.Trigger 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 Trigger model.
 */
@Fluent
public final class Trigger implements JsonSerializable {
    /*
     * The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601
     * duration format. Eg: 'P90D', 'P1Y'.
     */
    private String timeAfterCreate;

    /*
     * The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration format. Eg: 'P90D',
     * 'P1Y'.
     */
    private String timeBeforeExpiry;

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

    /**
     * Get the timeAfterCreate property: The time duration after key creation to rotate the key. It only applies to
     * rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'.
     * 
     * @return the timeAfterCreate value.
     */
    public String timeAfterCreate() {
        return this.timeAfterCreate;
    }

    /**
     * Set the timeAfterCreate property: The time duration after key creation to rotate the key. It only applies to
     * rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'.
     * 
     * @param timeAfterCreate the timeAfterCreate value to set.
     * @return the Trigger object itself.
     */
    public Trigger withTimeAfterCreate(String timeAfterCreate) {
        this.timeAfterCreate = timeAfterCreate;
        return this;
    }

    /**
     * Get the timeBeforeExpiry property: The time duration before key expiring to rotate or notify. It will be in ISO
     * 8601 duration format. Eg: 'P90D', 'P1Y'.
     * 
     * @return the timeBeforeExpiry value.
     */
    public String timeBeforeExpiry() {
        return this.timeBeforeExpiry;
    }

    /**
     * Set the timeBeforeExpiry property: The time duration before key expiring to rotate or notify. It will be in ISO
     * 8601 duration format. Eg: 'P90D', 'P1Y'.
     * 
     * @param timeBeforeExpiry the timeBeforeExpiry value to set.
     * @return the Trigger object itself.
     */
    public Trigger withTimeBeforeExpiry(String timeBeforeExpiry) {
        this.timeBeforeExpiry = timeBeforeExpiry;
        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("timeAfterCreate", this.timeAfterCreate);
        jsonWriter.writeStringField("timeBeforeExpiry", this.timeBeforeExpiry);
        return jsonWriter.writeEndObject();
    }

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

                if ("timeAfterCreate".equals(fieldName)) {
                    deserializedTrigger.timeAfterCreate = reader.getString();
                } else if ("timeBeforeExpiry".equals(fieldName)) {
                    deserializedTrigger.timeBeforeExpiry = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedTrigger;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy