com.azure.resourcemanager.mediaservices.models.AccountEncryption Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-mediaservices Show documentation
Show all versions of azure-resourcemanager-mediaservices Show documentation
This package contains Microsoft Azure SDK for MediaServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This Swagger was generated by the API Framework. Package tag package-account-2023-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.mediaservices.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 AccountEncryption model.
*/
@Fluent
public final class AccountEncryption implements JsonSerializable {
/*
* The type of key used to encrypt the Account Key.
*/
private AccountEncryptionKeyType type;
/*
* The properties of the key used to encrypt the account.
*/
private KeyVaultProperties keyVaultProperties;
/*
* The Key Vault identity.
*/
private ResourceIdentity identity;
/*
* The current status of the Key Vault mapping.
*/
private String status;
/**
* Creates an instance of AccountEncryption class.
*/
public AccountEncryption() {
}
/**
* Get the type property: The type of key used to encrypt the Account Key.
*
* @return the type value.
*/
public AccountEncryptionKeyType type() {
return this.type;
}
/**
* Set the type property: The type of key used to encrypt the Account Key.
*
* @param type the type value to set.
* @return the AccountEncryption object itself.
*/
public AccountEncryption withType(AccountEncryptionKeyType type) {
this.type = type;
return this;
}
/**
* Get the keyVaultProperties property: The properties of the key used to encrypt the account.
*
* @return the keyVaultProperties value.
*/
public KeyVaultProperties keyVaultProperties() {
return this.keyVaultProperties;
}
/**
* Set the keyVaultProperties property: The properties of the key used to encrypt the account.
*
* @param keyVaultProperties the keyVaultProperties value to set.
* @return the AccountEncryption object itself.
*/
public AccountEncryption withKeyVaultProperties(KeyVaultProperties keyVaultProperties) {
this.keyVaultProperties = keyVaultProperties;
return this;
}
/**
* Get the identity property: The Key Vault identity.
*
* @return the identity value.
*/
public ResourceIdentity identity() {
return this.identity;
}
/**
* Set the identity property: The Key Vault identity.
*
* @param identity the identity value to set.
* @return the AccountEncryption object itself.
*/
public AccountEncryption withIdentity(ResourceIdentity identity) {
this.identity = identity;
return this;
}
/**
* Get the status property: The current status of the Key Vault mapping.
*
* @return the status value.
*/
public String status() {
return this.status;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (type() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property type in model AccountEncryption"));
}
if (keyVaultProperties() != null) {
keyVaultProperties().validate();
}
if (identity() != null) {
identity().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(AccountEncryption.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeJsonField("keyVaultProperties", this.keyVaultProperties);
jsonWriter.writeJsonField("identity", this.identity);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AccountEncryption from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AccountEncryption 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 AccountEncryption.
*/
public static AccountEncryption fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AccountEncryption deserializedAccountEncryption = new AccountEncryption();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedAccountEncryption.type = AccountEncryptionKeyType.fromString(reader.getString());
} else if ("keyVaultProperties".equals(fieldName)) {
deserializedAccountEncryption.keyVaultProperties = KeyVaultProperties.fromJson(reader);
} else if ("identity".equals(fieldName)) {
deserializedAccountEncryption.identity = ResourceIdentity.fromJson(reader);
} else if ("status".equals(fieldName)) {
deserializedAccountEncryption.status = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedAccountEncryption;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy