provider

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TypeStrings

func TypeStrings() []string

TypeStrings returns a slice of all String values of the enum

Types

type NopProvider

type NopProvider struct{}

NopProvider holds the default methods for the provider.Interface so if one Provider does not implement one method we do not have to write the method

func (NopProvider) DataSource

func (n NopProvider) DataSource(rsc string) (*resource.Resource, error)

DataSource returns the resource information

func (NopProvider) IsEdge

func (n NopProvider) IsEdge(rsc string) bool

IsEdge checks if the resource should be considered an Edge or not

func (NopProvider) IsNode

func (n NopProvider) IsNode(rsc string) bool

IsNode checks if the resource should be considered a Node or not

func (NopProvider) Resource

func (n NopProvider) Resource(rsc string) (*resource.Resource, error)

Resource returns the resource information

func (NopProvider) ResourceInOut

func (n NopProvider) ResourceInOut(rs string, cfg map[string]interface{}) (in, out []string)

ResourceInOut returns the resource In Out from a state config. As an example in AWS this would be an "aws_security_group" "ingress" and "egress"

func (NopProvider) Type

func (n NopProvider) Type() Type

Type returns the name of the Provider

func (NopProvider) UsedAttributes

func (n NopProvider) UsedAttributes() []string

UsedAttributes returns all the attributes that are required/used/needed on the providers, so when we have to prune we know what to keep

type Provider

type Provider interface {
	// Type returns the name of the Provider
	Type() Type

	// IsNode checks if the resource should be considered
	// a Node or not
	IsNode(rsc string) bool

	// IsEdge checks if the resource should be considered
	// an Edge or not
	IsEdge(rsc string) bool

	// Resource returns the resource information
	Resource(rsc string) (*resource.Resource, error)

	// DataSource returns the resource information
	DataSource(rsc string) (*resource.Resource, error)

	// ResourceInOut returns the resource In Out from a
	// state config. As an example in AWS this would be
	// an "aws_security_group" "ingress" and "egress"
	ResourceInOut(rs string, cfg map[string]interface{}) (in, out []string)

	// UsedAttributes returns all the attributes that are
	// required/used/needed on the providers, so when we have to
	// prune we know what to keep
	UsedAttributes() []string
}

Provider is an interface to abstract common functions on all the providers

type RawProvider

type RawProvider struct {
	NopProvider
}

RawProvider is the provider that would be used when we do not have an specific implementation a Provider

func (RawProvider) IsNode

func (n RawProvider) IsNode(rsc string) bool

IsNode checks if the resource should be considered a Node or not For the default one we consider all of the Nodes

func (RawProvider) Resource

func (n RawProvider) Resource(rsc string) (*resource.Resource, error)

Resource returns the resource information

func (RawProvider) Type

func (n RawProvider) Type() Type

Type returns the name of the Provider

type Type

type Type int

Type defines the type of the Provider

const (
	Raw Type = iota
	AWS
	FlexibleEngine
	OpenStack
)

List of all the Providers supported

func TypeString

func TypeString(s string) (Type, error)

TypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func TypeValues

func TypeValues() []Type

TypeValues returns all values of the enum

func (Type) IsAType

func (i Type) IsAType() bool

IsAType returns "true" if the value is listed in the enum definition. "false" otherwise

func (Type) String

func (i Type) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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