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

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

/**
 * Definition of the module property type.
 */
@Fluent
public final class ModuleProperties implements JsonSerializable {
    /*
     * Gets or sets the isGlobal flag of the module.
     */
    private Boolean isGlobal;

    /*
     * Gets or sets the version of the module.
     */
    private String version;

    /*
     * Gets or sets the size in bytes of the module.
     */
    private Long sizeInBytes;

    /*
     * Gets or sets the activity count of the module.
     */
    private Integer activityCount;

    /*
     * Gets or sets the provisioning state of the module.
     */
    private ModuleProvisioningState provisioningState;

    /*
     * Gets or sets the contentLink of the module.
     */
    private ContentLink contentLink;

    /*
     * Gets or sets the error info of the module.
     */
    private ModuleErrorInfo error;

    /*
     * 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;

    /*
     * Gets or sets type of module, if its composite or not.
     */
    private Boolean isComposite;

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

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

    /**
     * Set the isGlobal property: Gets or sets the isGlobal flag of the module.
     * 
     * @param isGlobal the isGlobal value to set.
     * @return the ModuleProperties object itself.
     */
    public ModuleProperties withIsGlobal(Boolean isGlobal) {
        this.isGlobal = isGlobal;
        return this;
    }

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

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

    /**
     * Get the sizeInBytes property: Gets or sets the size in bytes of the module.
     * 
     * @return the sizeInBytes value.
     */
    public Long sizeInBytes() {
        return this.sizeInBytes;
    }

    /**
     * Set the sizeInBytes property: Gets or sets the size in bytes of the module.
     * 
     * @param sizeInBytes the sizeInBytes value to set.
     * @return the ModuleProperties object itself.
     */
    public ModuleProperties withSizeInBytes(Long sizeInBytes) {
        this.sizeInBytes = sizeInBytes;
        return this;
    }

    /**
     * Get the activityCount property: Gets or sets the activity count of the module.
     * 
     * @return the activityCount value.
     */
    public Integer activityCount() {
        return this.activityCount;
    }

    /**
     * Set the activityCount property: Gets or sets the activity count of the module.
     * 
     * @param activityCount the activityCount value to set.
     * @return the ModuleProperties object itself.
     */
    public ModuleProperties withActivityCount(Integer activityCount) {
        this.activityCount = activityCount;
        return this;
    }

    /**
     * Get the provisioningState property: Gets or sets the provisioning state of the module.
     * 
     * @return the provisioningState value.
     */
    public ModuleProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Set the provisioningState property: Gets or sets the provisioning state of the module.
     * 
     * @param provisioningState the provisioningState value to set.
     * @return the ModuleProperties object itself.
     */
    public ModuleProperties withProvisioningState(ModuleProvisioningState provisioningState) {
        this.provisioningState = provisioningState;
        return this;
    }

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

    /**
     * Set the contentLink property: Gets or sets the contentLink of the module.
     * 
     * @param contentLink the contentLink value to set.
     * @return the ModuleProperties object itself.
     */
    public ModuleProperties withContentLink(ContentLink contentLink) {
        this.contentLink = contentLink;
        return this;
    }

    /**
     * Get the error property: Gets or sets the error info of the module.
     * 
     * @return the error value.
     */
    public ModuleErrorInfo error() {
        return this.error;
    }

    /**
     * Set the error property: Gets or sets the error info of the module.
     * 
     * @param error the error value to set.
     * @return the ModuleProperties object itself.
     */
    public ModuleProperties withError(ModuleErrorInfo error) {
        this.error = error;
        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 ModuleProperties object itself.
     */
    public ModuleProperties 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 ModuleProperties object itself.
     */
    public ModuleProperties 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 ModuleProperties object itself.
     */
    public ModuleProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the isComposite property: Gets or sets type of module, if its composite or not.
     * 
     * @return the isComposite value.
     */
    public Boolean isComposite() {
        return this.isComposite;
    }

    /**
     * Set the isComposite property: Gets or sets type of module, if its composite or not.
     * 
     * @param isComposite the isComposite value to set.
     * @return the ModuleProperties object itself.
     */
    public ModuleProperties withIsComposite(Boolean isComposite) {
        this.isComposite = isComposite;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeBooleanField("isGlobal", this.isGlobal);
        jsonWriter.writeStringField("version", this.version);
        jsonWriter.writeNumberField("sizeInBytes", this.sizeInBytes);
        jsonWriter.writeNumberField("activityCount", this.activityCount);
        jsonWriter.writeStringField("provisioningState",
            this.provisioningState == null ? null : this.provisioningState.toString());
        jsonWriter.writeJsonField("contentLink", this.contentLink);
        jsonWriter.writeJsonField("error", this.error);
        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);
        jsonWriter.writeBooleanField("isComposite", this.isComposite);
        return jsonWriter.writeEndObject();
    }

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

                if ("isGlobal".equals(fieldName)) {
                    deserializedModuleProperties.isGlobal = reader.getNullable(JsonReader::getBoolean);
                } else if ("version".equals(fieldName)) {
                    deserializedModuleProperties.version = reader.getString();
                } else if ("sizeInBytes".equals(fieldName)) {
                    deserializedModuleProperties.sizeInBytes = reader.getNullable(JsonReader::getLong);
                } else if ("activityCount".equals(fieldName)) {
                    deserializedModuleProperties.activityCount = reader.getNullable(JsonReader::getInt);
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedModuleProperties.provisioningState
                        = ModuleProvisioningState.fromString(reader.getString());
                } else if ("contentLink".equals(fieldName)) {
                    deserializedModuleProperties.contentLink = ContentLink.fromJson(reader);
                } else if ("error".equals(fieldName)) {
                    deserializedModuleProperties.error = ModuleErrorInfo.fromJson(reader);
                } else if ("creationTime".equals(fieldName)) {
                    deserializedModuleProperties.creationTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("lastModifiedTime".equals(fieldName)) {
                    deserializedModuleProperties.lastModifiedTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("description".equals(fieldName)) {
                    deserializedModuleProperties.description = reader.getString();
                } else if ("isComposite".equals(fieldName)) {
                    deserializedModuleProperties.isComposite = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedModuleProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy