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

com.azure.resourcemanager.avs.models.Encryption Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Avs Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure VMware Solution API. Package tag package-2023-09-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.avs.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 properties of customer managed encryption key.
 */
@Fluent
public final class Encryption implements JsonSerializable {
    /*
     * Status of customer managed encryption key
     */
    private EncryptionState status;

    /*
     * The key vault where the encryption key is stored
     */
    private EncryptionKeyVaultProperties keyVaultProperties;

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

    /**
     * Get the status property: Status of customer managed encryption key.
     * 
     * @return the status value.
     */
    public EncryptionState status() {
        return this.status;
    }

    /**
     * Set the status property: Status of customer managed encryption key.
     * 
     * @param status the status value to set.
     * @return the Encryption object itself.
     */
    public Encryption withStatus(EncryptionState status) {
        this.status = status;
        return this;
    }

    /**
     * Get the keyVaultProperties property: The key vault where the encryption key is stored.
     * 
     * @return the keyVaultProperties value.
     */
    public EncryptionKeyVaultProperties keyVaultProperties() {
        return this.keyVaultProperties;
    }

    /**
     * Set the keyVaultProperties property: The key vault where the encryption key is stored.
     * 
     * @param keyVaultProperties the keyVaultProperties value to set.
     * @return the Encryption object itself.
     */
    public Encryption withKeyVaultProperties(EncryptionKeyVaultProperties keyVaultProperties) {
        this.keyVaultProperties = keyVaultProperties;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString());
        jsonWriter.writeJsonField("keyVaultProperties", this.keyVaultProperties);
        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 ("status".equals(fieldName)) {
                    deserializedEncryption.status = EncryptionState.fromString(reader.getString());
                } else if ("keyVaultProperties".equals(fieldName)) {
                    deserializedEncryption.keyVaultProperties = EncryptionKeyVaultProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEncryption;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy