The C# .NET SDK currently only supports legacy versions of Nitric prior to v1. This version is maintained for compatibility with existing projects and not recommended for new projects. New projects should be started using a supported SDK (presented automatically using the `nitric new` command) orget in touch to request an update to the latest version.
.NET - Secret()
Creates a reference to a secret in the secrets manager.
using Nitric.Sdk;
using Nitric.Sdk.Resource;
var keyRef = Nitric.Secret("apiKey").With(SecretPermission.Accessing);
Nitric.Run();
Parameters
- Name
name
- Required
- Required
- Type
- string
- Description
The unique name of this secret within the secrets manager.
Access
All Nitric resources provide access permissions you can use to specify the level of access your code needs to the resource. See here for details Access Control documentation.
Available permissions:
SecretPermission.Putting
This permission allows your code to set a new latest value for a secret.
SecretPermission.Accessing
This permission allows your code to retrieve secret values.
Examples
Create a reference to a secret
using Nitric.Sdk;
using Nitric.Sdk.Resource;
var keyRef = Nitric.Secret("apiKey").With(SecretPermission.Putting);
Nitric.Run();