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

com.azure.resourcemanager.databricks.models.WorkspacePropertiesEncryption Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for AzureDatabricks Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace / Access Connector resources. Package tag package-2023-05-01.

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

import com.azure.core.annotation.Fluent;
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 java.io.IOException;

/**
 * Encryption properties for databricks workspace.
 */
@Fluent
public final class WorkspacePropertiesEncryption implements JsonSerializable {
    /*
     * Encryption entities definition for the workspace.
     */
    private EncryptionEntitiesDefinition entities;

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

    /**
     * Get the entities property: Encryption entities definition for the workspace.
     * 
     * @return the entities value.
     */
    public EncryptionEntitiesDefinition entities() {
        return this.entities;
    }

    /**
     * Set the entities property: Encryption entities definition for the workspace.
     * 
     * @param entities the entities value to set.
     * @return the WorkspacePropertiesEncryption object itself.
     */
    public WorkspacePropertiesEncryption withEntities(EncryptionEntitiesDefinition entities) {
        this.entities = entities;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (entities() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property entities in model WorkspacePropertiesEncryption"));
        } else {
            entities().validate();
        }
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("entities", this.entities);
        return jsonWriter.writeEndObject();
    }

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

                if ("entities".equals(fieldName)) {
                    deserializedWorkspacePropertiesEncryption.entities = EncryptionEntitiesDefinition.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedWorkspacePropertiesEncryption;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy