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

com.azure.resourcemanager.automation.fluent.models.DscNodeConfigurationProperties 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 com.azure.resourcemanager.automation.models.DscConfigurationAssociationProperty;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Properties for the DscNodeConfiguration.
 */
@Fluent
public final class DscNodeConfigurationProperties implements JsonSerializable {
    /*
     * Gets or sets the last modified time.
     */
    private OffsetDateTime lastModifiedTime;

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

    /*
     * Gets or sets the configuration of the node.
     */
    private DscConfigurationAssociationProperty configuration;

    /*
     * Source of node configuration.
     */
    private String source;

    /*
     * Number of nodes with this node configuration assigned
     */
    private Long nodeCount;

    /*
     * If a new build version of NodeConfiguration is required.
     */
    private Boolean incrementNodeConfigurationBuild;

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

    /**
     * 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 DscNodeConfigurationProperties object itself.
     */
    public DscNodeConfigurationProperties withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        this.lastModifiedTime = lastModifiedTime;
        return this;
    }

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

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

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

    /**
     * Set the configuration property: Gets or sets the configuration of the node.
     * 
     * @param configuration the configuration value to set.
     * @return the DscNodeConfigurationProperties object itself.
     */
    public DscNodeConfigurationProperties withConfiguration(DscConfigurationAssociationProperty configuration) {
        this.configuration = configuration;
        return this;
    }

    /**
     * Get the source property: Source of node configuration.
     * 
     * @return the source value.
     */
    public String source() {
        return this.source;
    }

    /**
     * Set the source property: Source of node configuration.
     * 
     * @param source the source value to set.
     * @return the DscNodeConfigurationProperties object itself.
     */
    public DscNodeConfigurationProperties withSource(String source) {
        this.source = source;
        return this;
    }

    /**
     * Get the nodeCount property: Number of nodes with this node configuration assigned.
     * 
     * @return the nodeCount value.
     */
    public Long nodeCount() {
        return this.nodeCount;
    }

    /**
     * Set the nodeCount property: Number of nodes with this node configuration assigned.
     * 
     * @param nodeCount the nodeCount value to set.
     * @return the DscNodeConfigurationProperties object itself.
     */
    public DscNodeConfigurationProperties withNodeCount(Long nodeCount) {
        this.nodeCount = nodeCount;
        return this;
    }

    /**
     * Get the incrementNodeConfigurationBuild property: If a new build version of NodeConfiguration is required.
     * 
     * @return the incrementNodeConfigurationBuild value.
     */
    public Boolean incrementNodeConfigurationBuild() {
        return this.incrementNodeConfigurationBuild;
    }

    /**
     * Set the incrementNodeConfigurationBuild property: If a new build version of NodeConfiguration is required.
     * 
     * @param incrementNodeConfigurationBuild the incrementNodeConfigurationBuild value to set.
     * @return the DscNodeConfigurationProperties object itself.
     */
    public DscNodeConfigurationProperties withIncrementNodeConfigurationBuild(Boolean incrementNodeConfigurationBuild) {
        this.incrementNodeConfigurationBuild = incrementNodeConfigurationBuild;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("lastModifiedTime",
            this.lastModifiedTime == null
                ? null
                : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedTime));
        jsonWriter.writeStringField("creationTime",
            this.creationTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.creationTime));
        jsonWriter.writeJsonField("configuration", this.configuration);
        jsonWriter.writeStringField("source", this.source);
        jsonWriter.writeNumberField("nodeCount", this.nodeCount);
        jsonWriter.writeBooleanField("incrementNodeConfigurationBuild", this.incrementNodeConfigurationBuild);
        return jsonWriter.writeEndObject();
    }

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

                if ("lastModifiedTime".equals(fieldName)) {
                    deserializedDscNodeConfigurationProperties.lastModifiedTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("creationTime".equals(fieldName)) {
                    deserializedDscNodeConfigurationProperties.creationTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("configuration".equals(fieldName)) {
                    deserializedDscNodeConfigurationProperties.configuration
                        = DscConfigurationAssociationProperty.fromJson(reader);
                } else if ("source".equals(fieldName)) {
                    deserializedDscNodeConfigurationProperties.source = reader.getString();
                } else if ("nodeCount".equals(fieldName)) {
                    deserializedDscNodeConfigurationProperties.nodeCount = reader.getNullable(JsonReader::getLong);
                } else if ("incrementNodeConfigurationBuild".equals(fieldName)) {
                    deserializedDscNodeConfigurationProperties.incrementNodeConfigurationBuild
                        = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDscNodeConfigurationProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy