Documentation ¶
Index ¶
- Variables
- func FlattenResourceCredentialValues(resourceCredentials []*primitives.CredentialValue) (map[string]string, error)
- func FlattenResourcesCredentialValues(resourcesCredentials map[string][]*primitives.CredentialValue) (map[string]string, error)
- type Client
- func (c *Client) GetProjectCredentialValues(ctx context.Context, project *primitives.Project) (map[string][]*primitives.CredentialValue, error)
- func (c *Client) GetResource(ctx context.Context, project *string, res *primitives.Resource) (*manifold.Resource, error)
- func (c *Client) GetResourceCredentialValues(ctx context.Context, project *string, res *primitives.Resource) ([]*primitives.CredentialValue, error)
- func (c *Client) GetResources(ctx context.Context, project *string, res []*primitives.Resource) ([]*manifold.Resource, error)
- func (c *Client) GetResourcesCredentialValues(ctx context.Context, project *string, res []*primitives.Resource) (map[string][]*primitives.CredentialValue, error)
- func (c *Client) ProjectID(label *string) (*manifold.ID, error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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.