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

com.azure.resourcemanager.compute.models.VMDiskSecurityProfile Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

There is a newer version: 2.44.0
Show 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.compute.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;

/**
 * Specifies the security profile settings for the managed disk. **Note:** It can only be set for Confidential VMs.
 */
@Fluent
public final class VMDiskSecurityProfile implements JsonSerializable {
    /*
     * Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption of the managed
     * disk along with VMGuestState blob, VMGuestStateOnly for encryption of just the VMGuestState blob, and
     * NonPersistedTPM for not persisting firmware state in the VMGuestState blob.. **Note:** It can be set for only
     * Confidential VMs.
     */
    private SecurityEncryptionTypes securityEncryptionType;

    /*
     * Specifies the customer managed disk encryption set resource id for the managed disk that is used for Customer
     * Managed Key encrypted ConfidentialVM OS Disk and VMGuest blob.
     */
    private DiskEncryptionSetParameters diskEncryptionSet;

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

    /**
     * Get the securityEncryptionType property: Specifies the EncryptionType of the managed disk. It is set to
     * DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, VMGuestStateOnly for
     * encryption of just the VMGuestState blob, and NonPersistedTPM for not persisting firmware state in the
     * VMGuestState blob.. **Note:** It can be set for only Confidential VMs.
     * 
     * @return the securityEncryptionType value.
     */
    public SecurityEncryptionTypes securityEncryptionType() {
        return this.securityEncryptionType;
    }

    /**
     * Set the securityEncryptionType property: Specifies the EncryptionType of the managed disk. It is set to
     * DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, VMGuestStateOnly for
     * encryption of just the VMGuestState blob, and NonPersistedTPM for not persisting firmware state in the
     * VMGuestState blob.. **Note:** It can be set for only Confidential VMs.
     * 
     * @param securityEncryptionType the securityEncryptionType value to set.
     * @return the VMDiskSecurityProfile object itself.
     */
    public VMDiskSecurityProfile withSecurityEncryptionType(SecurityEncryptionTypes securityEncryptionType) {
        this.securityEncryptionType = securityEncryptionType;
        return this;
    }

    /**
     * Get the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the
     * managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and VMGuest blob.
     * 
     * @return the diskEncryptionSet value.
     */
    public DiskEncryptionSetParameters diskEncryptionSet() {
        return this.diskEncryptionSet;
    }

    /**
     * Set the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the
     * managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and VMGuest blob.
     * 
     * @param diskEncryptionSet the diskEncryptionSet value to set.
     * @return the VMDiskSecurityProfile object itself.
     */
    public VMDiskSecurityProfile withDiskEncryptionSet(DiskEncryptionSetParameters diskEncryptionSet) {
        this.diskEncryptionSet = diskEncryptionSet;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("securityEncryptionType",
            this.securityEncryptionType == null ? null : this.securityEncryptionType.toString());
        jsonWriter.writeJsonField("diskEncryptionSet", this.diskEncryptionSet);
        return jsonWriter.writeEndObject();
    }

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

                if ("securityEncryptionType".equals(fieldName)) {
                    deserializedVMDiskSecurityProfile.securityEncryptionType
                        = SecurityEncryptionTypes.fromString(reader.getString());
                } else if ("diskEncryptionSet".equals(fieldName)) {
                    deserializedVMDiskSecurityProfile.diskEncryptionSet = DiskEncryptionSetParameters.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedVMDiskSecurityProfile;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy