customtype

package
v0.0.0-...-fd08d72 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mac

type Mac struct {
	basetypes.StringValue
}

Mac represents a valid mac address.

func NewMacNull

func NewMacNull() Mac

NewMacNull creates an Mac with a null value. Determine whether the value is null via IsNull method.

func NewMacPointerValue

func NewMacPointerValue(value *string) Mac

NewMacPointerValue creates an Mac with a null value if nil or a known value. Access the value via ValueStringPointer method.

func NewMacUnknown

func NewMacUnknown() Mac

NewMacUnknown creates an Mac with an unknown value. Determine whether the value is unknown via IsUnknown method.

func NewMacValue

func NewMacValue(value string) Mac

NewMacValue creates an Mac with a known value. Access the value via ValueString method.

func (Mac) Equal

func (v Mac) Equal(o attr.Value) bool

Equal returns true if the given value is equivalent.

func (Mac) Type

func (v Mac) Type(_ context.Context) attr.Type

Type returns an MacType.

func (Mac) ValidateAttribute

func (v Mac) ValidateAttribute(ctx context.Context, req xattr.ValidateAttributeRequest, resp *xattr.ValidateAttributeResponse)

ValidateAttribute implements attribute value validation. This type requires the value provided to be a String value that is a valid mac address.

func (Mac) ValidateParameter

ValidateParameter implements provider-defined function parameter value validation. This type requires the value provided to be a String value that is a valid mac address.

func (Mac) ValueMac

func (v Mac) ValueMac() (net.HardwareAddr, diag.Diagnostics)

ValueMac calls net.ParseMAC with the Mac StringValue. A null or unknown value will produce an error diagnostic.

type MacType

type MacType struct {
	basetypes.StringType
}

MacType is an attribute type that represents a valid mac address.

func (MacType) Equal

func (t MacType) Equal(o attr.Type) bool

Equal returns true if the given type is equivalent.

func (MacType) String

func (t MacType) String() string

String returns a human readable string of the type name.

func (MacType) ValueFromString

ValueFromString returns a StringValuable type given a StringValue.

func (MacType) ValueFromTerraform

func (t MacType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns a Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (MacType) ValueType

func (t MacType) ValueType(ctx context.Context) attr.Value

ValueType returns the Value type.

Jump to

Keyboard shortcuts

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