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 Details

    • KeyVaultSecret

      public KeyVaultSecret(String name, String value)
      Creates a Secret with name and value.
      Parameters:
      name - The name of the secret.
      value - the value of the secret.
  • Method Details

    • getValue

      public String getValue()
      Get the value of the secret.
      Returns:
      the secret value
    • getId

      public String getId()
      Get the secret identifier.
      Returns:
      the secret identifier.
    • getName

      public String getName()
      Get the secret name.
      Returns:
      the secret name.
    • getProperties

      public SecretProperties getProperties()
      Get the secret properties
      Returns:
      the Secret properties
    • setProperties

      public KeyVaultSecret setProperties(SecretProperties properties)
      Set the secret properties
      Parameters:
      properties - The Secret properties
      Returns:
      the updated secret object
      Throws:
      NullPointerException - if properties is null.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Description copied from interface: com.azure.json.JsonSerializable
      Writes the object to the passed JsonWriter.

      The contract for writing JSON to JsonWriter is that the object being written will handle opening and closing its own JSON object. So, for objects calling out to other JsonSerializable objects for serialization, they'll write the field name only then pass the JsonWriter to the other JsonSerializable object. This way objects writing JSON will be self-encapsulated for writing properly formatted JSON.

      Specified by:
      toJson in interface com.azure.json.JsonSerializable<KeyVaultSecret>
      Parameters:
      jsonWriter - Where the object's JSON will be written.
      Returns:
      The JsonWriter where the JSON was written.
      Throws:
      IOException - If the object fails to be written to the jsonWriter.
    • fromJson

      public static KeyVaultSecret fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of KeyVaultSecret from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of KeyVaultSecret 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 KeyVaultSecret.