credentials

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package credentials provides support for HSDP S3 Credentials

Index

Constants

View Source
const (
	CredentialsAPIVersion = "2"
)

Constants

Variables

View Source
var (
	ErrNotFound                       = errors.New("entity not found")
	ErrMissingManagingOrganization    = errors.New("missing managing organization")
	ErrMissingName                    = errors.New("missing name value")
	ErrMissingDescription             = errors.New("missing description value")
	ErrMalformedInputValue            = errors.New("malformed input value")
	ErrMissingOrganization            = errors.New("missing organization")
	ErrMissingProposition             = errors.New("missing proposition")
	ErrMissingGlobalReference         = errors.New("missing global reference")
	ErrMissingProductKey              = errors.New("missing product key")
	ErrNotImplementedByHSDP           = errors.New("method not implemented by HSDP")
	ErrEmptyResults                   = errors.New("empty results")
	ErrOperationFailed                = errors.New("operation failed")
	ErrBaseURLCannotBeEmpty           = errors.New("Credentials base URL cannot be empty")
	ErrCouldNoReadResourceAfterCreate = errors.New("could not read resource after create")
	ErrEmptyResult                    = errors.New("empty result")
)

Exported Errors

Functions

This section is empty.

Types

type Access added in v0.10.0

type Access struct {
	Allowed struct {
		Resources []string `json:"resources"`
		Actions   []string `json:"actions"`
	} `json:"allowed"`
	Credentials struct {
		AccessKey    string `json:"accessKey"`
		SecretKey    string `json:"secretKey"`
		SessionToken string `json:"sessionToken"`
		Expires      string `json:"expires"`
		Bucket       string `json:"bucket"`
	} `json:"credentials"`
}

type AccessService added in v0.10.0

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

func (*AccessService) GetAccess added in v0.10.0

func (c *AccessService) GetAccess(opt *GetAccessOptions, options ...OptionFunc) ([]*Access, *Response, error)

GetPolicy searches for polices

type Client

type Client struct {

	// User agent used when communicating with the HSDP IAM API.
	UserAgent string

	Policy *PolicyService
	Access *AccessService
	// contains filtered or unexported fields
}

A Client manages communication with HSDP IAM API

func NewClient

func NewClient(iamClient *iam.Client, config *Config) (*Client, error)

NewClient returns a new HSDP Credenials API client. A configured IAM client must be provided

func (*Client) Close

func (c *Client) Close()

Close releases allocated resources of clients

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do executes a http request. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(urlStr string) error

SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

type Config

type Config struct {
	BaseURL     string
	Region      string
	Environment string
	Debug       bool
	DebugLog    string
}

Config contains the configuration of a client

type ErrorResponse added in v0.30.0

type ErrorResponse struct {
	Response *http.Response `json:"-"`
	Code     string         `json:"responseCode"`
	Message  string         `json:"responseMessage"`
}

ErrorResponse represents an IAM errors response containing a code and a human readable message

func (*ErrorResponse) Error added in v0.30.0

func (e *ErrorResponse) Error() string

type GetAccessOptions added in v0.10.0

type GetAccessOptions struct {
	ProductKey *string `url:"-"`
}

GetAccessOptions describes the fields on which you can search for policies

type GetPolicyOptions

type GetPolicyOptions struct {
	ManagingOrg *string `url:"managing-org,omitempty"`
	GroupName   *string `url:"group-name,omitempty"`
	ID          *int    `url:"id,omitempty"`
	ProductKey  *string `url:"-"`
}

GetPolicyOptions describes the fields on which you can search for policies

type OptionFunc

type OptionFunc func(*http.Request) error

OptionFunc is the function signature function for options

type Policy

type Policy struct {
	ID           int    `json:"id,omitempty"`
	ResourceType string `json:"resourceType,omitempty"`
	Conditions   struct {
		ManagingOrganizations []string `json:"managingOrganizations,omitempty"`
		Groups                []string `json:"groups,omitempty"`
	} `json:"conditions,omitempty"`
	Allowed struct {
		Resources []string `json:"resources" validate:"min=1"`
		Actions   []string `json:"actions" validate:"policyActions,min=1,unique"`
	} `json:"allowed"`

	ProductKey string `json:"-"`
}

func (*Policy) Equals added in v0.9.0

func (p *Policy) Equals(other *Policy) bool

Equals determines of other Policy is equavalent

func (*Policy) StringID

func (p *Policy) StringID() string

type PolicyService

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

PolicyService provides operations on S3 Credentials Policies

func (*PolicyService) CreatePolicy

func (c *PolicyService) CreatePolicy(policy Policy) (*Policy, *Response, error)

CreatePolicy creates a new policy for S3 Credentials

func (*PolicyService) DeletePolicy

func (c *PolicyService) DeletePolicy(policy Policy) (bool, *Response, error)

DeleteGroup deletes the given Group

func (*PolicyService) GetPolicy

func (c *PolicyService) GetPolicy(opt *GetPolicyOptions, options ...OptionFunc) ([]*Policy, *Response, error)

GetPolicy searches for polices

type Response

type Response struct {
	*http.Response
}

Response is a HSDP IAM API response. This wraps the standard http.Response returned from HSDP IAM and provides convenient access to things like errors

Jump to

Keyboard shortcuts

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