alloytypes

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionalSecret

type OptionalSecret struct {
	IsSecret bool
	Value    string
}

OptionalSecret holds a potentially sensitive value. When IsSecret is true, the OptionalSecret's Value will be treated as sensitive and will be hidden from users when rendering Alloy syntax.

OptionalSecrets may be converted from Alloy syntax strings and the Secret type, which will set IsSecret accordingly.

Additionally, OptionalSecrets may be converted into the Secret type regardless of the value of IsSecret. OptionalSecret can be converted into a string as long as IsSecret is false.

func (OptionalSecret) AlloyCapsule

func (s OptionalSecret) AlloyCapsule()

AlloyCapsule marks OptionalSecret as a AlloyCapsule.

func (OptionalSecret) AlloyTokenize

func (s OptionalSecret) AlloyTokenize() []builder.Token

AlloyTokenize returns a set of custom tokens to represent this value in Alloy syntax text.

func (*OptionalSecret) ConvertFrom

func (s *OptionalSecret) ConvertFrom(src interface{}) error

ConvertFrom converts the src value and stores it into the OptionalSecret s. Secrets and strings can be converted into an OptionalSecret. In other cases, this method will return syntax.ErrNoConversion.

func (OptionalSecret) ConvertInto

func (s OptionalSecret) ConvertInto(dst interface{}) error

ConvertInto converts the OptionalSecret and stores it into the Go value pointed at by dst. OptionalSecrets can always be converted into *Secret. OptionalSecrets can only be converted into *string if IsSecret is false. In other cases, this method will return an explicit error or syntax.ErrNoConversion.

type Secret

type Secret string

Secret is an Alloy syntax capsule holding a sensitive string. The contents of a Secret are never displayed to the user when rendering Alloy configuration.

Secret allows itself to be converted from a string Alloy syntax value, but never the inverse. This ensures that a user can't accidentally leak a sensitive value.

func (Secret) AlloyCapsule

func (s Secret) AlloyCapsule()

AlloyCapsule marks Secret as a AlloyCapsule.

func (Secret) AlloyTokenize

func (s Secret) AlloyTokenize() []builder.Token

AlloyTokenize returns a set of custom tokens to represent this value in Alloy syntax text.

func (*Secret) ConvertFrom

func (s *Secret) ConvertFrom(src interface{}) error

ConvertFrom converts the src value and stores it into the Secret s. OptionalSecrets and strings can be converted into a Secret. In other cases, this method will return syntax.ErrNoConversion.

func (Secret) ConvertInto

func (s Secret) ConvertInto(dst interface{}) error

ConvertInto converts the Secret and stores it into the Go value pointed at by dst. Secrets can be converted into *OptionalSecret. In other cases, this method will return an explicit error or syntax.ErrNoConversion.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL