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

com.azure.resourcemanager.machinelearning.models.Compute Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Machine Learning Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. These APIs allow end users to operate on Azure Machine Learning Workspace resources. Package tag package-2024-04.

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.machinelearning.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.exception.ManagementError;
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.util.List;

/**
 * Machine Learning compute object.
 */
@Fluent
public class Compute implements JsonSerializable {
    /*
     * The type of compute
     */
    private ComputeType computeType = ComputeType.fromString("Compute");

    /*
     * Location for the underlying compute
     */
    private String computeLocation;

    /*
     * The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed.
     */
    private ProvisioningState provisioningState;

    /*
     * The description of the Machine Learning compute.
     */
    private String description;

    /*
     * The time at which the compute was created.
     */
    private OffsetDateTime createdOn;

    /*
     * The time at which the compute was last modified.
     */
    private OffsetDateTime modifiedOn;

    /*
     * ARM resource id of the underlying compute
     */
    private String resourceId;

    /*
     * Errors during provisioning
     */
    private List provisioningErrors;

    /*
     * Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning
     * service provisioned it if false.
     */
    private Boolean isAttachedCompute;

    /*
     * Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication.
     */
    private Boolean disableLocalAuth;

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

    /**
     * Get the computeType property: The type of compute.
     * 
     * @return the computeType value.
     */
    public ComputeType computeType() {
        return this.computeType;
    }

    /**
     * Get the computeLocation property: Location for the underlying compute.
     * 
     * @return the computeLocation value.
     */
    public String computeLocation() {
        return this.computeLocation;
    }

    /**
     * Set the computeLocation property: Location for the underlying compute.
     * 
     * @param computeLocation the computeLocation value to set.
     * @return the Compute object itself.
     */
    public Compute withComputeLocation(String computeLocation) {
        this.computeLocation = computeLocation;
        return this;
    }

    /**
     * Get the provisioningState property: The provision state of the cluster. Valid values are Unknown, Updating,
     * Provisioning, Succeeded, and Failed.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Set the provisioningState property: The provision state of the cluster. Valid values are Unknown, Updating,
     * Provisioning, Succeeded, and Failed.
     * 
     * @param provisioningState the provisioningState value to set.
     * @return the Compute object itself.
     */
    Compute withProvisioningState(ProvisioningState provisioningState) {
        this.provisioningState = provisioningState;
        return this;
    }

    /**
     * Get the description property: The description of the Machine Learning compute.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: The description of the Machine Learning compute.
     * 
     * @param description the description value to set.
     * @return the Compute object itself.
     */
    public Compute withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the createdOn property: The time at which the compute was created.
     * 
     * @return the createdOn value.
     */
    public OffsetDateTime createdOn() {
        return this.createdOn;
    }

    /**
     * Set the createdOn property: The time at which the compute was created.
     * 
     * @param createdOn the createdOn value to set.
     * @return the Compute object itself.
     */
    Compute withCreatedOn(OffsetDateTime createdOn) {
        this.createdOn = createdOn;
        return this;
    }

    /**
     * Get the modifiedOn property: The time at which the compute was last modified.
     * 
     * @return the modifiedOn value.
     */
    public OffsetDateTime modifiedOn() {
        return this.modifiedOn;
    }

    /**
     * Set the modifiedOn property: The time at which the compute was last modified.
     * 
     * @param modifiedOn the modifiedOn value to set.
     * @return the Compute object itself.
     */
    Compute withModifiedOn(OffsetDateTime modifiedOn) {
        this.modifiedOn = modifiedOn;
        return this;
    }

    /**
     * Get the resourceId property: ARM resource id of the underlying compute.
     * 
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.resourceId;
    }

    /**
     * Set the resourceId property: ARM resource id of the underlying compute.
     * 
     * @param resourceId the resourceId value to set.
     * @return the Compute object itself.
     */
    public Compute withResourceId(String resourceId) {
        this.resourceId = resourceId;
        return this;
    }

    /**
     * Get the provisioningErrors property: Errors during provisioning.
     * 
     * @return the provisioningErrors value.
     */
    public List provisioningErrors() {
        return this.provisioningErrors;
    }

    /**
     * Set the provisioningErrors property: Errors during provisioning.
     * 
     * @param provisioningErrors the provisioningErrors value to set.
     * @return the Compute object itself.
     */
    Compute withProvisioningErrors(List provisioningErrors) {
        this.provisioningErrors = provisioningErrors;
        return this;
    }

    /**
     * Get the isAttachedCompute property: Indicating whether the compute was provisioned by user and brought from
     * outside if true, or machine learning service provisioned it if false.
     * 
     * @return the isAttachedCompute value.
     */
    public Boolean isAttachedCompute() {
        return this.isAttachedCompute;
    }

    /**
     * Set the isAttachedCompute property: Indicating whether the compute was provisioned by user and brought from
     * outside if true, or machine learning service provisioned it if false.
     * 
     * @param isAttachedCompute the isAttachedCompute value to set.
     * @return the Compute object itself.
     */
    Compute withIsAttachedCompute(Boolean isAttachedCompute) {
        this.isAttachedCompute = isAttachedCompute;
        return this;
    }

    /**
     * Get the disableLocalAuth property: Opt-out of local authentication and ensure customers can use only MSI and AAD
     * exclusively for authentication.
     * 
     * @return the disableLocalAuth value.
     */
    public Boolean disableLocalAuth() {
        return this.disableLocalAuth;
    }

    /**
     * Set the disableLocalAuth property: Opt-out of local authentication and ensure customers can use only MSI and AAD
     * exclusively for authentication.
     * 
     * @param disableLocalAuth the disableLocalAuth value to set.
     * @return the Compute object itself.
     */
    public Compute withDisableLocalAuth(Boolean disableLocalAuth) {
        this.disableLocalAuth = disableLocalAuth;
        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("computeType", this.computeType == null ? null : this.computeType.toString());
        jsonWriter.writeStringField("computeLocation", this.computeLocation);
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeStringField("resourceId", this.resourceId);
        jsonWriter.writeBooleanField("disableLocalAuth", this.disableLocalAuth);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of Compute from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of Compute 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 Compute.
     */
    public static Compute fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            String discriminatorValue = null;
            try (JsonReader readerToUse = reader.bufferObject()) {
                readerToUse.nextToken(); // Prepare for reading
                while (readerToUse.nextToken() != JsonToken.END_OBJECT) {
                    String fieldName = readerToUse.getFieldName();
                    readerToUse.nextToken();
                    if ("computeType".equals(fieldName)) {
                        discriminatorValue = readerToUse.getString();
                        break;
                    } else {
                        readerToUse.skipChildren();
                    }
                }
                // Use the discriminator value to determine which subtype should be deserialized.
                if ("AKS".equals(discriminatorValue)) {
                    return Aks.fromJson(readerToUse.reset());
                } else if ("Kubernetes".equals(discriminatorValue)) {
                    return Kubernetes.fromJson(readerToUse.reset());
                } else if ("AmlCompute".equals(discriminatorValue)) {
                    return AmlCompute.fromJson(readerToUse.reset());
                } else if ("ComputeInstance".equals(discriminatorValue)) {
                    return ComputeInstance.fromJson(readerToUse.reset());
                } else if ("VirtualMachine".equals(discriminatorValue)) {
                    return VirtualMachine.fromJson(readerToUse.reset());
                } else if ("HDInsight".equals(discriminatorValue)) {
                    return HDInsight.fromJson(readerToUse.reset());
                } else if ("DataFactory".equals(discriminatorValue)) {
                    return DataFactory.fromJson(readerToUse.reset());
                } else if ("Databricks".equals(discriminatorValue)) {
                    return Databricks.fromJson(readerToUse.reset());
                } else if ("DataLakeAnalytics".equals(discriminatorValue)) {
                    return DataLakeAnalytics.fromJson(readerToUse.reset());
                } else if ("SynapseSpark".equals(discriminatorValue)) {
                    return SynapseSpark.fromJson(readerToUse.reset());
                } else {
                    return fromJsonKnownDiscriminator(readerToUse.reset());
                }
            }
        });
    }

    static Compute fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            Compute deserializedCompute = new Compute();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("computeType".equals(fieldName)) {
                    deserializedCompute.computeType = ComputeType.fromString(reader.getString());
                } else if ("computeLocation".equals(fieldName)) {
                    deserializedCompute.computeLocation = reader.getString();
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedCompute.provisioningState = ProvisioningState.fromString(reader.getString());
                } else if ("description".equals(fieldName)) {
                    deserializedCompute.description = reader.getString();
                } else if ("createdOn".equals(fieldName)) {
                    deserializedCompute.createdOn = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("modifiedOn".equals(fieldName)) {
                    deserializedCompute.modifiedOn = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("resourceId".equals(fieldName)) {
                    deserializedCompute.resourceId = reader.getString();
                } else if ("provisioningErrors".equals(fieldName)) {
                    List provisioningErrors
                        = reader.readArray(reader1 -> ManagementError.fromJson(reader1));
                    deserializedCompute.provisioningErrors = provisioningErrors;
                } else if ("isAttachedCompute".equals(fieldName)) {
                    deserializedCompute.isAttachedCompute = reader.getNullable(JsonReader::getBoolean);
                } else if ("disableLocalAuth".equals(fieldName)) {
                    deserializedCompute.disableLocalAuth = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCompute;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy