resources

package
v0.1.37 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get added in v0.1.18

func Get[T Resource](dependentResourceId string, resources *Resources, id string) (T, error)

Get finds the resource with the given id and adds a dependency between dependentResourceId and id.

func GetAllResources

func GetAllResources[T Resource](ctx MultyContext) []T

func GetAllResourcesWithListRef added in v0.1.18

func GetAllResourcesWithListRef[T Resource, T2 Resource](ctx MultyContext, refGetter func(T) []T2, ref T2) []T

func GetAllResourcesWithRef added in v0.1.18

func GetAllResourcesWithRef[T Resource, T2 Resource](ctx MultyContext, refGetter func(T) T2, ref T2) []T

func GetCloudSpecificResourceId

func GetCloudSpecificResourceId(r Resource, cloud commonpb.CloudProvider) string

func GetMainOutputId

func GetMainOutputId(r Resource) (string, error)

func GetMainOutputRef added in v0.1.16

func GetMainOutputRef(r Resource) (string, error)

func GetOptional added in v0.1.18

func GetOptional[T Resource](dependentResourceId string, resources *Resources, id string) (T, bool, error)

func GetResourceIdForCloud

func GetResourceIdForCloud(resourceId string, cloud commonpb.CloudProvider) string

Types

type ChildResourceWithId added in v0.1.15

type ChildResourceWithId[ParentT Resource, ChildT WithChildCommonParams] struct {
	ResourceId string
	Args       ChildT
	Parent     ParentT
}

func (*ChildResourceWithId[A, B]) GetCloud added in v0.1.15

func (r *ChildResourceWithId[A, B]) GetCloud() commonpb.CloudProvider

func (*ChildResourceWithId[A, B]) GetCloudSpecificLocation added in v0.1.15

func (r *ChildResourceWithId[A, B]) GetCloudSpecificLocation() string

func (*ChildResourceWithId[A, B]) GetCommonArgs added in v0.1.30

func (r *ChildResourceWithId[A, B]) GetCommonArgs() any

func (ChildResourceWithId[A, B]) GetResourceId added in v0.1.15

func (r ChildResourceWithId[A, B]) GetResourceId() string

func (ChildResourceWithId[A, B]) NewValidationError added in v0.1.15

func (r ChildResourceWithId[A, B]) NewValidationError(err error, field string) validate.ValidationError

type CloudSpecificResource

type CloudSpecificResource struct {
	Cloud             commonpb.CloudProvider
	Resource          Resource
	ImplicitlyCreated bool
}

func (*CloudSpecificResource) GetLocation

func (c *CloudSpecificResource) GetLocation(ctx MultyContext) string

func (*CloudSpecificResource) GetMainOutputId

func (c *CloudSpecificResource) GetMainOutputId() (string, error)

func (*CloudSpecificResource) GetResourceId

func (c *CloudSpecificResource) GetResourceId() string

func (*CloudSpecificResource) Translate

func (c *CloudSpecificResource) Translate(ctx MultyContext) ([]output.TfBlock, error)

type ExportFunc added in v0.1.36

type ExportFunc[T proto.Message, R Resource] func(R, *Resources) (T, bool, error)

type ImportFunc added in v0.1.36

type ImportFunc[T proto.Message, O Resource] func(string, T, *Resources) (O, error)

type MultyConfig added in v0.1.36

type MultyConfig struct {
	Resources *Resources
	// contains filtered or unexported fields
}

func LoadConfig added in v0.1.36

func LoadConfig(c *configpb.Config, metadatas map[proto.Message]ResourceMetadataInterface) (*MultyConfig, error)

func (*MultyConfig) CreateResource added in v0.1.36

func (c *MultyConfig) CreateResource(args proto.Message) (Resource, error)

func (*MultyConfig) DeleteResource added in v0.1.36

func (c *MultyConfig) DeleteResource(resourceId string) (Resource, error)

func (*MultyConfig) ExportConfig added in v0.1.36

func (c *MultyConfig) ExportConfig() (*configpb.Config, error)

func (*MultyConfig) GetAffectedResources added in v0.1.36

func (c *MultyConfig) GetAffectedResources(resourceId string) []string

func (*MultyConfig) GetUserId added in v0.1.36

func (c *MultyConfig) GetUserId() string

func (*MultyConfig) UpdateDeployedResourceList added in v0.1.36

func (c *MultyConfig) UpdateDeployedResourceList(deployedResources map[Resource][]string)

func (*MultyConfig) UpdateMultyResourceGroups added in v0.1.36

func (c *MultyConfig) UpdateMultyResourceGroups()

func (*MultyConfig) UpdateResource added in v0.1.36

func (c *MultyConfig) UpdateResource(resourceId string, args proto.Message) (Resource, error)

type MultyContext

type MultyContext struct {
	Resources *Resources
	// contains filtered or unexported fields
}

func NewMultyContext added in v0.1.18

func NewMultyContext(r *Resources) MultyContext

type MultyResourceGroup added in v0.1.18

type MultyResourceGroup struct {
	GroupId   string
	Resources []Resource
}

type Resource

type Resource interface {
	Translate(ctx MultyContext) ([]output.TfBlock, error)

	GetResourceId() string

	GetCloudSpecificLocation() string

	Validate(ctx MultyContext) []validate.ValidationError

	GetMainResourceName() (string, error)

	GetCloud() commonpb.CloudProvider

	GetCommonArgs() any

	GetMetadata() ResourceMetadataInterface
}

