Class KeyVaultSecret
java.lang.Object
com.azure.security.keyvault.secrets.models.KeyVaultSecret
- All Implemented Interfaces:
com.azure.json.JsonSerializable<KeyVaultSecret>
- Direct Known Subclasses:
DeletedSecret
public class KeyVaultSecret
extends Object
implements com.azure.json.JsonSerializable<KeyVaultSecret>
Secret is the resource consisting of name, value and its attributes specified in
SecretProperties.
It is managed by Secret Service.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKeyVaultSecret(String name, String value) Creates a Secret withnameandvalue. -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyVaultSecretfromJson(com.azure.json.JsonReader jsonReader) Reads an instance ofKeyVaultSecretfrom the JsonReader.getId()Get the secret identifier.getName()Get the secret name.Get the secret propertiesgetValue()Get the value of the secret.setProperties(SecretProperties properties) Set the secret propertiescom.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter) Writes the object to the passedJsonWriter.
-
Constructor Details
-
KeyVaultSecret
Creates a Secret withnameandvalue.- Parameters:
name- The name of the secret.value- the value of the secret.
-
-
Method Details
-
getValue
Get the value of the secret.- Returns:
- the secret value
-
getId
Get the secret identifier.- Returns:
- the secret identifier.
-
getName
Get the secret name.- Returns:
- the secret name.
-
getProperties
Get the secret properties- Returns:
- the Secret properties
-
setProperties
Set the secret properties- Parameters:
properties- The Secret properties- Returns:
- the updated secret object
- Throws:
NullPointerException- ifpropertiesis null.
-
toJson
Description copied from interface:com.azure.json.JsonSerializableWrites the object to the passedJsonWriter.The contract for writing JSON to
JsonWriteris that the object being written will handle opening and closing its own JSON object. So, for objects calling out to otherJsonSerializableobjects for serialization, they'll write the field name only then pass theJsonWriterto the otherJsonSerializableobject. This way objects writing JSON will be self-encapsulated for writing properly formatted JSON.- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<KeyVaultSecret>- Parameters:
jsonWriter- Where the object's JSON will be written.- Returns:
- The
JsonWriterwhere the JSON was written. - Throws:
IOException- If the object fails to be written to thejsonWriter.
-
fromJson
Reads an instance ofKeyVaultSecretfrom the JsonReader.- Parameters:
jsonReader- The JsonReader being read.- Returns:
- An instance of
KeyVaultSecretif 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 theKeyVaultSecret.
-