Documentation
¶
Index ¶
- Constants
- Variables
- func NewClient(config *ClientConfig, logger log.Logger) (*client, error)
- func NewProvider(typeName string, logger log.Logger) *provider
- type ClientConfig
- type Config
- type Credentials
- type HTTPClient
- type Metadata
- type Organization
- type Permission
- type Project
- type ShieldClient
- type Team
- type User
Constants ¶
View Source
const ( RoleMember = "users" RoleAdmin = "admins" AccountTypeUser = "user" )
View Source
const ( ResourceTypeTeam = "team" ResourceTypeProject = "project" ResourceTypeOrganization = "organization" )
Variables ¶
View Source
var ( ErrInvalidPermissionConfig = errors.New("invalid permission config type") ErrInvalidResourceType = errors.New("invalid resource type") )
Functions ¶
func NewProvider ¶
Types ¶
type ClientConfig ¶
type ClientConfig struct {
Host string `validate:"required,url" mapstructure:"host"`
AuthHeader string `validate:"required" mapstructure:"auth_header"`
AuthEmail string `validate:"required" mapstructure:"auth_email"`
HTTPClient HTTPClient
}
type Config ¶
type Config struct {
ProviderConfig *domain.ProviderConfig
// contains filtered or unexported fields
}
func NewConfig ¶
func NewConfig(pc *domain.ProviderConfig) *Config
func (*Config) ParseAndValidate ¶
type Credentials ¶
type Organization ¶
type Organization struct {
ID string `json:"id" mapstructure:"id"`
Name string `json:"name" mapstructure:"name"`
Slug string `json:"slug" mapstructure:"slug"`
Admins []string `json:"admins" mapstructure:"admins"`
}
func (*Organization) FromDomain ¶
func (o *Organization) FromDomain(r *domain.Resource) error
func (*Organization) ToDomain ¶
func (o *Organization) ToDomain() *domain.Resource
type Permission ¶
type Permission string
type Project ¶
type ShieldClient ¶
type ShieldClient interface {
GetTeams() ([]*Team, error)
GetProjects() ([]*Project, error)
GetOrganizations() ([]*Organization, error)
GrantTeamAccess(team *Team, userId string, role string) error
RevokeTeamAccess(team *Team, userId string, role string) error
GrantProjectAccess(project *Project, userId string, role string) error
RevokeProjectAccess(project *Project, userId string, role string) error
GrantOrganizationAccess(organization *Organization, userId string, role string) error
RevokeOrganizationAccess(organization *Organization, userId string, role string) error
GetSelfUser(email string) (*User, error)
}
type Team ¶
type Team struct {
ID string `json:"id" mapstructure:"id"`
Name string `json:"name" mapstructure:"name"`
Slug string `json:"slug" mapstructure:"slug"`
OrgId string `json:"orgId" mapstructure:"orgId"`
Metadata Metadata `json:"metadata" mapstructure:"metadata"`
Admins []string `json:"admins" mapstructure:"admins"`
}
Click to show internal directories.
Click to hide internal directories.