pb

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MustBe_name = map[int32]string{
		0: "Computed",
		1: "Optional",
		2: "OptionalAndComputed",
		3: "Required",
	}
	MustBe_value = map[string]int32{
		"Computed":            0,
		"Optional":            1,
		"OptionalAndComputed": 2,
		"Required":            3,
	}
)

Enum value maps for MustBe.

View Source
var (
	// define provider for this package, should be set only once per package.
	//
	// optional gotf.Provider provider = 82848;
	E_Provider = &file_gotf_proto_extTypes[0]
	// define this message as a resource
	//
	// optional gotf.Block resource = 82849;
	E_Resource = &file_gotf_proto_extTypes[1]
	// define this message as a datasource
	//
	// optional gotf.Block datasource = 82850;
	E_Datasource = &file_gotf_proto_extTypes[2]
)

Extension fields to descriptorpb.MessageOptions.

View Source
var (
	// define this field's terraform attribute on this resource and/ or datasource.
	//
	// optional gotf.Attribute attribute = 82851;
	E_Attribute = &file_gotf_proto_extTypes[3]
)

Extension fields to descriptorpb.FieldOptions.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {

	// skip this field from from this terraform block.
	Skip bool `protobuf:"varint,1,opt,name=skip,proto3" json:"skip,omitempty"`
	// attribute must_be computed, optional, required or optional and computed.
	//
	// If attribute is optional and `optional` keyword is not set on the fields gotf
	// will try to generate default for field such as
	//
	//	string -> ""
	//	int32 -> 0
	//	int64 -> 0
	//	float -> 0.0
	//	bool -> false
	//
	// If you want to receive nil value set `optional` keyword on field.
	MustBe MustBe `protobuf:"varint,2,opt,name=must_be,json=mustBe,proto3,enum=gotf.MustBe" json:"must_be,omitempty"`
	// name of terraform attribute, check [attribute-names] documentation for more details.
	// defaults to snake_case of message field name.
	//
	// [attribute-names]: https://developer.hashicorp.com/terraform/plugin/best-practices/naming#attribute-names
	Name *string `protobuf:"bytes,3,opt,name=name,proto3,oneof" json:"name,omitempty"`
	// sensitive if set to true field will be marked as sensitive.
	Sensitive *bool `protobuf:"varint,4,opt,name=sensitive,proto3,oneof" json:"sensitive,omitempty"`
	// description is used to set terraform attribute's description. Defaults to
	// field comment.
	Description *string `protobuf:"bytes,5,opt,name=description,proto3,oneof" json:"description,omitempty"`
	// md_description is used to set terraform attribute's markdown description of
	// field. Defaults to field comment.
	MdDescription *string `protobuf:"bytes,6,opt,name=md_description,json=mdDescription,proto3,oneof" json:"md_description,omitempty"`
	// deprecation is used to set terraform attribute's deprecation message.
	Deprecation *string `protobuf:"bytes,7,opt,name=deprecation,proto3,oneof" json:"deprecation,omitempty"`
	// contains filtered or unexported fields
}

Attribute to set kind properties of terraform attribute & schema for terraform block.

func (*Attribute) Descriptor deprecated

func (*Attribute) Descriptor() ([]byte, []int)

Deprecated: Use Attribute.ProtoReflect.Descriptor instead.

func (*Attribute) GetDeprecation

func (x *Attribute) GetDeprecation() string

func (*Attribute) GetDescription

func (x *Attribute) GetDescription() string

func (*Attribute) GetMdDescription

func (x *Attribute) GetMdDescription() string

func (*Attribute) GetMustBe

func (x *Attribute) GetMustBe() MustBe

func (*Attribute) GetName

func (x *Attribute) GetName() string

func (*Attribute) GetSensitive

func (x *Attribute) GetSensitive() bool

func (*Attribute) GetSkip

func (x *Attribute) GetSkip() bool

func (*Attribute) ProtoMessage

func (*Attribute) ProtoMessage()

func (*Attribute) ProtoReflect

func (x *Attribute) ProtoReflect() protoreflect.Message

func (*Attribute) Reset

func (x *Attribute) Reset()

func (*Attribute) String

func (x *Attribute) String() string

type Block

type Block struct {

	// name for terraform resource or datasource, defaults to message name.
	// defaults to snake_case of message name.
	Name *string `protobuf:"bytes,1,opt,name=name,proto3,oneof" json:"name,omitempty"`
	// explicit_fields if set to `false` (default), all fields will be generated as
	// attributes in this terraform block.
	//
	// If set to `true`, only fields with `gotf.Attribute` will be generated
	// as an attributes in this terraform block.
	//
	// Check gotf.Attribute for default attribute properties.
	ExplicitFields bool `protobuf:"varint,2,opt,name=explicit_fields,json=explicitFields,proto3" json:"explicit_fields,omitempty"`
	// client (names) used by this block. Generated terraform go code expects these
	// clients to be generated by grpc in same go_package as other protobufs.
	// Should be complete go type name
	//
	// This calls exec with `Set<ClientName>(client)`
	// The provider exec needs to implement github.com/travix/gotf/prvdr.CanConfigureGrpc interface.
	Client []string `protobuf:"bytes,3,rep,name=client,proto3" json:"client,omitempty"`
	// description is used to set terraform block's description.
	Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
	// contains filtered or unexported fields
}

Block allows to generate terraform resource or datasource from proto message

func (*Block) Descriptor deprecated

func (*Block) Descriptor() ([]byte, []int)

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetClient

func (x *Block) GetClient() []string

func (*Block) GetDescription

func (x *Block) GetDescription() string

func (*Block) GetExplicitFields

func (x *Block) GetExplicitFields() bool

func (*Block) GetName

func (x *Block) GetName() string

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

type GoIdentity

type GoIdentity struct {

	// name of the user defined go type.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// import_path (go mod name) of the user defined go type.
	// defaults to current proto files go_package name.
	ImportPath string `protobuf:"bytes,2,opt,name=import_path,json=importPath,proto3" json:"import_path,omitempty"`
	// if set to true, this type will be generated as pointer type.
	// *should not be set for interfaces.*
	Ptr bool `protobuf:"varint,3,opt,name=ptr,proto3" json:"ptr,omitempty"`
	// contains filtered or unexported fields
}

GoIdentity to indicate user defined go types such as structs, interfaces, etc. for terraform provider and block attribute type.

func (*GoIdentity) Descriptor deprecated

func (*GoIdentity) Descriptor() ([]byte, []int)

Deprecated: Use GoIdentity.ProtoReflect.Descriptor instead.

func (*GoIdentity) GetImportPath

func (x *GoIdentity) GetImportPath() string

func (*GoIdentity) GetName

func (x *GoIdentity) GetName() string

func (*GoIdentity) GetPtr

func (x *GoIdentity) GetPtr() bool

func (*GoIdentity) ProtoMessage

func (*GoIdentity) ProtoMessage()

func (*GoIdentity) ProtoReflect

func (x *GoIdentity) ProtoReflect() protoreflect.Message

func (*GoIdentity) Reset

func (x *GoIdentity) Reset()

func (*GoIdentity) String

func (x *GoIdentity) String() string

type MustBe

type MustBe int32

Must is used to set terraform block attribute's required, optional or computed values

const (
	MustBe_Computed            MustBe = 0 // field will be computed by provider, user can't set it in terraform script (default).
	MustBe_Optional            MustBe = 1 // field is optional, user can set it in terraform script.
	MustBe_OptionalAndComputed MustBe = 2 // field is optional, but will be computed or overriden by provider.
	MustBe_Required            MustBe = 3 // field is required, user must set it in terraform script.
)

func (MustBe) Descriptor

func (MustBe) Descriptor() protoreflect.EnumDescriptor

func (MustBe) Enum

func (x MustBe) Enum() *MustBe

func (MustBe) EnumDescriptor deprecated

func (MustBe) EnumDescriptor() ([]byte, []int)

Deprecated: Use MustBe.Descriptor instead.

func (MustBe) Number

func (x MustBe) Number() protoreflect.EnumNumber

func (MustBe) String

func (x MustBe) String() string

func (MustBe) Type

func (MustBe) Type() protoreflect.EnumType

type Provider

type Provider struct {

	// name is used to set terraform provider type name, all resources and datasources
	// will be generated under this provider.
	//
	// Example:
	//
	//	name = "xyz";
	//
	// This will produce terraform blocks will be
	//
	//	resource "xyz_resource_name" { ... }
	//	data "xyz_datasource_name" { ... }
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// package where generated terraform go code should be placed
	//
	// If not set files will be placed in providerpb package.
	ProviderPackage string `protobuf:"bytes,2,opt,name=provider_package,json=providerPackage,proto3" json:"provider_package,omitempty"`
	// description is used to set terraform provider's description.
	Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	// exec_package use generate go scaffold for executors.
	// if this option is set, gotf will generate scaffold for block executors.
	// if the file already exists, it will be skipped.
	// it should not be same as provider_package.
	ExecPackage *string `protobuf:"bytes,4,opt,name=exec_package,json=execPackage,proto3,oneof" json:"exec_package,omitempty"`
	// contains filtered or unexported fields
}

Option to create provider for this package.

func (*Provider) Descriptor deprecated

func (*Provider) Descriptor() ([]byte, []int)

Deprecated: Use Provider.ProtoReflect.Descriptor instead.

func (*Provider) GetDescription

func (x *Provider) GetDescription() string

func (*Provider) GetExecPackage added in v0.3.0

func (x *Provider) GetExecPackage() string

func (*Provider) GetName

func (x *Provider) GetName() string

func (*Provider) GetProviderPackage

func (x *Provider) GetProviderPackage() string

func (*Provider) ProtoMessage

func (*Provider) ProtoMessage()

func (*Provider) ProtoReflect

func (x *Provider) ProtoReflect() protoreflect.Message

func (*Provider) Reset

func (x *Provider) Reset()

func (*Provider) String

func (x *Provider) String() string

Jump to

Keyboard shortcuts

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