// Get a secret value by secret key.
// If the Key does not exist, SDK will return the defaultValue
var secretValue = service.GetSecret(
name: "REDIS_CONNECTION",
defaultValue: "Default Value"
);
Console.WriteLine(secretValue);
// Get a secret value by secret key and specific environment name.
// If the Key does not exist, SDK will return the defaultValue
secretValue = service.GetSecret(
name: "REDIS_CONNECTION",
environmentName: "staging",
defaultValue: "Default Value"
);
Console.WriteLine(secretValue);
// Get a secret value by secret key.
// If the Key does not exist, SDK will throw exception
var options = new SecretRetrieveOptions();
var requestOptions = new RequestOptions();
var secretValue = service.Get(
name: "REDIS_CONNECTION",
retrieveOptions: options,
requestOptions: requestOptions
);
Console.WriteLine(secretValue);
// Get a secret value by secret key and specific environment name.
// If the Key does not exist, SDK will throw exception
var options = new SecretRetrieveOptions();
var requestOptions = new RequestOptions();
var secretValue = service.Get(
name: "REDIS_CONNECTION",
environmentName: "staging",
retrieveOptions: options,
requestOptions: requestOptions
);
Console.WriteLine(secretValue);