
com.azure.resourcemanager.devcenter.models.CustomerManagedKeyEncryption 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.devcenter.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;
/**
* All Customer-managed key encryption properties for the resource.
*/
@Fluent
public final class CustomerManagedKeyEncryption implements JsonSerializable {
/*
* All identity configuration for Customer-managed key settings defining which identity should be used to auth to
* Key Vault.
*/
private CustomerManagedKeyEncryptionKeyIdentity keyEncryptionKeyIdentity;
/*
* key encryption key Url, versioned or non-versioned. Ex:
* https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or
* https://contosovault.vault.azure.net/keys/contosokek.
*/
private String keyEncryptionKeyUrl;
/**
* Creates an instance of CustomerManagedKeyEncryption class.
*/
public CustomerManagedKeyEncryption() {
}
/**
* Get the keyEncryptionKeyIdentity property: All identity configuration for Customer-managed key settings defining
* which identity should be used to auth to Key Vault.
*
* @return the keyEncryptionKeyIdentity value.
*/
public CustomerManagedKeyEncryptionKeyIdentity keyEncryptionKeyIdentity() {
return this.keyEncryptionKeyIdentity;
}
/**
* Set the keyEncryptionKeyIdentity property: All identity configuration for Customer-managed key settings defining
* which identity should be used to auth to Key Vault.
*
* @param keyEncryptionKeyIdentity the keyEncryptionKeyIdentity value to set.
* @return the CustomerManagedKeyEncryption object itself.
*/
public CustomerManagedKeyEncryption
withKeyEncryptionKeyIdentity(CustomerManagedKeyEncryptionKeyIdentity keyEncryptionKeyIdentity) {
this.keyEncryptionKeyIdentity = keyEncryptionKeyIdentity;
return this;
}
/**
* Get the keyEncryptionKeyUrl property: key encryption key Url, versioned or non-versioned. Ex:
* https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or
* https://contosovault.vault.azure.net/keys/contosokek.
*
* @return the keyEncryptionKeyUrl value.
*/
public String keyEncryptionKeyUrl() {
return this.keyEncryptionKeyUrl;
}
/**
* Set the keyEncryptionKeyUrl property: key encryption key Url, versioned or non-versioned. Ex:
* https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or
* https://contosovault.vault.azure.net/keys/contosokek.
*
* @param keyEncryptionKeyUrl the keyEncryptionKeyUrl value to set.
* @return the CustomerManagedKeyEncryption object itself.
*/
public CustomerManagedKeyEncryption withKeyEncryptionKeyUrl(String keyEncryptionKeyUrl) {
this.keyEncryptionKeyUrl = keyEncryptionKeyUrl;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (keyEncryptionKeyIdentity() != null) {
keyEncryptionKeyIdentity().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("keyEncryptionKeyIdentity", this.keyEncryptionKeyIdentity);
jsonWriter.writeStringField("keyEncryptionKeyUrl", this.keyEncryptionKeyUrl);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of CustomerManagedKeyEncryption from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CustomerManagedKeyEncryption 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 CustomerManagedKeyEncryption.
*/
public static CustomerManagedKeyEncryption fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
CustomerManagedKeyEncryption deserializedCustomerManagedKeyEncryption = new CustomerManagedKeyEncryption();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("keyEncryptionKeyIdentity".equals(fieldName)) {
deserializedCustomerManagedKeyEncryption.keyEncryptionKeyIdentity
= CustomerManagedKeyEncryptionKeyIdentity.fromJson(reader);
} else if ("keyEncryptionKeyUrl".equals(fieldName)) {
deserializedCustomerManagedKeyEncryption.keyEncryptionKeyUrl = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedCustomerManagedKeyEncryption;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy