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

com.azure.resourcemanager.automation.fluent.models.VariableProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.

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.automation.fluent.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;

/**
 * Definition of the variable properties.
 */
@Fluent
public final class VariableProperties implements JsonSerializable {
    /*
     * Gets or sets the value of the variable.
     */
    private String value;

    /*
     * Gets or sets the encrypted flag of the variable.
     */
    private Boolean isEncrypted;

    /*
     * Gets or sets the creation time.
     */
    private OffsetDateTime creationTime;

    /*
     * Gets or sets the last modified time.
     */
    private OffsetDateTime lastModifiedTime;

    /*
     * Gets or sets the description.
     */
    private String description;

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

    /**
     * Get the value property: Gets or sets the value of the variable.
     * 
     * @return the value value.
     */
    public String value() {
        return this.value;
    }

    /**
     * Set the value property: Gets or sets the value of the variable.
     * 
     * @param value the value value to set.
     * @return the VariableProperties object itself.
     */
    public VariableProperties withValue(String value) {
        this.value = value;
        return this;
    }

    /**
     * Get the isEncrypted property: Gets or sets the encrypted flag of the variable.
     * 
     * @return the isEncrypted value.
     */
    public Boolean isEncrypted() {
        return this.isEncrypted;
    }

    /**
     * Set the isEncrypted property: Gets or sets the encrypted flag of the variable.
     * 
     * @param isEncrypted the isEncrypted value to set.
     * @return the VariableProperties object itself.
     */
    public VariableProperties withIsEncrypted(Boolean isEncrypted) {
        this.isEncrypted = isEncrypted;
        return this;
    }

    /**
     * Get the creationTime property: Gets or sets the creation time.
     * 
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.creationTime;
    }

    /**
     * Set the creationTime property: Gets or sets the creation time.
     * 
     * @param creationTime the creationTime value to set.
     * @return the VariableProperties object itself.
     */
    public VariableProperties withCreationTime(OffsetDateTime creationTime) {
        this.creationTime = creationTime;
        return this;
    }

    /**
     * Get the lastModifiedTime property: Gets or sets the last modified time.
     * 
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.lastModifiedTime;
    }

    /**
     * Set the lastModifiedTime property: Gets or sets the last modified time.
     * 
     * @param lastModifiedTime the lastModifiedTime value to set.
     * @return the VariableProperties object itself.
     */
    public VariableProperties withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        this.lastModifiedTime = lastModifiedTime;
        return this;
    }

    /**
     * Get the description property: Gets or sets the description.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Gets or sets the description.
     * 
     * @param description the description value to set.
     * @return the VariableProperties object itself.
     */
    public VariableProperties withDescription(String description) {
        this.description = description;
        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("value", this.value);
        jsonWriter.writeBooleanField("isEncrypted", this.isEncrypted);
        jsonWriter.writeStringField("creationTime",
            this.creationTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.creationTime));
        jsonWriter.writeStringField("lastModifiedTime",
            this.lastModifiedTime == null
                ? null
                : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedTime));
        jsonWriter.writeStringField("description", this.description);
        return jsonWriter.writeEndObject();
    }

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

                if ("value".equals(fieldName)) {
                    deserializedVariableProperties.value = reader.getString();
                } else if ("isEncrypted".equals(fieldName)) {
                    deserializedVariableProperties.isEncrypted = reader.getNullable(JsonReader::getBoolean);
                } else if ("creationTime".equals(fieldName)) {
                    deserializedVariableProperties.creationTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("lastModifiedTime".equals(fieldName)) {
                    deserializedVariableProperties.lastModifiedTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("description".equals(fieldName)) {
                    deserializedVariableProperties.description = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedVariableProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy