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

com.azure.resourcemanager.databricks.models.WorkspaceEncryptionParameter 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 WorkspaceEncryptionParameter implements JsonSerializable {
    /*
     * The type of variable that this is
     */
    private CustomParameterType type;

    /*
     * The value which should be used for this field.
     */
    private Encryption value;

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

    /**
     * Get the type property: The type of variable that this is.
     * 
     * @return the type value.
     */
    public CustomParameterType type() {
        return this.type;
    }

    /**
     * Get the value property: The value which should be used for this field.
     * 
     * @return the value value.
     */
    public Encryption value() {
        return this.value;
    }

    /**
     * Set the value property: The value which should be used for this field.
     * 
     * @param value the value value to set.
     * @return the WorkspaceEncryptionParameter object itself.
     */
    public WorkspaceEncryptionParameter withValue(Encryption value) {
        this.value = value;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (value() != null) {
            value().validate();
        }
    }

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

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

                if ("type".equals(fieldName)) {
                    deserializedWorkspaceEncryptionParameter.type = CustomParameterType.fromString(reader.getString());
                } else if ("value".equals(fieldName)) {
                    deserializedWorkspaceEncryptionParameter.value = Encryption.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedWorkspaceEncryptionParameter;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy