integrations

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: BSD-3-Clause Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNameRequired           = errors.New("a label is required to perform this query")
	ErrProjectInvalid         = errors.New("the project is invalid")
	ErrResourceInvalid        = errors.New("the resource is invalid")
	ErrMultipleResourcesFound = errors.New("multiple resources with the same label are found. Please provide a specific project")

	ErrTeamNotFound            = errors.New("team not found")
	ErrResourceNotFound        = errors.New("a resource with the given label is not found")
	ErrProjectNotFound         = errors.New("project with the given label is not found")
	ErrCredentialNotFound      = errors.New("credential with the given KEY is not found")
	ErrCredentialNotSpecified  = errors.New("we've found a credential that you did not specify")
	ErrCredentialDefaultNotSet = errors.New("you did not provide a default for a the non-existing credential")
)

Human friendly error values

Functions

func FlattenResourceCredentialValues

func FlattenResourceCredentialValues(resourceCredentials []*primitives.CredentialValue) (map[string]string, error)

FlattenResourceCredentialValues will take a set of CredentialValues that are linked to a Resource and make a single key/value map. It will use the `Name` as key if one is provided and `Default` as value if no value is present and a default is set.

func FlattenResourcesCredentialValues

func FlattenResourcesCredentialValues(resourcesCredentials map[string][]*primitives.CredentialValue) (map[string]string, error)

FlattenResourcesCredentialValues will take a set of CredentialValues that are linked to a set Resource and make a single key/value map. It will use the `Name` as key if one is provided and `Default` as value if no value is present and a default is set.

Types

type Client

type Client struct {
	*manifold.Client
	TeamID *manifold.ID

	sync.RWMutex
	// contains filtered or unexported fields
}

Client is a wrapper around the manifold client.

func NewClient

func NewClient(cl *manifold.Client, team *string) (*Client, error)

NewClient returns a new wrapper client for the provided client, bound to the provided team.

func (*Client) GetProjectCredentialValues added in v0.9.3

func (c *Client) GetProjectCredentialValues(ctx context.Context, project *primitives.Project) (map[string][]*primitives.CredentialValue, error)

GetProjectCredentialValues fetches a Project's set of CredentialValues If the Project's list of resource is populated, then the CredentialValues are mapped to their owning Resource using the Resource name. This will also provide defaults if you have provided a Default value. Unlike GetResourcesCredentialValues, only the Resources that are a member of the Project are loaded.

func (*Client) GetResource

func (c *Client) GetResource(ctx context.Context, project *string, res *primitives.Resource) (*manifold.Resource, error)

GetResource gets a resource for a specific label. If no resource is given, this will error.

func (*Client) GetResourceCredentialValues

func (c *Client) GetResourceCredentialValues(ctx context.Context, project *string, res *primitives.Resource) ([]*primitives.CredentialValue, error)

GetResourceCredentialValues is a wrapper function that knows how to get a set of specific credentials for a given requested resource.

func (*Client) GetResources

func (c *Client) GetResources(ctx context.Context, project *string, res []*primitives.Resource) ([]*manifold.Resource, error)

GetResources fetches a set of resources according to their labels. If no resources are given, all the resources will be fetched. If one of the requested resources is not available, this will return an error.

func (*Client) GetResourcesCredentialValues

func (c *Client) GetResourcesCredentialValues(ctx context.Context, project *string, res []*primitives.Resource) (map[string][]*primitives.CredentialValue, error)

GetResourcesCredentialValues is a wrapper function that gets a list of CredentialValues for a list of resources and then maps all the credentials to it's specific Resource using the Resource Name. This also takes care of filling up the gaps. If you have requested a ResourceCredential with a non existing key but you've provided a Default value, it will be added to the list. If no default value is given, it will error.

func (*Client) ProjectID

func (c *Client) ProjectID(label *string) (*manifold.ID, error)

ProjectID will return the ID for a project based on it's label. It uses an internal cache so it doesn't have to multiple requests for a single label.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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