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

com.azure.resourcemanager.netapp.models.KeyVaultProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for NetAppFiles Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-2024-03.

There is a newer version: 1.4.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.netapp.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;

/**
 * Properties of key vault.
 */
@Fluent
public final class KeyVaultProperties implements JsonSerializable {
    /*
     * UUID v4 used to identify the Azure Key Vault configuration
     */
    private String keyVaultId;

    /*
     * The Uri of KeyVault.
     */
    private String keyVaultUri;

    /*
     * The name of KeyVault key.
     */
    private String keyName;

    /*
     * The resource ID of KeyVault.
     */
    private String keyVaultResourceId;

    /*
     * Status of the KeyVault connection.
     */
    private KeyVaultStatus status;

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

    /**
     * Get the keyVaultId property: UUID v4 used to identify the Azure Key Vault configuration.
     * 
     * @return the keyVaultId value.
     */
    public String keyVaultId() {
        return this.keyVaultId;
    }

    /**
     * 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 KeyVaultProperties object itself.
     */
    public KeyVaultProperties 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 KeyVaultProperties object itself.
     */
    public KeyVaultProperties withKeyName(String keyName) {
        this.keyName = keyName;
        return this;
    }

    /**
     * Get the keyVaultResourceId property: The resource ID of KeyVault.
     * 
     * @return the keyVaultResourceId value.
     */
    public String keyVaultResourceId() {
        return this.keyVaultResourceId;
    }

    /**
     * Set the keyVaultResourceId property: The resource ID of KeyVault.
     * 
     * @param keyVaultResourceId the keyVaultResourceId value to set.
     * @return the KeyVaultProperties object itself.
     */
    public KeyVaultProperties withKeyVaultResourceId(String keyVaultResourceId) {
        this.keyVaultResourceId = keyVaultResourceId;
        return this;
    }

    /**
     * Get the status property: Status of the KeyVault connection.
     * 
     * @return the status value.
     */
    public KeyVaultStatus status() {
        return this.status;
    }

    /**
     * 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 KeyVaultProperties"));
        }
        if (keyName() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property keyName in model KeyVaultProperties"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(KeyVaultProperties.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("keyVaultUri", this.keyVaultUri);
        jsonWriter.writeStringField("keyName", this.keyName);
        jsonWriter.writeStringField("keyVaultResourceId", this.keyVaultResourceId);
        return jsonWriter.writeEndObject();
    }

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

                if ("keyVaultUri".equals(fieldName)) {
                    deserializedKeyVaultProperties.keyVaultUri = reader.getString();
                } else if ("keyName".equals(fieldName)) {
                    deserializedKeyVaultProperties.keyName = reader.getString();
                } else if ("keyVaultId".equals(fieldName)) {
                    deserializedKeyVaultProperties.keyVaultId = reader.getString();
                } else if ("keyVaultResourceId".equals(fieldName)) {
                    deserializedKeyVaultProperties.keyVaultResourceId = reader.getString();
                } else if ("status".equals(fieldName)) {
                    deserializedKeyVaultProperties.status = KeyVaultStatus.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedKeyVaultProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy