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

com.azure.resourcemanager.servicelinker.models.SecretStore 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.servicelinker.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;

/**
 * An option to store secret value in secure place.
 */
@Fluent
public final class SecretStore implements JsonSerializable {
    /*
     * The key vault id to store secret
     */
    private String keyVaultId;

    /*
     * The key vault secret name to store secret, only valid when storing one secret
     */
    private String keyVaultSecretName;

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

    /**
     * Get the keyVaultId property: The key vault id to store secret.
     * 
     * @return the keyVaultId value.
     */
    public String keyVaultId() {
        return this.keyVaultId;
    }

    /**
     * Set the keyVaultId property: The key vault id to store secret.
     * 
     * @param keyVaultId the keyVaultId value to set.
     * @return the SecretStore object itself.
     */
    public SecretStore withKeyVaultId(String keyVaultId) {
        this.keyVaultId = keyVaultId;
        return this;
    }

    /**
     * Get the keyVaultSecretName property: The key vault secret name to store secret, only valid when storing one
     * secret.
     * 
     * @return the keyVaultSecretName value.
     */
    public String keyVaultSecretName() {
        return this.keyVaultSecretName;
    }

    /**
     * Set the keyVaultSecretName property: The key vault secret name to store secret, only valid when storing one
     * secret.
     * 
     * @param keyVaultSecretName the keyVaultSecretName value to set.
     * @return the SecretStore object itself.
     */
    public SecretStore withKeyVaultSecretName(String keyVaultSecretName) {
        this.keyVaultSecretName = keyVaultSecretName;
        return this;
    }

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

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

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

                if ("keyVaultId".equals(fieldName)) {
                    deserializedSecretStore.keyVaultId = reader.getString();
                } else if ("keyVaultSecretName".equals(fieldName)) {
                    deserializedSecretStore.keyVaultSecretName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSecretStore;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy