
com.azure.resourcemanager.datafactory.models.AzureKeyVaultSecretReference 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.datafactory.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Azure Key Vault secret reference.
*/
@Fluent
public final class AzureKeyVaultSecretReference extends SecretBase {
/*
* Type of the secret.
*/
private String type = "AzureKeyVaultSecret";
/*
* The Azure Key Vault linked service reference.
*/
private LinkedServiceReference store;
/*
* The name of the secret in Azure Key Vault. Type: string (or Expression with resultType string).
*/
private Object secretName;
/*
* The version of the secret in Azure Key Vault. The default value is the latest version of the secret. Type: string
* (or Expression with resultType string).
*/
private Object secretVersion;
/**
* Creates an instance of AzureKeyVaultSecretReference class.
*/
public AzureKeyVaultSecretReference() {
}
/**
* Get the type property: Type of the secret.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the store property: The Azure Key Vault linked service reference.
*
* @return the store value.
*/
public LinkedServiceReference store() {
return this.store;
}
/**
* Set the store property: The Azure Key Vault linked service reference.
*
* @param store the store value to set.
* @return the AzureKeyVaultSecretReference object itself.
*/
public AzureKeyVaultSecretReference withStore(LinkedServiceReference store) {
this.store = store;
return this;
}
/**
* Get the secretName property: The name of the secret in Azure Key Vault. Type: string (or Expression with
* resultType string).
*
* @return the secretName value.
*/
public Object secretName() {
return this.secretName;
}
/**
* Set the secretName property: The name of the secret in Azure Key Vault. Type: string (or Expression with
* resultType string).
*
* @param secretName the secretName value to set.
* @return the AzureKeyVaultSecretReference object itself.
*/
public AzureKeyVaultSecretReference withSecretName(Object secretName) {
this.secretName = secretName;
return this;
}
/**
* Get the secretVersion property: The version of the secret in Azure Key Vault. The default value is the latest
* version of the secret. Type: string (or Expression with resultType string).
*
* @return the secretVersion value.
*/
public Object secretVersion() {
return this.secretVersion;
}
/**
* Set the secretVersion property: The version of the secret in Azure Key Vault. The default value is the latest
* version of the secret. Type: string (or Expression with resultType string).
*
* @param secretVersion the secretVersion value to set.
* @return the AzureKeyVaultSecretReference object itself.
*/
public AzureKeyVaultSecretReference withSecretVersion(Object secretVersion) {
this.secretVersion = secretVersion;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (store() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property store in model AzureKeyVaultSecretReference"));
} else {
store().validate();
}
if (secretName() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property secretName in model AzureKeyVaultSecretReference"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(AzureKeyVaultSecretReference.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("store", this.store);
jsonWriter.writeUntypedField("secretName", this.secretName);
jsonWriter.writeStringField("type", this.type);
jsonWriter.writeUntypedField("secretVersion", this.secretVersion);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AzureKeyVaultSecretReference from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AzureKeyVaultSecretReference 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 AzureKeyVaultSecretReference.
*/
public static AzureKeyVaultSecretReference fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AzureKeyVaultSecretReference deserializedAzureKeyVaultSecretReference = new AzureKeyVaultSecretReference();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("store".equals(fieldName)) {
deserializedAzureKeyVaultSecretReference.store = LinkedServiceReference.fromJson(reader);
} else if ("secretName".equals(fieldName)) {
deserializedAzureKeyVaultSecretReference.secretName = reader.readUntyped();
} else if ("type".equals(fieldName)) {
deserializedAzureKeyVaultSecretReference.type = reader.getString();
} else if ("secretVersion".equals(fieldName)) {
deserializedAzureKeyVaultSecretReference.secretVersion = reader.readUntyped();
} else {
reader.skipChildren();
}
}
return deserializedAzureKeyVaultSecretReference;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy