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

com.azure.resourcemanager.storage.models.StorageTaskAssignmentUpdateProperties Maven / Gradle / Ivy

There is a newer version: 2.44.0
Show 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.storage.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;

/**
 * Properties of the storage task update assignment.
 */
@Fluent
public final class StorageTaskAssignmentUpdateProperties
    implements JsonSerializable {
    /*
     * Id of the corresponding storage task
     */
    private String taskId;

    /*
     * Whether the storage task assignment is enabled or not
     */
    private Boolean enabled;

    /*
     * Text that describes the purpose of the storage task assignment
     */
    private String description;

    /*
     * The storage task assignment execution context
     */
    private StorageTaskAssignmentUpdateExecutionContext executionContext;

    /*
     * The storage task assignment report
     */
    private StorageTaskAssignmentUpdateReport report;

    /*
     * Represents the provisioning state of the storage task assignment.
     */
    private ProvisioningState provisioningState;

    /*
     * Run status of storage task assignment
     */
    private StorageTaskReportProperties runStatus;

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

    /**
     * Get the taskId property: Id of the corresponding storage task.
     * 
     * @return the taskId value.
     */
    public String taskId() {
        return this.taskId;
    }

    /**
     * Get the enabled property: Whether the storage task assignment is enabled or not.
     * 
     * @return the enabled value.
     */
    public Boolean enabled() {
        return this.enabled;
    }

    /**
     * Set the enabled property: Whether the storage task assignment is enabled or not.
     * 
     * @param enabled the enabled value to set.
     * @return the StorageTaskAssignmentUpdateProperties object itself.
     */
    public StorageTaskAssignmentUpdateProperties withEnabled(Boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    /**
     * Get the description property: Text that describes the purpose of the storage task assignment.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Text that describes the purpose of the storage task assignment.
     * 
     * @param description the description value to set.
     * @return the StorageTaskAssignmentUpdateProperties object itself.
     */
    public StorageTaskAssignmentUpdateProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the executionContext property: The storage task assignment execution context.
     * 
     * @return the executionContext value.
     */
    public StorageTaskAssignmentUpdateExecutionContext executionContext() {
        return this.executionContext;
    }

    /**
     * Set the executionContext property: The storage task assignment execution context.
     * 
     * @param executionContext the executionContext value to set.
     * @return the StorageTaskAssignmentUpdateProperties object itself.
     */
    public StorageTaskAssignmentUpdateProperties
        withExecutionContext(StorageTaskAssignmentUpdateExecutionContext executionContext) {
        this.executionContext = executionContext;
        return this;
    }

    /**
     * Get the report property: The storage task assignment report.
     * 
     * @return the report value.
     */
    public StorageTaskAssignmentUpdateReport report() {
        return this.report;
    }

    /**
     * Set the report property: The storage task assignment report.
     * 
     * @param report the report value to set.
     * @return the StorageTaskAssignmentUpdateProperties object itself.
     */
    public StorageTaskAssignmentUpdateProperties withReport(StorageTaskAssignmentUpdateReport report) {
        this.report = report;
        return this;
    }

    /**
     * Get the provisioningState property: Represents the provisioning state of the storage task assignment.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the runStatus property: Run status of storage task assignment.
     * 
     * @return the runStatus value.
     */
    public StorageTaskReportProperties runStatus() {
        return this.runStatus;
    }

    /**
     * Set the runStatus property: Run status of storage task assignment.
     * 
     * @param runStatus the runStatus value to set.
     * @return the StorageTaskAssignmentUpdateProperties object itself.
     */
    public StorageTaskAssignmentUpdateProperties withRunStatus(StorageTaskReportProperties runStatus) {
        this.runStatus = runStatus;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeBooleanField("enabled", this.enabled);
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeJsonField("executionContext", this.executionContext);
        jsonWriter.writeJsonField("report", this.report);
        jsonWriter.writeJsonField("runStatus", this.runStatus);
        return jsonWriter.writeEndObject();
    }

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

                if ("taskId".equals(fieldName)) {
                    deserializedStorageTaskAssignmentUpdateProperties.taskId = reader.getString();
                } else if ("enabled".equals(fieldName)) {
                    deserializedStorageTaskAssignmentUpdateProperties.enabled
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("description".equals(fieldName)) {
                    deserializedStorageTaskAssignmentUpdateProperties.description = reader.getString();
                } else if ("executionContext".equals(fieldName)) {
                    deserializedStorageTaskAssignmentUpdateProperties.executionContext
                        = StorageTaskAssignmentUpdateExecutionContext.fromJson(reader);
                } else if ("report".equals(fieldName)) {
                    deserializedStorageTaskAssignmentUpdateProperties.report
                        = StorageTaskAssignmentUpdateReport.fromJson(reader);
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedStorageTaskAssignmentUpdateProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("runStatus".equals(fieldName)) {
                    deserializedStorageTaskAssignmentUpdateProperties.runStatus
                        = StorageTaskReportProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedStorageTaskAssignmentUpdateProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy