metadata

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategoryProvider   = "Provider"
	CategoryResource   = "Resource"
	CategoryDataSource = "Data Source"
	CategoryEphemeral  = "Ephemeral Resource"
	CategoryAction     = "Action"
	CategoryList       = "List Resource"
	CategoryFunction   = "Function"
)

Variables

This section is empty.

Functions

func DescriptionCtxOf

func DescriptionCtxOf[T BothDescriptionCtxProvider](ctx context.Context, d T) string

func DescriptionOf

func DescriptionOf[T BothDescriptionProvider](d T) string

func MapOrNil

func MapOrNil[T any, U any](input T, f func(T) U) *U

func MapOrZero

func MapOrZero[T any, U any](input T, f func(T) U) U

func MapSlice

func MapSlice[T any, U any](input []T, f func(T) U) []U

func MapSliceSome

func MapSliceSome[T any, U any](input []T, f func(T) *U) []U

func MaybeDescriptionCtxOf

func MaybeDescriptionCtxOf(ctx context.Context, d any) *string

func MaybeDescriptionOf

func MaybeDescriptionOf(d any) *string

func PointerTo

func PointerTo[T any](ptr *T) T

func Sentencefy

func Sentencefy(s string) string

func WrapErrDiags added in v0.2.1

func WrapErrDiags(diags diag.Diagnostics, context string) diag.Diagnostics

Types

type ActionMetadata

type ActionMetadata struct {
	Schema ActionSchema

	RenderOption *ActionRenderOption
}

type ActionMetadatas

type ActionMetadatas map[string]ActionMetadata

type ActionRender

type ActionRender struct {
	Template    *template.Template
	Header      string
	Description string
	Example     string
	Schema      string
	Import      string
}

func (ActionRender) Execute

func (render ActionRender) Execute(w io.Writer) error

type ActionRenderOption

type ActionRenderOption struct {
	// The subcategory of the document.
	Subcategory string
	Examples    []Example

	// A custom template that overrides the default template:
	//
	// {{ .Header }}
	// {{ .Description }}
	// {{- with .Example }}
	// {{ . }}
	// {{- end }}
	// {{ .Schema }}
	Template *template.Template
}

type ActionSchema

type ActionSchema struct {
	Description string
	Deprecation string

	Fields Fields

	// Including nested attribute object or block object.
	Nested NestedFields
}

func NewActionSchema

func NewActionSchema(ctx context.Context, sch schema.Schema) (schema ActionSchema, diags diag.Diagnostics)

type ActionWithRenderOption

type ActionWithRenderOption interface {
	action.Action
	RenderOption() ActionRenderOption
}

type BothDescriptionCtxProvider

type BothDescriptionCtxProvider interface {
	DescriptionCtxProvider
	MarkdownDescriptionCtxProvider
}

type BothDescriptionProvider

type BothDescriptionProvider interface {
	DescriptionProvider
	MarkdownDescriptionProvider
}

type Categorizer

type Categorizer interface {
	Category() Category
}

type Category

type Category string

type DataSourceMetadata

type DataSourceMetadata struct {
	Schema DataSourceSchema

	RenderOption *DataSourceRenderOption
}

type DataSourceMetadatas

type DataSourceMetadatas map[string]DataSourceMetadata

type DataSourceRender

type DataSourceRender struct {
	Template    *template.Template
	Header      string
	Description string
	Example     string
	Schema      string
}

func (DataSourceRender) Execute

func (render DataSourceRender) Execute(w io.Writer) error

type DataSourceRenderOption

type DataSourceRenderOption struct {
	// The subcategory of the document.
	Subcategory string
	Examples    []Example

	// A custom template that overrides the default template:
	//
	// {{ .Header }}
	// {{ .Description }}
	// {{- with .Example }}
	// {{ . }}
	// {{- end }}
	// {{ .Schema }}
	Template *template.Template
}

type DataSourceSchema

type DataSourceSchema struct {
	Description string
	Deprecation string

	Fields Fields

	// Including nested attribute object or block object.
	Nested NestedFields
}

func NewDataSourceSchema

func NewDataSourceSchema(ctx context.Context, sch schema.Schema) (schema DataSourceSchema, diags diag.Diagnostics)

type DataSourceWithRenderOption

type DataSourceWithRenderOption interface {
	datasource.DataSource
	RenderOption() DataSourceRenderOption
}

type DataType

type DataType struct {
	// contains filtered or unexported fields
}

func (DataType) String

func (dt DataType) String() string

type DescriptionCtxProvider

type DescriptionCtxProvider interface {
	Description(context.Context) string
}

type DescriptionProvider

type DescriptionProvider interface {
	GetDescription() string
}

type EphemeralMetadata

type EphemeralMetadata struct {
	Schema EphemeralSchema

	RenderOption *EphemeralRenderOption
}

type EphemeralMetadatas

type EphemeralMetadatas map[string]EphemeralMetadata

type EphemeralRender

type EphemeralRender struct {
	Template    *template.Template
	Header      string
	Description string
	Example     string
	Schema      string
}

func (EphemeralRender) Execute

func (render EphemeralRender) Execute(w io.Writer) error

type EphemeralRenderOption

type EphemeralRenderOption struct {
	// The subcategory of the document.
	Subcategory string
	Examples    []Example

	// A custom template that overrides the default template:
	//
	// {{ .Header }}
	// {{ .Description }}
	// {{- with .Example }}
	// {{ . }}
	// {{- end }}
	// {{ .Schema }}
	Template *template.Template
}

type EphemeralResourceWithRenderOption

type EphemeralResourceWithRenderOption interface {
	ephemeral.EphemeralResource
	RenderOption() EphemeralRenderOption
}

type EphemeralSchema

type EphemeralSchema struct {
	Description string
	Deprecation string

	Fields Fields

	// Including nested attribute object or block object.
	Nested NestedFields
}

func NewEphemeralSchema

func NewEphemeralSchema(ctx context.Context, sch schema.Schema) (schema EphemeralSchema, diags diag.Diagnostics)

type Example

type Example struct {
	// The section header.
	Header string
	// The description of the example.
	Description string
	// The HCL code of the example.
	HCL string
}

type Field

type Field struct {
	// contains filtered or unexported fields
}

func (Field) Computed

func (r Field) Computed() bool

func (Field) CustomTypeDescription

func (r Field) CustomTypeDescription() string

func (Field) DataType

func (r Field) DataType() DataType

func (Field) Default

func (r Field) Default() string

func (Field) Deprecation

func (r Field) Deprecation() string

func (Field) Description

func (r Field) Description() string

func (Field) Lint added in v0.2.0

func (field Field) Lint() error

func (Field) Name

func (r Field) Name() string
func (field Field) NestedLink() string

func (Field) Optional

func (r Field) Optional() bool

func (Field) Parents

func (r Field) Parents() []string

func (Field) PlanModifiers

func (r Field) PlanModifiers() []string

func (Field) Required

func (r Field) Required() bool

func (Field) Sensitive

func (r Field) Sensitive() bool

func (Field) Traits

func (field Field) Traits() string

func (Field) Validators

func (r Field) Validators() []string

func (Field) WriteOnly

func (r Field) WriteOnly() bool

type Fields

type Fields map[string]Field

func (Fields) ComputedFields

func (fields Fields) ComputedFields() []Field

func (Fields) Lint added in v0.2.0

func (fields Fields) Lint() error

func (Fields) OptionalFields

func (fields Fields) OptionalFields() []Field

func (Fields) RequiredFields

func (fields Fields) RequiredFields() []Field

type FunctionField

type FunctionField struct {
	// contains filtered or unexported fields
}

func (FunctionField) AllowNull

func (r FunctionField) AllowNull() bool

func (FunctionField) AllowUnknown

func (r FunctionField) AllowUnknown() bool

func (FunctionField) CustomTypeDescription

func (r FunctionField) CustomTypeDescription() string

func (FunctionField) DataType

func (r FunctionField) DataType() DataType

func (FunctionField) Description

func (r FunctionField) Description() string

func (FunctionField) Lint added in v0.2.0

func (field FunctionField) Lint() error

func (FunctionField) Name

func (r FunctionField) Name() string
func (field FunctionField) NestedLink() string

func (FunctionField) Parents

func (r FunctionField) Parents() []string

func (FunctionField) Traits

func (field FunctionField) Traits() string

func (FunctionField) Validators

func (r FunctionField) Validators() []string

type FunctionFields

type FunctionFields []FunctionField

func (FunctionFields) Lint added in v0.2.0

func (fields FunctionFields) Lint() error

type FunctionMetadata

type FunctionMetadata struct {
	Schema FunctionSchema

	RenderOption *FunctionRenderOption
}

type FunctionMetadatas

type FunctionMetadatas map[string]FunctionMetadata

type FunctionObject

type FunctionObject struct {
	// contains filtered or unexported fields
}

func (FunctionObject) CustomTypeDescription

func (r FunctionObject) CustomTypeDescription() string

func (FunctionObject) Lint added in v0.2.0

func (object FunctionObject) Lint() error

type FunctionObjects

type FunctionObjects map[string]FunctionObject

func (FunctionObjects) Lint added in v0.2.0

func (objects FunctionObjects) Lint() error

type FunctionRender

type FunctionRender struct {
	Template    *template.Template
	Header      string
	Description string
	Example     string
	Signature   string
	Arguments   string
	Return      string
}

func (FunctionRender) Execute

func (render FunctionRender) Execute(w io.Writer) error

type FunctionRenderOption

type FunctionRenderOption struct {
	// The subcategory of the document.
	Subcategory string
	Examples    []Example

	// Description of the return value.
	ReturnDescription *string

	// A custom template that overrides the default template:
	//
	// {{ .Header }}
	// {{ .Description }}
	// {{- with .Example }}
	// {{ . }}
	// {{- end }}
	// {{ .Signature }}
	// {{- with .Arguments }}
	// {{ . }}
	// {{- end }}
	// {{- with .Return }}
	// {{ . }}
	// {{- end }}
	Template *template.Template
}

type FunctionSchema

type FunctionSchema struct {
	Description string
	Summary     string
	Deprecation string

	Parameters FunctionFields
	Objects    FunctionObjects

	Return        FunctionField
	ReturnObjects FunctionObjects
}

func NewFunctionSchema

func NewFunctionSchema(ctx context.Context, sch function.Definition) (schema FunctionSchema, diags diag.Diagnostics)

type FunctionWithRenderOption

type FunctionWithRenderOption interface {
	function.Function
	RenderOption() FunctionRenderOption
}

type ImportId

type ImportId struct {
	// The Id format.
	Format string

	// The example id that will be displayed in an example `terraform import` command.
	// Note that the id is double quoted, ensure to escape any double quote included in the id.
	ExampleId string

	// The complete import by id block. If not specified, it will fill in the block with the `ExampleId`.
	ExampleBlk string
}

type ListMetadata

type ListMetadata struct {
	Schema ListSchema

	RenderOption *ListRenderOption
}

type ListMetadatas

type ListMetadatas map[string]ListMetadata

type ListRender

type ListRender struct {
	Template    *template.Template
	Header      string
	Description string
	Example     string
	Schema      string
}

func (ListRender) Execute

func (render ListRender) Execute(w io.Writer) error

type ListRenderOption

type ListRenderOption struct {
	// The subcategory of the document.
	Subcategory string
	Examples    []Example

	// A custom template that overrides the default template:
	//
	// {{ .Header }}
	// {{ .Description }}
	// {{- with .Example }}
	// {{ . }}
	// {{- end }}
	// {{ .Schema }}
	Template *template.Template
}

type ListResourceWithRenderOption

type ListResourceWithRenderOption interface {
	list.ListResource
	RenderOption() ListRenderOption
}

type ListSchema

type ListSchema struct {
	Description string
	Deprecation string

	Fields Fields

	// Including nested attribute object or block object.
	Nested NestedFields
}

func NewListSchema

func NewListSchema(ctx context.Context, sch schema.Schema) (schema ListSchema, diags diag.Diagnostics)

type MarkdownDescriptionCtxProvider

type MarkdownDescriptionCtxProvider interface {
	MarkdownDescription(context.Context) string
}

type MarkdownDescriptionProvider

type MarkdownDescriptionProvider interface {
	GetMarkdownDescription() string
}

type Metadata

type Metadata struct {
	ProviderName string
	Provider     ProviderMetadata
	Resources    ResourceMetadatas
	DataSources  DataSourceMetadatas
	Ephemerals   EphemeralMetadatas
	Actions      ActionMetadatas
	Lists        ListMetadatas
	Functions    FunctionMetadatas
}

func GetMetadata

func GetMetadata(ctx context.Context, p provider.Provider) (metadata Metadata, diags diag.Diagnostics)

func (Metadata) NewActionRender

func (metadata Metadata) NewActionRender(actionType string, opt *ActionRenderOption) (*ActionRender, error)

func (Metadata) NewDataSourceRender

func (metadata Metadata) NewDataSourceRender(dataSourceType string, opt *DataSourceRenderOption) (*DataSourceRender, error)

func (Metadata) NewEphemeralRender

func (metadata Metadata) NewEphemeralRender(ephemeralType string, opt *EphemeralRenderOption) (*EphemeralRender, error)

func (Metadata) NewFunctionRender

func (metadata Metadata) NewFunctionRender(functionName string, opt *FunctionRenderOption) (*FunctionRender, error)

func (Metadata) NewListRender

func (metadata Metadata) NewListRender(listType string, opt *ListRenderOption) (*ListRender, error)

func (Metadata) NewProviderRender

func (metadata Metadata) NewProviderRender(opt *ProviderRenderOption) (*ProviderRender, error)

func (Metadata) NewResourceRender

func (metadata Metadata) NewResourceRender(resourceType string, opt *ResourceRenderOption) (*ResourceRender, error)

type NestedField

type NestedField struct {
	// contains filtered or unexported fields
}

func (NestedField) Fields

func (r NestedField) Fields() Fields

func (NestedField) PlanModifiers

func (r NestedField) PlanModifiers() []string

func (NestedField) Validators

func (r NestedField) Validators() []string

type NestedFields

type NestedFields map[string]NestedField

func (NestedFields) Lint added in v0.2.0

func (fields NestedFields) Lint() error

type Object

type Object struct {
	// contains filtered or unexported fields
}

type ObjectField

type ObjectField struct {
	// contains filtered or unexported fields
}

func (ObjectField) ToField

func (obj ObjectField) ToField(rootField Field) Field

func (ObjectField) ToFunctionField

func (obj ObjectField) ToFunctionField() FunctionField

type Objects

type Objects map[string]Object

func (Objects) ToFunctionObjects

func (objs Objects) ToFunctionObjects() FunctionObjects

func (Objects) ToNestedFields

func (objs Objects) ToNestedFields(rootField Field) NestedFields

type ProviderMetadata

type ProviderMetadata struct {
	Schema ProviderSchema

	RenderOption *ProviderRenderOption
}

type ProviderRender

type ProviderRender struct {
	Template    *template.Template
	Header      string
	Description string
	Example     string
	Schema      string
}

func (ProviderRender) Execute

func (render ProviderRender) Execute(w io.Writer) error

type ProviderRenderOption

type ProviderRenderOption struct {
	Examples []Example

	// A custom template that overrides the default template:
	//
	// {{ .Header }}
	// {{ .Description }}
	// {{- with .Example }}
	// {{ . }}
	// {{- end }}
	// {{ .Schema }}
	Template *template.Template
}

type ProviderSchema

type ProviderSchema struct {
	Description string
	Deprecation string

	Fields Fields

	// Including nested attribute object or block object.
	Nested NestedFields
}

func NewProviderSchema

func NewProviderSchema(ctx context.Context, sch schema.Schema) (schema ProviderSchema, diags diag.Diagnostics)

type ProviderWithRenderOption

type ProviderWithRenderOption interface {
	provider.Provider
	RenderOption() ProviderRenderOption
}

type ResourceIdentityField

type ResourceIdentityField struct {
	Name     string
	DataType DataType

	Required bool
	Optional bool

	Description string
	// contains filtered or unexported fields
}

func (ResourceIdentityField) CustomTypeDescription

func (field ResourceIdentityField) CustomTypeDescription() string

func (ResourceIdentityField) Traits

func (field ResourceIdentityField) Traits() string

type ResourceIdentityFields

type ResourceIdentityFields map[string]ResourceIdentityField

func (ResourceIdentityFields) Lint added in v0.2.0

func (fields ResourceIdentityFields) Lint() error

func (ResourceIdentityFields) OptionalFields

func (fields ResourceIdentityFields) OptionalFields() []ResourceIdentityField

func (ResourceIdentityFields) RequiredFields

func (fields ResourceIdentityFields) RequiredFields() []ResourceIdentityField

type ResourceIdentitySchema

type ResourceIdentitySchema struct {
	Fields ResourceIdentityFields
}

func NewResourceIdentitySchema

func NewResourceIdentitySchema(ctx context.Context, sch identityschema.Schema) (schema ResourceIdentitySchema, diags diag.Diagnostics)

type ResourceMetadata

type ResourceMetadata struct {
	Schema   ResourceSchema
	Identity *ResourceIdentitySchema

	RenderOption *ResourceRenderOption
}

type ResourceMetadatas

type ResourceMetadatas map[string]ResourceMetadata

type ResourceRender

type ResourceRender struct {
	Template    *template.Template
	Header      string
	Description string
	Example     string
	Schema      string
	Import      string
}

func (ResourceRender) Execute

func (render ResourceRender) Execute(w io.Writer) error

type ResourceRenderOption

type ResourceRenderOption struct {
	// The subcategory of the document.
	Subcategory string
	Examples    []Example

	// The information about import by id (including via command and via import block).
	ImportId *ImportId
	// The examples for importing by identity via import block.
	IdentityExamples []Example

	// A custom template that overrides the default template:
	//
	// {{ .Header }}
	// {{ .Description }}
	// {{- with .Example }}
	// {{ . }}
	// {{- end }}
	// {{ .Schema }}
	// {{- with .Import }}
	// {{ . }}
	// {{- end }}
	Template *template.Template
}

type ResourceSchema

type ResourceSchema struct {
	Description string
	Deprecation string

	Fields Fields

	// Including nested attribute object or block object.
	Nested NestedFields
}

func NewResourceSchema

func NewResourceSchema(ctx context.Context, sch schema.Schema) (schema ResourceSchema, diags diag.Diagnostics)

type ResourceWithRenderOption

type ResourceWithRenderOption interface {
	resource.Resource
	RenderOption() ResourceRenderOption
}

Jump to

Keyboard shortcuts

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