schema

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package tfschema defines the schemas of all the resources and data sources of the CloudSecure Terraform provider, which form the Illumio CloudSecure Config API.

Index

Constants

View Source
const (
	// IDFieldName is the name of the "id" attribute/field that is used to identify any Illumio CloudSecure resource or data source.
	IDFieldName = "id"

	// UpdateMaskFieldName is the name of the "update_mask" field used in resource update requests to list the fields modified by the operation.
	UpdateMaskFieldName = "update_mask"
)

Variables

View Source
var (

	// IDAttributeMode is the mode of "id" attributes.
	IDAttributeMode = AttributeMode{
		InCreateResponse: true,
		InReadRequest:    true,
		InReadResponse:   true,
		InUpdateRequest:  true,
		InUpdateResponse: true,
		InDeleteRequest:  true,
	}

	// ReadWriteAttributeMode is the mode of read-write attributes. This is the default mode.
	ReadWriteAttributeMode = AttributeMode{
		InCreateRequest:  true,
		InCreateResponse: true,
		InReadResponse:   true,
		InUpdateRequest:  true,
		InUpdateResponse: true,
	}

	// ImmutableAttributeMode is the mode of immutable attributes, which can be set only at creation and can be read afterwards.
	// Attributes with this mode should also have the RequiresReplace plan modifier.
	ImmutableAttributeMode = AttributeMode{
		InCreateRequest:  true,
		InCreateResponse: true,
		InReadResponse:   true,
		InUpdateResponse: true,
	}

	// ReadOnlyAttributeMode is the mode of read-only attributes, which are returned by every create, read, and update operation.
	ReadOnlyAttributeMode = AttributeMode{
		InCreateResponse: true,
		InReadResponse:   true,
		InUpdateResponse: true,
	}

	// ReadOnlyOnceAttributeMode is the mode of read-only-once attributes, which are returned only by create operations.
	// Attributes with this mode should also have the UseStateForUnknown plan modifier.
	ReadOnlyOnceAttributeMode = AttributeMode{
		InCreateResponse: true,
	}

	// WriteOnlyAttributeMode is the mode of write-only attributes, which are sent in every create and update operation, and never in any response.
	// Attribute with this mode should also have the UseStateForUnknown plan modifier.
	WriteOnlyAttributeMode = AttributeMode{
		InCreateRequest: true,
		InUpdateRequest: true,
	}

	// WriteOnlyOnceAttributeMode is the mode of write-only-once attributes, which are sent in only in create operations.
	// Attribute with this mode should also have the UseStateForUnknown plan modifier.
	WriteOnlyOnceAttributeMode = AttributeMode{
		InCreateRequest: true,
	}
)

Functions

func AttributeIsOptional

func AttributeIsOptional(attribute any) bool

AttributeIsOptional returns whether an attribute should be optional in gRPC messages, i.e., whether it is optional with no default value.

func ProtoMessageName

func ProtoMessageName(tfName string) string

ProtoMessageName converts a Terraform resource, data source, or field name (in snake_case) into a ProtocolBuffer message name (in UpperCamelCase).

func ProtoMessageNameForCreateRequest

func ProtoMessageNameForCreateRequest(camelCaseResourcename string) string

ProtoMessageNameForCreateRequest returns the name of the Protocol Buffer message for create requests for the given CamelCased resource name.

func ProtoMessageNameForCreateResponse

func ProtoMessageNameForCreateResponse(camelCaseResourcename string) string

ProtoMessageNameForCreatResponse returns the name of the Protocol Buffer message for create responses for the given CamelCased resource name.

func ProtoMessageNameForDeleteRequest

func ProtoMessageNameForDeleteRequest(camelCaseResourcename string) string

ProtoMessageNameForDeleteRequest returns the name of the Protocol Buffer message for delete requests for the given CamelCased resource name.

func ProtoMessageNameForReadRequest

func ProtoMessageNameForReadRequest(camelCaseResourcename string) string

ProtoMessageNameForReadRequest returns the name of the Protocol Buffer message for read requests for the given CamelCased resource name.

func ProtoMessageNameForReadResponse

func ProtoMessageNameForReadResponse(camelCaseResourcename string) string

ProtoMessageNameForReadResponse returns the name of the Protocol Buffer message for read responses for the given CamelCased resource name.

func ProtoMessageNameForUpdateRequest

func ProtoMessageNameForUpdateRequest(camelCaseResourcename string) string

ProtoMessageNameForUpdateRequest returns the name of the Protocol Buffer message for update requests for the given CamelCased resource name.

func ProtoMessageNameForUpdateResponse

func ProtoMessageNameForUpdateResponse(camelCaseResourcename string) string

ProtoMessageNameForUpdateResponse returns the name of the Protocol Buffer message for update responses for the given CamelCased resource name.

func RPCNameForCreate

func RPCNameForCreate(camelCaseResourcename string) string

RPCNameForCreate returns the name of the gRPC RPC used to create resources with the given CamelCased resource name.

func RPCNameForDelete

func RPCNameForDelete(camelCaseResourcename string) string

RPCNameForDelete returns the name of the gRPC RPC used to delete resources with the given CamelCased resource name.

func RPCNameForRead

func RPCNameForRead(camelCaseResourcename string) string

RPCNameForRead returns the name of the gRPC RPC used to read resources with the given CamelCased resource name.

func RPCNameForUpdate

func RPCNameForUpdate(camelCaseResourcename string) string

RPCNameForUpdate returns the name of the gRPC RPC used to update resources with the given CamelCased resource name.

func SortDataSourceAttributes

func SortDataSourceAttributes(attrs map[string]datasource_schema.Attribute) []string

SortDataSourceAttributes returns the sorted names of a set of data source attributes.

func SortResourceAttributes

func SortResourceAttributes(attrs map[string]resource_schema.Attribute) []string

SortResourceAttributes returns the sorted names of a set of resource attributes.

Types

type AttributeMode

type AttributeMode struct {
	// InCreateRequest is true if the attribute should be included in create RPC request messages.
	InCreateRequest bool

	// InCreateResponse is true if the attribute should be included in create RPC response messages.
	InCreateResponse bool

	// InReadRequest is true if the attribute should be included in read RPC request messages.
	InReadRequest bool

	// InCreateRequest is true if the attribute should be included in read RPC response messages.
	InReadResponse bool

	// InUpdateRequest is true if the attribute should be included in update RPC request messages.
	InUpdateRequest bool

	// InUpdateResponse is true if the attribute should be included in update RPC response messages.
	InUpdateResponse bool

	// InDeleteRequest is true if the attribute should be included in delete RPC request messages.
	InDeleteRequest bool
}

AttributeMode is the mode of a resource attribute, as the set of RPC messages it should be included in.

func GetResourceAttributeMode

func GetResourceAttributeMode(attrSchema resource_schema.Attribute) AttributeMode

GetResourceAttributeMode returns the mode for a resource attribute.

type AttributeWithMode

type AttributeWithMode interface {
	// GetMode() returns the mode of the attribute.
	GetMode() AttributeMode
}

AttributeWithMode provides the mode of an attribute.

type BoolResourceAttributeWithMode

type BoolResourceAttributeWithMode struct {
	resource_schema.BoolAttribute
	// contains filtered or unexported fields
}

BoolResourceAttributeWithMode is a BoolAttribute with an explicit attribute mode.

func (BoolResourceAttributeWithMode) GetMode

func (a BoolResourceAttributeWithMode) GetMode() AttributeMode

type DataSource

type DataSource struct {
	// TypeName is the name of this data source type.
	TypeName string

	// Schema is the schema of this data source type.
	Schema datasource_schema.Schema
}

DataSource is the complete definition of a data source type.

type DataSources

type DataSources []DataSource

Resources is a list of Resource elements. The TypeName of each Resource must be unique.

func (DataSources) Len

func (r DataSources) Len() int

func (DataSources) Less

func (r DataSources) Less(i, j int) bool

func (DataSources) Swap

func (r DataSources) Swap(i, j int)

type Float32ResourceAttributeWithMode

type Float32ResourceAttributeWithMode struct {
	resource_schema.Float32Attribute
	// contains filtered or unexported fields
}

Float32ResourceAttributeWithMode is a Float32Attribute with an explicit attribute mode.

func (Float32ResourceAttributeWithMode) GetMode

func (a Float32ResourceAttributeWithMode) GetMode() AttributeMode

type Float64ResourceAttributeWithMode

type Float64ResourceAttributeWithMode struct {
	resource_schema.Float64Attribute
	// contains filtered or unexported fields
}

Float64ResourceAttributeWithMode is a Float64Attribute with an explicit attribute mode.

func (Float64ResourceAttributeWithMode) GetMode

func (a Float64ResourceAttributeWithMode) GetMode() AttributeMode

type Int32ResourceAttributeWithMode

type Int32ResourceAttributeWithMode struct {
	resource_schema.Int32Attribute
	// contains filtered or unexported fields
}

Int32ResourceAttributeWithMode is a Int32Attribute with an explicit attribute mode.

func (Int32ResourceAttributeWithMode) GetMode

func (a Int32ResourceAttributeWithMode) GetMode() AttributeMode

type Int64ResourceAttributeWithMode

type Int64ResourceAttributeWithMode struct {
	resource_schema.Int64Attribute
	// contains filtered or unexported fields
}

Int64ResourceAttributeWithMode is a Int64Attribute with an explicit attribute mode.

func (Int64ResourceAttributeWithMode) GetMode

func (a Int64ResourceAttributeWithMode) GetMode() AttributeMode

type ListResourceAttributeWithMode

type ListResourceAttributeWithMode struct {
	resource_schema.ListAttribute
	// contains filtered or unexported fields
}

ListResourceAttributeWithMode is a ListAttribute with an explicit attribute mode.

func (ListResourceAttributeWithMode) GetMode

func (a ListResourceAttributeWithMode) GetMode() AttributeMode

type MapResourceAttributeWithMode

type MapResourceAttributeWithMode struct {
	resource_schema.MapAttribute
	// contains filtered or unexported fields
}

MapResourceAttributeWithMode is a MapAttribute with an explicit attribute mode.

func (MapResourceAttributeWithMode) GetMode

func (a MapResourceAttributeWithMode) GetMode() AttributeMode

type NumberResourceAttributeWithMode

type NumberResourceAttributeWithMode struct {
	resource_schema.NumberAttribute
	// contains filtered or unexported fields
}

NumberResourceAttributeWithMode is a NumberAttribute with an explicit attribute mode.

func (NumberResourceAttributeWithMode) GetMode

func (a NumberResourceAttributeWithMode) GetMode() AttributeMode

type ObjectResourceAttributeWithMode

type ObjectResourceAttributeWithMode struct {
	resource_schema.ObjectAttribute
	// contains filtered or unexported fields
}

ObjectResourceAttributeWithMode is a ObjectAttribute with an explicit attribute mode.

func (ObjectResourceAttributeWithMode) GetMode

func (a ObjectResourceAttributeWithMode) GetMode() AttributeMode

type Resource

type Resource struct {
	// TypeName is the name of this resource type.
	TypeName string

	// Schema is the schema of this resource type.
	Schema resource_schema.Schema
}

Resource is the complete definition of a resource type.

type Resources

type Resources []Resource

Resources is a list of Resource elements. The TypeName of each Resource must be unique.

func (Resources) Len

func (r Resources) Len() int

func (Resources) Less

func (r Resources) Less(i, j int) bool

func (Resources) Swap

func (r Resources) Swap(i, j int)

type Schema

type Schema interface {
	// Version returns the version of this schema: "v1", "v2", etc.
	// The version must be incremented whenever the schema is modified in a backward-incompatible manner, i.e. when
	// a resource, datasource, or attribute is deleted,
	// an optional attribute is modified to be required,
	// when a required attribute is added to an existing resource,
	// or when the type of an existing attribute is modified.
	Version() string

	// Resources returns the list of resources provided by the provider sorted by TypeName.
	Resources() Resources

	// DataSources returns the list of data sources provided by the provider sorted by TypeName.
	DataSources() DataSources
}

Schema contains the definitions of all the resources and data sources provided by a provider.

func CloudSecure

func CloudSecure() Schema

CloudSecure returns the schemas of CloudSecure resources and data sources.

type SetResourceAttributeWithMode

type SetResourceAttributeWithMode struct {
	resource_schema.SetAttribute
	// contains filtered or unexported fields
}

SetResourceAttributeWithMode is a SetAttribute with an explicit attribute mode.

func (SetResourceAttributeWithMode) GetMode

func (a SetResourceAttributeWithMode) GetMode() AttributeMode

type StringResourceAttributeWithMode

type StringResourceAttributeWithMode struct {
	resource_schema.StringAttribute
	// contains filtered or unexported fields
}

StringResourceAttributeWithMode is a StringAttribute with an explicit attribute mode.

func (StringResourceAttributeWithMode) GetMode

func (a StringResourceAttributeWithMode) GetMode() AttributeMode

Jump to

Keyboard shortcuts

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