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

com.azure.resourcemanager.databricks.fluent.models.WorkspaceProperties 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.databricks.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.databricks.models.CreatedBy;
import com.azure.resourcemanager.databricks.models.ManagedIdentityConfiguration;
import com.azure.resourcemanager.databricks.models.ProvisioningState;
import com.azure.resourcemanager.databricks.models.PublicNetworkAccess;
import com.azure.resourcemanager.databricks.models.RequiredNsgRules;
import com.azure.resourcemanager.databricks.models.WorkspaceCustomParameters;
import com.azure.resourcemanager.databricks.models.WorkspacePropertiesEncryption;
import com.azure.resourcemanager.databricks.models.WorkspaceProviderAuthorization;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * The workspace properties.
 */
@Fluent
public final class WorkspaceProperties implements JsonSerializable {
    /*
     * The managed resource group Id.
     */
    private String managedResourceGroupId;

    /*
     * The workspace's custom parameters.
     */
    private WorkspaceCustomParameters parameters;

    /*
     * The workspace provisioning state.
     */
    private ProvisioningState provisioningState;

    /*
     * The blob URI where the UI definition file is located.
     */
    private String uiDefinitionUri;

    /*
     * The workspace provider authorizations.
     */
    private List authorizations;

    /*
     * Indicates the Object ID, PUID and Application ID of entity that created the workspace.
     */
    private CreatedBy createdBy;

    /*
     * Indicates the Object ID, PUID and Application ID of entity that last updated the workspace.
     */
    private CreatedBy updatedBy;

    /*
     * Specifies the date and time when the workspace is created.
     */
    private OffsetDateTime createdDateTime;

    /*
     * The unique identifier of the databricks workspace in databricks control plane.
     */
    private String workspaceId;

    /*
     * The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net'
     */
    private String workspaceUrl;

    /*
     * The details of Managed Identity of Storage Account
     */
    private ManagedIdentityConfiguration storageAccountIdentity;

    /*
     * The details of Managed Identity of Disk Encryption Set used for Managed Disk Encryption
     */
    private ManagedIdentityConfiguration managedDiskIdentity;

    /*
     * The resource Id of the managed disk encryption set.
     */
    private String diskEncryptionSetId;

    /*
     * Encryption properties for databricks workspace
     */
    private WorkspacePropertiesEncryption encryption;

    /*
     * Private endpoint connections created on the workspace
     */
    private List privateEndpointConnections;

    /*
     * The network access type for accessing workspace. Set value to disabled to access workspace only via private link.
     */
    private PublicNetworkAccess publicNetworkAccess;

    /*
     * Gets or sets a value indicating whether data plane (clusters) to control plane communication happen over private
     * endpoint. Supported values are 'AllRules' and 'NoAzureDatabricksRules'. 'NoAzureServiceRules' value is for
     * internal use only.
     */
    private RequiredNsgRules requiredNsgRules;

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

    /**
     * Get the managedResourceGroupId property: The managed resource group Id.
     * 
     * @return the managedResourceGroupId value.
     */
    public String managedResourceGroupId() {
        return this.managedResourceGroupId;
    }

    /**
     * Set the managedResourceGroupId property: The managed resource group Id.
     * 
     * @param managedResourceGroupId the managedResourceGroupId value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withManagedResourceGroupId(String managedResourceGroupId) {
        this.managedResourceGroupId = managedResourceGroupId;
        return this;
    }

    /**
     * Get the parameters property: The workspace's custom parameters.
     * 
     * @return the parameters value.
     */
    public WorkspaceCustomParameters parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: The workspace's custom parameters.
     * 
     * @param parameters the parameters value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withParameters(WorkspaceCustomParameters parameters) {
        this.parameters = parameters;
        return this;
    }

    /**
     * Get the provisioningState property: The workspace provisioning state.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the uiDefinitionUri property: The blob URI where the UI definition file is located.
     * 
     * @return the uiDefinitionUri value.
     */
    public String uiDefinitionUri() {
        return this.uiDefinitionUri;
    }

    /**
     * Set the uiDefinitionUri property: The blob URI where the UI definition file is located.
     * 
     * @param uiDefinitionUri the uiDefinitionUri value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withUiDefinitionUri(String uiDefinitionUri) {
        this.uiDefinitionUri = uiDefinitionUri;
        return this;
    }

    /**
     * Get the authorizations property: The workspace provider authorizations.
     * 
     * @return the authorizations value.
     */
    public List authorizations() {
        return this.authorizations;
    }

    /**
     * Set the authorizations property: The workspace provider authorizations.
     * 
     * @param authorizations the authorizations value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withAuthorizations(List authorizations) {
        this.authorizations = authorizations;
        return this;
    }

    /**
     * Get the createdBy property: Indicates the Object ID, PUID and Application ID of entity that created the
     * workspace.
     * 
     * @return the createdBy value.
     */
    public CreatedBy createdBy() {
        return this.createdBy;
    }

    /**
     * Set the createdBy property: Indicates the Object ID, PUID and Application ID of entity that created the
     * workspace.
     * 
     * @param createdBy the createdBy value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withCreatedBy(CreatedBy createdBy) {
        this.createdBy = createdBy;
        return this;
    }

    /**
     * Get the updatedBy property: Indicates the Object ID, PUID and Application ID of entity that last updated the
     * workspace.
     * 
     * @return the updatedBy value.
     */
    public CreatedBy updatedBy() {
        return this.updatedBy;
    }

    /**
     * Set the updatedBy property: Indicates the Object ID, PUID and Application ID of entity that last updated the
     * workspace.
     * 
     * @param updatedBy the updatedBy value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withUpdatedBy(CreatedBy updatedBy) {
        this.updatedBy = updatedBy;
        return this;
    }

    /**
     * Get the createdDateTime property: Specifies the date and time when the workspace is created.
     * 
     * @return the createdDateTime value.
     */
    public OffsetDateTime createdDateTime() {
        return this.createdDateTime;
    }

    /**
     * Get the workspaceId property: The unique identifier of the databricks workspace in databricks control plane.
     * 
     * @return the workspaceId value.
     */
    public String workspaceId() {
        return this.workspaceId;
    }

    /**
     * Get the workspaceUrl property: The workspace URL which is of the format
     * 'adb-{workspaceId}.{random}.azuredatabricks.net'.
     * 
     * @return the workspaceUrl value.
     */
    public String workspaceUrl() {
        return this.workspaceUrl;
    }

    /**
     * Get the storageAccountIdentity property: The details of Managed Identity of Storage Account.
     * 
     * @return the storageAccountIdentity value.
     */
    public ManagedIdentityConfiguration storageAccountIdentity() {
        return this.storageAccountIdentity;
    }

    /**
     * Set the storageAccountIdentity property: The details of Managed Identity of Storage Account.
     * 
     * @param storageAccountIdentity the storageAccountIdentity value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withStorageAccountIdentity(ManagedIdentityConfiguration storageAccountIdentity) {
        this.storageAccountIdentity = storageAccountIdentity;
        return this;
    }

    /**
     * Get the managedDiskIdentity property: The details of Managed Identity of Disk Encryption Set used for Managed
     * Disk Encryption.
     * 
     * @return the managedDiskIdentity value.
     */
    public ManagedIdentityConfiguration managedDiskIdentity() {
        return this.managedDiskIdentity;
    }

    /**
     * Set the managedDiskIdentity property: The details of Managed Identity of Disk Encryption Set used for Managed
     * Disk Encryption.
     * 
     * @param managedDiskIdentity the managedDiskIdentity value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withManagedDiskIdentity(ManagedIdentityConfiguration managedDiskIdentity) {
        this.managedDiskIdentity = managedDiskIdentity;
        return this;
    }

    /**
     * Get the diskEncryptionSetId property: The resource Id of the managed disk encryption set.
     * 
     * @return the diskEncryptionSetId value.
     */
    public String diskEncryptionSetId() {
        return this.diskEncryptionSetId;
    }

    /**
     * Get the encryption property: Encryption properties for databricks workspace.
     * 
     * @return the encryption value.
     */
    public WorkspacePropertiesEncryption encryption() {
        return this.encryption;
    }

    /**
     * Set the encryption property: Encryption properties for databricks workspace.
     * 
     * @param encryption the encryption value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withEncryption(WorkspacePropertiesEncryption encryption) {
        this.encryption = encryption;
        return this;
    }

    /**
     * Get the privateEndpointConnections property: Private endpoint connections created on the workspace.
     * 
     * @return the privateEndpointConnections value.
     */
    public List privateEndpointConnections() {
        return this.privateEndpointConnections;
    }

    /**
     * Get the publicNetworkAccess property: The network access type for accessing workspace. Set value to disabled to
     * access workspace only via private link.
     * 
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.publicNetworkAccess;
    }

    /**
     * Set the publicNetworkAccess property: The network access type for accessing workspace. Set value to disabled to
     * access workspace only via private link.
     * 
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        this.publicNetworkAccess = publicNetworkAccess;
        return this;
    }

    /**
     * Get the requiredNsgRules property: Gets or sets a value indicating whether data plane (clusters) to control plane
     * communication happen over private endpoint. Supported values are 'AllRules' and 'NoAzureDatabricksRules'.
     * 'NoAzureServiceRules' value is for internal use only.
     * 
     * @return the requiredNsgRules value.
     */
    public RequiredNsgRules requiredNsgRules() {
        return this.requiredNsgRules;
    }

    /**
     * Set the requiredNsgRules property: Gets or sets a value indicating whether data plane (clusters) to control plane
     * communication happen over private endpoint. Supported values are 'AllRules' and 'NoAzureDatabricksRules'.
     * 'NoAzureServiceRules' value is for internal use only.
     * 
     * @param requiredNsgRules the requiredNsgRules value to set.
     * @return the WorkspaceProperties object itself.
     */
    public WorkspaceProperties withRequiredNsgRules(RequiredNsgRules requiredNsgRules) {
        this.requiredNsgRules = requiredNsgRules;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (managedResourceGroupId() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property managedResourceGroupId in model WorkspaceProperties"));
        }
        if (parameters() != null) {
            parameters().validate();
        }
        if (authorizations() != null) {
            authorizations().forEach(e -> e.validate());
        }
        if (createdBy() != null) {
            createdBy().validate();
        }
        if (updatedBy() != null) {
            updatedBy().validate();
        }
        if (storageAccountIdentity() != null) {
            storageAccountIdentity().validate();
        }
        if (managedDiskIdentity() != null) {
            managedDiskIdentity().validate();
        }
        if (encryption() != null) {
            encryption().validate();
        }
        if (privateEndpointConnections() != null) {
            privateEndpointConnections().forEach(e -> e.validate());
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(WorkspaceProperties.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("managedResourceGroupId", this.managedResourceGroupId);
        jsonWriter.writeJsonField("parameters", this.parameters);
        jsonWriter.writeStringField("uiDefinitionUri", this.uiDefinitionUri);
        jsonWriter.writeArrayField("authorizations", this.authorizations,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeJsonField("createdBy", this.createdBy);
        jsonWriter.writeJsonField("updatedBy", this.updatedBy);
        jsonWriter.writeJsonField("storageAccountIdentity", this.storageAccountIdentity);
        jsonWriter.writeJsonField("managedDiskIdentity", this.managedDiskIdentity);
        jsonWriter.writeJsonField("encryption", this.encryption);
        jsonWriter.writeStringField("publicNetworkAccess",
            this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString());
        jsonWriter.writeStringField("requiredNsgRules",
            this.requiredNsgRules == null ? null : this.requiredNsgRules.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("managedResourceGroupId".equals(fieldName)) {
                    deserializedWorkspaceProperties.managedResourceGroupId = reader.getString();
                } else if ("parameters".equals(fieldName)) {
                    deserializedWorkspaceProperties.parameters = WorkspaceCustomParameters.fromJson(reader);
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedWorkspaceProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("uiDefinitionUri".equals(fieldName)) {
                    deserializedWorkspaceProperties.uiDefinitionUri = reader.getString();
                } else if ("authorizations".equals(fieldName)) {
                    List authorizations
                        = reader.readArray(reader1 -> WorkspaceProviderAuthorization.fromJson(reader1));
                    deserializedWorkspaceProperties.authorizations = authorizations;
                } else if ("createdBy".equals(fieldName)) {
                    deserializedWorkspaceProperties.createdBy = CreatedBy.fromJson(reader);
                } else if ("updatedBy".equals(fieldName)) {
                    deserializedWorkspaceProperties.updatedBy = CreatedBy.fromJson(reader);
                } else if ("createdDateTime".equals(fieldName)) {
                    deserializedWorkspaceProperties.createdDateTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("workspaceId".equals(fieldName)) {
                    deserializedWorkspaceProperties.workspaceId = reader.getString();
                } else if ("workspaceUrl".equals(fieldName)) {
                    deserializedWorkspaceProperties.workspaceUrl = reader.getString();
                } else if ("storageAccountIdentity".equals(fieldName)) {
                    deserializedWorkspaceProperties.storageAccountIdentity
                        = ManagedIdentityConfiguration.fromJson(reader);
                } else if ("managedDiskIdentity".equals(fieldName)) {
                    deserializedWorkspaceProperties.managedDiskIdentity = ManagedIdentityConfiguration.fromJson(reader);
                } else if ("diskEncryptionSetId".equals(fieldName)) {
                    deserializedWorkspaceProperties.diskEncryptionSetId = reader.getString();
                } else if ("encryption".equals(fieldName)) {
                    deserializedWorkspaceProperties.encryption = WorkspacePropertiesEncryption.fromJson(reader);
                } else if ("privateEndpointConnections".equals(fieldName)) {
                    List privateEndpointConnections
                        = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1));
                    deserializedWorkspaceProperties.privateEndpointConnections = privateEndpointConnections;
                } else if ("publicNetworkAccess".equals(fieldName)) {
                    deserializedWorkspaceProperties.publicNetworkAccess
                        = PublicNetworkAccess.fromString(reader.getString());
                } else if ("requiredNsgRules".equals(fieldName)) {
                    deserializedWorkspaceProperties.requiredNsgRules = RequiredNsgRules.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedWorkspaceProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy