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

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

// 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.management.ProxyResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
 * Definition of the variable.
 */
@Fluent
public final class VariableInner extends ProxyResource {
    /*
     * Gets or sets the properties of the variable.
     */
    private VariableProperties innerProperties;

    /*
     * 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 VariableInner class.
     */
    public VariableInner() {
    }

    /**
     * Get the innerProperties property: Gets or sets the properties of the variable.
     * 
     * @return the innerProperties value.
     */
    private VariableProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * 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 value property: Gets or sets the value of the variable.
     * 
     * @return the value value.
     */
    public String value() {
        return this.innerProperties() == null ? null : this.innerProperties().value();
    }

    /**
     * Set the value property: Gets or sets the value of the variable.
     * 
     * @param value the value value to set.
     * @return the VariableInner object itself.
     */
    public VariableInner withValue(String value) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VariableProperties();
        }
        this.innerProperties().withValue(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.innerProperties() == null ? null : this.innerProperties().isEncrypted();
    }

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

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

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

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

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

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

    /**
     * Set the description property: Gets or sets the description.
     * 
     * @param description the description value to set.
     * @return the VariableInner object itself.
     */
    public VariableInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VariableProperties();
        }
        this.innerProperties().withDescription(description);
        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 VariableInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of VariableInner 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 VariableInner.
     */
    public static VariableInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            VariableInner deserializedVariableInner = new VariableInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedVariableInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedVariableInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedVariableInner.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedVariableInner.innerProperties = VariableProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedVariableInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy