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

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

/**
 * The object that contains details of encryption used on the workspace.
 */
@Fluent
public final class EncryptionV2 implements JsonSerializable {
    /*
     * The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Keyvault
     */
    private EncryptionKeySource keySource;

    /*
     * Key Vault input properties for encryption.
     */
    private EncryptionV2KeyVaultProperties keyVaultProperties;

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

    /**
     * Get the keySource property: The encryption keySource (provider). Possible values (case-insensitive):
     * Microsoft.Keyvault.
     * 
     * @return the keySource value.
     */
    public EncryptionKeySource keySource() {
        return this.keySource;
    }

    /**
     * Set the keySource property: The encryption keySource (provider). Possible values (case-insensitive):
     * Microsoft.Keyvault.
     * 
     * @param keySource the keySource value to set.
     * @return the EncryptionV2 object itself.
     */
    public EncryptionV2 withKeySource(EncryptionKeySource keySource) {
        this.keySource = keySource;
        return this;
    }

    /**
     * Get the keyVaultProperties property: Key Vault input properties for encryption.
     * 
     * @return the keyVaultProperties value.
     */
    public EncryptionV2KeyVaultProperties keyVaultProperties() {
        return this.keyVaultProperties;
    }

    /**
     * Set the keyVaultProperties property: Key Vault input properties for encryption.
     * 
     * @param keyVaultProperties the keyVaultProperties value to set.
     * @return the EncryptionV2 object itself.
     */
    public EncryptionV2 withKeyVaultProperties(EncryptionV2KeyVaultProperties keyVaultProperties) {
        this.keyVaultProperties = keyVaultProperties;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("keySource", this.keySource == null ? null : this.keySource.toString());
        jsonWriter.writeJsonField("keyVaultProperties", this.keyVaultProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("keySource".equals(fieldName)) {
                    deserializedEncryptionV2.keySource = EncryptionKeySource.fromString(reader.getString());
                } else if ("keyVaultProperties".equals(fieldName)) {
                    deserializedEncryptionV2.keyVaultProperties = EncryptionV2KeyVaultProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEncryptionV2;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy