ssam

package
v0.0.0-...-e0434a4 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLevel

type AccessLevel struct {
	System          string              `json:"system,omitempty"`
	Name            string              `json:"access_level_name"`
	ShortName       string              `json:"access_level_short_name"`
	ADGroupName     string              `json:"ad_group_name,omitempty"`
	Members         *AccessLevelMembers `json:"members,omitempty"`
	AWSResourceName string              `json:"aws_arn,omitempty"`
}

type AccessLevelMembers

type AccessLevelMembers struct {
	Users []string `json:"users,omitempty"`
}

type AccessLevelPostRequest

type AccessLevelPostRequest struct {
	Name      string              `json:"access_level_name" validate:"required"`
	ShortName string              `json:"access_level_short_name" validate:"required"`
	Members   *AccessLevelMembers `json:"members,omitempty"`
}

type AccessLevels

type AccessLevels struct {
	Development string
	Staging     string
	Production  string
	Admins      string
}

type Client

type Client interface {
	GetContainer(ctx context.Context, containerName string) (*Container, error)
	PostContainer(ctx context.Context, container *ContainerPostRequest) (*Container, error)
	DeleteContainer(ctx context.Context, containerShortName string) error
	GetContainerAccessLevel(ctx context.Context, containerName, accessLevelName string) (*AccessLevel, error)
	PostAccessLevel(ctx context.Context, containerName string, accessLevel *AccessLevelPostRequest) (*AccessLevel, error)
}

func NewSSAMClient

func NewSSAMClient(httpClient *http.Client, asap pkiutil.ASAP, baseURL *url.URL) Client

NewSSAMClient creates an SSAMClient. The baseURL is the host of the SSAM API excluding the path but including the scheme, i.e. https://ssam.office.atlassian.com/

type Container

type Container struct {
	ContainerType string         `json:"container_type"`
	DisplayName   string         `json:"display_name"`
	ShortName     string         `json:"short_name"`
	URL           string         `json:"url,omitempty"`
	SystemOwner   string         `json:"system_owner"`
	Delegates     []string       `json:"delegates,omitempty"`
	AccessLevels  []*AccessLevel `json:"access_levels,omitempty"`
}

type ContainerPostRequest

type ContainerPostRequest struct {
	ContainerType string   `json:"container_type" validate:"required"`
	DisplayName   string   `json:"display_name" validate:"required"`
	ShortName     string   `json:"short_name" validate:"required"`
	URL           string   `json:"url,omitempty"`
	SystemOwner   string   `json:"system_owner" validate:"required"`
	Delegates     []string `json:"delegates,omitempty"`
}

TODO validate that the SystemOwner, DisplayName, ShortName, and ContainerType have all been set

type ServiceCreator

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

func NewServiceCreator

func NewServiceCreator(client Client) *ServiceCreator

func (*ServiceCreator) CreateService

func (s *ServiceCreator) CreateService(ctx context.Context, metadata *ServiceMetadata) (string, AccessLevels, error)

CreateService creates a "service" which is a container and access levels for that container. The short name for the container is returned.

The container is not created willy-nilly. Voyager has more authorisation than the user we are acting as a proxy for. We need to check if we can create the container, or use a pre-existing one that has the data we are looking for. We also ensure that the default access levels exist.

func (*ServiceCreator) DeleteService

func (s *ServiceCreator) DeleteService(ctx context.Context, metadata *ServiceMetadata) error

func (*ServiceCreator) GetExpectedServiceContainerName

func (s *ServiceCreator) GetExpectedServiceContainerName(ctx context.Context, metadata *ServiceMetadata) string

type ServiceMetadata

type ServiceMetadata struct {
	ServiceName  voyager.ServiceName
	ServiceOwner string
}

func (*ServiceMetadata) SSAMAccessLevelName

func (m *ServiceMetadata) SSAMAccessLevelName(envType voyager.EnvType) string

SSAMAccessLevelName returns the display name for an access level; it's for humans.

func (*ServiceMetadata) SSAMAccessLevelShortName

func (m *ServiceMetadata) SSAMAccessLevelShortName(envType voyager.EnvType) string

SSAMAccessLevelShortName returns short-name of an access level; it's for computers.

func (*ServiceMetadata) SSAMContainerDisplayName

func (m *ServiceMetadata) SSAMContainerDisplayName() string

SSAMContainerDisplayName creates the display name for humans to read. It's for humans.

func (*ServiceMetadata) SSAMContainerShortName

func (m *ServiceMetadata) SSAMContainerShortName() string

SSAMContainerShortName creates the short-name that Voyager uses for Containers. It's for computers. It is also known as the Container Name.

Directories

Path Synopsis
util

Jump to

Keyboard shortcuts

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