resource

package
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 14 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsResourceTypeSupported

func IsResourceTypeSupported(ty string) bool

Types

type AttributeSchema

type AttributeSchema struct {
	ConfigSchema configschema.Attribute
	JsonString   bool
}

type Attributes

type Attributes map[string]interface{}

func (*Attributes) Copy

func (a *Attributes) Copy() *Attributes

func (*Attributes) DeleteIfDefault

func (a *Attributes) DeleteIfDefault(path string)

func (*Attributes) Get

func (a *Attributes) Get(path string) (interface{}, bool)

func (*Attributes) GetBool

func (a *Attributes) GetBool(path string) *bool

func (*Attributes) GetFloat64

func (a *Attributes) GetFloat64(path string) *float64

func (*Attributes) GetInt

func (a *Attributes) GetInt(path string) *int

func (*Attributes) GetMap

func (a *Attributes) GetMap(path string) map[string]interface{}

func (*Attributes) GetSlice

func (a *Attributes) GetSlice(path string) []interface{}

func (*Attributes) GetString

func (a *Attributes) GetString(path string) *string

func (*Attributes) SafeDelete

func (a *Attributes) SafeDelete(path []string)

func (*Attributes) SafeSet

func (a *Attributes) SafeSet(path []string, value interface{}) error

func (*Attributes) SanitizeDefaults

func (a *Attributes) SanitizeDefaults()

type Deserializer

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

func NewDeserializer

func NewDeserializer(factory ResourceFactory) *Deserializer

func (*Deserializer) Deserialize

func (s *Deserializer) Deserialize(ty string, rawList []cty.Value) ([]*Resource, error)

func (*Deserializer) DeserializeOne

func (s *Deserializer) DeserializeOne(ty string, value cty.Value) (*Resource, error)

type Flags

type Flags uint32
const (
	FlagDeepMode Flags = 1 << iota
)

func (*Flags) AddFlag

func (f *Flags) AddFlag(flag Flags)

func (Flags) HasFlag

func (f Flags) HasFlag(flag Flags) bool

type MockSupplier

type MockSupplier struct {
	mock.Mock
}

MockSupplier is an autogenerated mock type for the Supplier type

func (*MockSupplier) Resources

func (_m *MockSupplier) Resources() ([]*Resource, error)

Resources provides a mock function with given fields:

type NormalizedResource

type NormalizedResource interface {
	NormalizeForState() (Resource, error)
	NormalizeForProvider() (Resource, error)
}

type Resource

type Resource struct {
	Id     string
	Type   string
	Attrs  *Attributes
	Sch    *Schema `json:"-" diff:"-"`
	Source Source  `json:"-"`
}

func Sort

func Sort(res []*Resource) []*Resource

func (*Resource) Attributes

func (r *Resource) Attributes() *Attributes

func (*Resource) Equal

func (r *Resource) Equal(res *Resource) bool

func (*Resource) ResourceId

func (r *Resource) ResourceId() string

func (*Resource) ResourceType

func (r *Resource) ResourceType() string

func (*Resource) Schema

func (r *Resource) Schema() *Schema

func (*Resource) SourceString

func (r *Resource) SourceString() string

func (*Resource) Src

func (r *Resource) Src() Source

type ResourceFactory

type ResourceFactory interface {
	CreateAbstractResource(ty, id string, data map[string]interface{}) *Resource
}

type ResourceType

type ResourceType string

func (ResourceType) String

func (ty ResourceType) String() string

type ResourceTypeMeta

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

func GetMeta

func GetMeta(ty ResourceType) ResourceTypeMeta

func (ResourceTypeMeta) GetChildrenTypes

func (ty ResourceTypeMeta) GetChildrenTypes() []ResourceType

type Schema

type Schema struct {
	ProviderVersion             *version.Version
	Flags                       Flags
	SchemaVersion               int64
	Attributes                  map[string]AttributeSchema
	NormalizeFunc               func(res *Resource)
	HumanReadableAttributesFunc func(res *Resource) map[string]string
	ResolveReadAttributesFunc   func(res *Resource) map[string]string
	DiscriminantFunc            func(*Resource, *Resource) bool
}

func (*Schema) IsComputedField

func (s *Schema) IsComputedField(path []string) bool

func (*Schema) IsJsonStringField

func (s *Schema) IsJsonStringField(path []string) bool

type SchemaRepository

type SchemaRepository struct {
	ProviderName    string
	ProviderVersion *version.Version
	// contains filtered or unexported fields
}

func NewSchemaRepository

func NewSchemaRepository() *SchemaRepository

func (*SchemaRepository) GetSchema

func (r *SchemaRepository) GetSchema(resourceType string) (*Schema, bool)

func (*SchemaRepository) Init

func (r *SchemaRepository) Init(providerName, providerVersion string, schema map[string]providers.Schema) error

func (*SchemaRepository) SetDiscriminantFunc

func (r *SchemaRepository) SetDiscriminantFunc(typ string, fn func(self, res *Resource) bool)

func (SchemaRepository) SetFlags

func (r SchemaRepository) SetFlags(typ string, flags ...Flags)

func (*SchemaRepository) SetHumanReadableAttributesFunc

func (r *SchemaRepository) SetHumanReadableAttributesFunc(typ string, humanReadableAttributesFunc func(res *Resource) map[string]string)

func (*SchemaRepository) SetNormalizeFunc

func (r *SchemaRepository) SetNormalizeFunc(typ string, normalizeFunc func(res *Resource))

func (*SchemaRepository) SetResolveReadAttributesFunc

func (r *SchemaRepository) SetResolveReadAttributesFunc(typ string, resolveReadAttributesFunc func(res *Resource) map[string]string)

func (*SchemaRepository) UpdateSchema

func (r *SchemaRepository) UpdateSchema(typ string, schemasMutators map[string]func(attributeSchema *AttributeSchema))

type SchemaRepositoryInterface

type SchemaRepositoryInterface interface {
	GetSchema(resourceType string) (*Schema, bool)
	SetFlags(typ string, flags ...Flags)
	UpdateSchema(typ string, schemasMutators map[string]func(attributeSchema *AttributeSchema))
	SetNormalizeFunc(typ string, normalizeFunc func(res *Resource))
	SetHumanReadableAttributesFunc(typ string, humanReadableAttributesFunc func(res *Resource) map[string]string)
	SetResolveReadAttributesFunc(typ string, resolveReadAttributesFunc func(res *Resource) map[string]string)
	SetDiscriminantFunc(string, func(*Resource, *Resource) bool)
}

type SerializableResource

type SerializableResource struct {
	Id     string              `json:"id"`
	Type   string              `json:"type"`
	Source *SerializableSource `json:"source,omitempty"`
}

func NewSerializableResource

func NewSerializableResource(res *Resource) *SerializableResource

type SerializableSource

type SerializableSource struct {
	S    string `json:"source"`
	Ns   string `json:"namespace"`
	Name string `json:"internal_name"`
}

type Source

type Source interface {
	Source() string
	Namespace() string
	InternalName() string
}

type StoppableSupplier

type StoppableSupplier interface {
	Supplier
	Stop()
}

type Supplier

type Supplier interface {
	Resources() ([]*Resource, error)
}

Resource Supplier supply the list of resource.Resource, its the front to retrieve remote resources

type TerraformStateSource

type TerraformStateSource struct {
	State  string
	Module string
	Name   string
}

func NewTerraformStateSource

func NewTerraformStateSource(state, module, name string) *TerraformStateSource

func (*TerraformStateSource) InternalName

func (s *TerraformStateSource) InternalName() string

func (*TerraformStateSource) Namespace

func (s *TerraformStateSource) Namespace() string

func (*TerraformStateSource) Source

func (s *TerraformStateSource) Source() string

Directories

Path Synopsis
GENERATED, DO NOT EDIT THIS FILE GENERATED, DO NOT EDIT THIS FILE GENERATED, DO NOT EDIT THIS FILE GENERATED, DO NOT EDIT THIS FILE
GENERATED, DO NOT EDIT THIS FILE GENERATED, DO NOT EDIT THIS FILE GENERATED, DO NOT EDIT THIS FILE GENERATED, DO NOT EDIT THIS FILE

Jump to

Keyboard shortcuts

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