type ResourceCreateFunc added in v0.1.36

type ResourceCreateFunc[T proto.Message, O Resource] func(string, T, *Resources) (O, error)

type ResourceMetadata added in v0.1.36

type ResourceMetadata[ArgsT proto.Message, R Resource, OutT proto.Message] struct {
	CreateFunc        ResourceCreateFunc[ArgsT, R]
	UpdateFunc        ResourceUpdateFunc[ArgsT, R]
	ReadFromStateFunc ResourceReadFromStateFunc[R, OutT]

	ImportFunc ImportFunc[ArgsT, R]
	ExportFunc ExportFunc[ArgsT, R]

	AbbreviatedName string
}

func (*ResourceMetadata[ArgsT, R, OutT]) Create added in v0.1.36

func (m *ResourceMetadata[ArgsT, R, OutT]) Create(resourceId string, args proto.Message, resources *Resources) (Resource, error)

func (*ResourceMetadata[ArgsT, R, OutT]) Export added in v0.1.36

func (m *ResourceMetadata[ArgsT, R, OutT]) Export(resource Resource, resources *Resources) (proto.Message, bool, error)

func (*ResourceMetadata[ArgsT, R, OutT]) GetAbbreviatedName added in v0.1.36

func (m *ResourceMetadata[ArgsT, R, OutT]) GetAbbreviatedName() string

func (*ResourceMetadata[ArgsT, R, OutT]) Import added in v0.1.36

func (m *ResourceMetadata[ArgsT, R, OutT]) Import(resourceId string, args proto.Message, resources *Resources) (Resource, error)

func (*ResourceMetadata[ArgsT, R, OutT]) ReadFromState added in v0.1.36

func (m *ResourceMetadata[ArgsT, R, OutT]) ReadFromState(resource Resource, state *output.TfState) (proto.Message, error)

func (*ResourceMetadata[ArgsT, R, OutT]) Update added in v0.1.36

func (m *ResourceMetadata[ArgsT, R, OutT]) Update(resource Resource, args proto.Message, resources *Resources) error

type ResourceMetadataInterface added in v0.1.36

type ResourceMetadataInterface interface {
	Create(string, proto.Message, *Resources) (Resource, error)
	Update(Resource, proto.Message, *Resources) error
	ReadFromState(Resource, *output.TfState) (proto.Message, error)

	Export(Resource, *Resources) (proto.Message, bool, error)
	Import(string, proto.Message, *Resources) (Resource, error)
	GetAbbreviatedName() string
}

type ResourceReadFromStateFunc added in v0.1.36

type ResourceReadFromStateFunc[O Resource, OutT proto.Message] func(O, *output.TfState) (OutT, error)

type ResourceUpdateFunc added in v0.1.36

type ResourceUpdateFunc[T proto.Message, O Resource] func(O, T, *Resources) error

type ResourceWithId added in v0.1.15

type ResourceWithId[T WithCommonParams] struct {
	ResourceId string
	Args       T
}

func (*ResourceWithId[T]) GetCloud added in v0.1.15

func (r *ResourceWithId[T]) GetCloud() commonpb.CloudProvider

func (*ResourceWithId[T]) GetCloudSpecificLocation added in v0.1.15

func (r *ResourceWithId[T]) GetCloudSpecificLocation() string

func (*ResourceWithId[T]) GetCommonArgs added in v0.1.30

func (r *ResourceWithId[T]) GetCommonArgs() any

func (*ResourceWithId[T]) GetLocation added in v0.1.15

func (r *ResourceWithId[T]) GetLocation() commonpb.Location

func (*ResourceWithId[T]) GetResourceGroupId added in v0.1.36

func (r *ResourceWithId[T]) GetResourceGroupId() string

func (*ResourceWithId[T]) GetResourceId added in v0.1.15

func (r *ResourceWithId[T]) GetResourceId() string

func (ResourceWithId[T]) NewValidationError added in v0.1.15

func (r ResourceWithId[T]) NewValidationError(err error, field string) validate.ValidationError

func (*ResourceWithId[T]) Validate added in v0.1.15

func (r *ResourceWithId[T]) Validate() (errs []validate.ValidationError)

type Resources added in v0.1.15

type Resources struct {
	ResourceMap map[string]Resource
	// contains filtered or unexported fields
}

func NewResources added in v0.1.18

func NewResources() *Resources

func (*Resources) Add added in v0.1.36

func (r *Resources) Add(resource Resource)

func (*Resources) AddDependency added in v0.1.18

func (r *Resources) AddDependency(dependentResourceId string, id string)

func (*Resources) Delete added in v0.1.36

func (r *Resources) Delete(resourceId string)

func (*Resources) GetAll added in v0.1.36

func (r *Resources) GetAll() []Resource

func (*Resources) GetMultyResourceGroups added in v0.1.18

func (r *Resources) GetMultyResourceGroups(existingGroupsByResource map[string]string) map[Resource]*MultyResourceGroup

type WithChildCommonParams added in v0.1.15

type WithChildCommonParams interface {
	GetCommonParameters() *commonpb.ChildResourceCommonArgs
}

type WithCommonParams added in v0.1.15

type WithCommonParams interface {
	GetCommonParameters() *commonpb.ResourceCommonArgs
}

Jump to

Keyboard shortcuts

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