iam

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IAMProviderShield = "shield"
	IAMProviderHTTP   = "http"
)

Variables

View Source
var (
	// ErrEmptyUserEmailParam is the error value when the passed user email is empty
	ErrEmptyUserEmailParam = errors.New("user email param is required")
	// ErrEmptyApprovers is the error value when the returned approver emails are zero/empty
	ErrEmptyApprovers = errors.New("got zero approver")
)

Functions

func NewClient

func NewClient(config *ClientConfig) (domain.IAMClient, error)

func NewShieldClient

func NewShieldClient(config *ShieldClientConfig) (*shieldClient, error)

Types

type ClientConfig

type ClientConfig struct {
	Provider string `mapstructure:"provider"`

	// shield config
	Host string `mapstructure:"host"`

	// http config
	GetManagersURL string `mapstructure:"get_managers_url"`
}

type HTTPClient

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

HTTPClient wraps the http client for external approver resolver service

func NewHTTPClient

func NewHTTPClient(config *HTTPClientConfig) (*HTTPClient, error)

NewHTTPClient returns *iam.Client

func (*HTTPClient) GetManagerEmails added in v0.2.0

func (c *HTTPClient) GetManagerEmails(user string) ([]string, error)

GetManagerEmails fetches to external approver resolver service and returns approver emails

type HTTPClientConfig

type HTTPClientConfig struct {
	GetManagersURL string `validate:"required,url" mapstructure:"get_managers_url"`
	HTTPClient     *http.Client
}

HTTPClientConfig is the configuration required by iam.Client

type Service

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

Service handles business logic for identity manager

func NewService

func NewService(client domain.IAMClient) *Service

NewService returns *iam.Service

func (*Service) GetUserApproverEmails added in v0.2.0

func (s *Service) GetUserApproverEmails(user string) ([]string, error)

GetUserApproverEmails returns array of approver emails or error if any

type ShieldClientConfig

type ShieldClientConfig struct {
	Host string `validate:"required,url" mapstructure:"host"`
}

Jump to

Keyboard shortcuts

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