Class SecretDefinitionAttribute
Defines a secret parameter for a build target, which will be masked in logs and can be resolved from secret stores.
[AttributeUsage(AttributeTargets.Property)]
public sealed class SecretDefinitionAttribute : ParamDefinitionAttributeBase
- Inheritance
-
objectAttributeSecretDefinitionAttribute
- Inherited Members
Examples
public interface IMyTarget
{
[SecretDefinition("api-key", "The API key for accessing the service.")]
string ApiKey => GetParam(() => ApiKey);
}
Remarks
This attribute sets IsSecret to true. Use this for sensitive values like API keys or passwords.
Constructors
SecretDefinitionAttribute(string, string, ParamSource, string[]?)
Initializes a new instance of the SecretDefinitionAttribute class.
public SecretDefinitionAttribute(string argName, string description, ParamSource sources = ParamSource.All, string[]? chainedParams = null)
Parameters
argNamestringThe name of the secret on the command line (e.g., "api-key").
descriptionstringA description of the secret for help text.
sourcesParamSourceThe sources from which the secret can be resolved.
chainedParamsstring[]An array of other parameters that this secret depends on.