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

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

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

    /*
     * The name of KeyVault key.
     */
    private String keyName;

    /*
     * The version of KeyVault key.
     */
    private String keyVersion;

    /*
     * The Uri of KeyVault.
     */
    private String keyVaultUri;

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

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

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

    /**
     * Get the keyName property: The name of KeyVault key.
     * 
     * @return the keyName value.
     */
    public String keyName() {
        return this.keyName;
    }

    /**
     * Set the keyName property: The name of KeyVault key.
     * 
     * @param keyName the keyName value to set.
     * @return the Encryption object itself.
     */
    public Encryption withKeyName(String keyName) {
        this.keyName = keyName;
        return this;
    }

    /**
     * Get the keyVersion property: The version of KeyVault key.
     * 
     * @return the keyVersion value.
     */
    public String keyVersion() {
        return this.keyVersion;
    }

    /**
     * Set the keyVersion property: The version of KeyVault key.
     * 
     * @param keyVersion the keyVersion value to set.
     * @return the Encryption object itself.
     */
    public Encryption withKeyVersion(String keyVersion) {
        this.keyVersion = keyVersion;
        return this;
    }

    /**
     * Get the keyVaultUri property: The Uri of KeyVault.
     * 
     * @return the keyVaultUri value.
     */
    public String keyVaultUri() {
        return this.keyVaultUri;
    }

    /**
     * Set the keyVaultUri property: The Uri of KeyVault.
     * 
     * @param keyVaultUri the keyVaultUri value to set.
     * @return the Encryption object itself.
     */
    public Encryption withKeyVaultUri(String keyVaultUri) {
        this.keyVaultUri = keyVaultUri;
        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("keySource", this.keySource == null ? null : this.keySource.toString());
        jsonWriter.writeStringField("KeyName", this.keyName);
        jsonWriter.writeStringField("keyversion", this.keyVersion);
        jsonWriter.writeStringField("keyvaulturi", this.keyVaultUri);
        return jsonWriter.writeEndObject();
    }

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

                if ("keySource".equals(fieldName)) {
                    deserializedEncryption.keySource = KeySource.fromString(reader.getString());
                } else if ("KeyName".equals(fieldName)) {
                    deserializedEncryption.keyName = reader.getString();
                } else if ("keyversion".equals(fieldName)) {
                    deserializedEncryption.keyVersion = reader.getString();
                } else if ("keyvaulturi".equals(fieldName)) {
                    deserializedEncryption.keyVaultUri = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEncryption;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy