
com.azure.resourcemanager.databricks.models.EncryptionV2KeyVaultProperties 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.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;
/**
* Key Vault input properties for encryption.
*/
@Fluent
public final class EncryptionV2KeyVaultProperties implements JsonSerializable {
/*
* The Uri of KeyVault.
*/
private String keyVaultUri;
/*
* The name of KeyVault key.
*/
private String keyName;
/*
* The version of KeyVault key.
*/
private String keyVersion;
/**
* Creates an instance of EncryptionV2KeyVaultProperties class.
*/
public EncryptionV2KeyVaultProperties() {
}
/**
* 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 EncryptionV2KeyVaultProperties object itself.
*/
public EncryptionV2KeyVaultProperties withKeyVaultUri(String keyVaultUri) {
this.keyVaultUri = keyVaultUri;
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 EncryptionV2KeyVaultProperties object itself.
*/
public EncryptionV2KeyVaultProperties 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 EncryptionV2KeyVaultProperties object itself.
*/
public EncryptionV2KeyVaultProperties withKeyVersion(String keyVersion) {
this.keyVersion = keyVersion;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (keyVaultUri() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property keyVaultUri in model EncryptionV2KeyVaultProperties"));
}
if (keyName() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property keyName in model EncryptionV2KeyVaultProperties"));
}
if (keyVersion() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property keyVersion in model EncryptionV2KeyVaultProperties"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(EncryptionV2KeyVaultProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("keyVaultUri", this.keyVaultUri);
jsonWriter.writeStringField("keyName", this.keyName);
jsonWriter.writeStringField("keyVersion", this.keyVersion);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of EncryptionV2KeyVaultProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of EncryptionV2KeyVaultProperties 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 EncryptionV2KeyVaultProperties.
*/
public static EncryptionV2KeyVaultProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
EncryptionV2KeyVaultProperties deserializedEncryptionV2KeyVaultProperties
= new EncryptionV2KeyVaultProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("keyVaultUri".equals(fieldName)) {
deserializedEncryptionV2KeyVaultProperties.keyVaultUri = reader.getString();
} else if ("keyName".equals(fieldName)) {
deserializedEncryptionV2KeyVaultProperties.keyName = reader.getString();
} else if ("keyVersion".equals(fieldName)) {
deserializedEncryptionV2KeyVaultProperties.keyVersion = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedEncryptionV2KeyVaultProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy