service

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const AssetsFileName = "build_artifacts.zip"
View Source
const LeasesPath = "/leases"

Variables

View Source
var ApiClient utl.APIer

Functions

This section is empty.

Types

type Accounter

type Accounter interface {
	AddAccount(accountID, adminRoleARN string)
	RemoveAccount(accountID string)
	GetAccount(accountID string)
	ListAccounts()
}

type AccountsService

type AccountsService struct {
	Config      *configs.Root
	Observation *observ.ObservationContainer
	Util        *utl.UtilContainer
}

func (*AccountsService) AddAccount

func (s *AccountsService) AddAccount(accountID, adminRoleARN string)

func (*AccountsService) GetAccount

func (s *AccountsService) GetAccount(accountID string)

func (*AccountsService) ListAccounts

func (s *AccountsService) ListAccounts()

ListAccounts lists the accounts

func (*AccountsService) RemoveAccount

func (s *AccountsService) RemoveAccount(accountID string)

type AuthService

type AuthService struct {
	Config      *configs.Root
	Observation *observ.ObservationContainer
	Util        *utl.UtilContainer
}

func (*AuthService) Authenticate

func (s *AuthService) Authenticate() error

type Authenticater

type Authenticater interface {
	Authenticate() error
}

type DeployConfig added in v0.5.0

type DeployConfig struct {
	// Path to the DCE repo to deploy
	// May be a local file path (eg. /path/to/dce)
	// or a github repo (eg. github.com/Optum/dce)
	Location string
	// Version of DCE to deploy, eg 0.12.3
	Version string
	// BatchMode, if enabled, forces DCE to run non-interactively
	// and supplies Terraform with -auto-approve and input=false
	BatchMode bool
	// TFInitOptions are options passed along to `terraform init`
	TFInitOptions string
	// TFApplyOptions are options passed along to `terraform apply`
	TFApplyOptions string
	// SaveTFOptions, if yes, will save the provided terraform options to the config file.
	SaveTFOptions bool
	// File location for deployment logs
	DeployLogFile string

	// Terraform variables to pass through to the DCE module
	AWSRegion                         string
	GlobalTags                        []string
	Namespace                         string
	BudgetNotificationFromEmail       string
	BudgetNotificationBCCEmails       []string
	BudgetNotificationTemplateHTML    string
	BudgetNotificationTemplateText    string
	BudgetNotificationTemplateSubject string
}

type DeployOverrides

type DeployOverrides struct {
	AWSRegion                         string
	GlobalTags                        []string
	Namespace                         string
	BudgetNotificationFromEmail       string
	BudgetNotificationBCCEmails       []string
	BudgetNotificationTemplateHTML    string
	BudgetNotificationTemplateText    string
	BudgetNotificationTemplateSubject string
	DCEVersion                        string
	// Location of the DCE terraform module
	DCEModulePath string
}

type DeployService

type DeployService struct {
	Config      *configs.Root
	Observation *observ.ObservationContainer
	Util        *utl.UtilContainer
}

func (*DeployService) Deploy

func (s *DeployService) Deploy(deployConfig *DeployConfig) error

Deploy writes the local `main.tf` file, using the overrides, and then calls Terraform init and apply using configuration directory (`~/.dce`) as the working folder and location of local state.

func (*DeployService) PostDeploy added in v0.4.0

func (s *DeployService) PostDeploy(deployConfig *DeployConfig) error

PostDeploy is intended to run after a successful call to Deploy()

type Deployer

type Deployer interface {
	Deploy(input *DeployConfig) error
	PostDeploy(input *DeployConfig) error
}

type InitService

type InitService struct {
	Config      *configs.Root
	Observation *observ.ObservationContainer
	Util        *utl.UtilContainer
}

func (*InitService) InitializeDCE

func (s *InitService) InitializeDCE()

type Initer

type Initer interface {
	InitializeDCE()
}

type LeaseLoginOptions added in v0.5.0

type LeaseLoginOptions struct {
	CliProfile  string
	OpenBrowser bool
	PrintCreds  bool
}

type Leaser

type Leaser interface {
	CreateLease(principalID string, budgetAmount float64, budgetCurrency string, email []string, expiresOn string)
	EndLease(accountID, principalID string)
	LoginByID(leaseID string, opts *LeaseLoginOptions)
	Login(opts *LeaseLoginOptions)
	ListLeases(acctID, principalID, nextAcctID, nextPrincipalID, leaseStatus string, pagLimit int64)
	GetLease(leaseID string)
}

type LeasesService

type LeasesService struct {
	Config      *configs.Root
	Observation *observ.ObservationContainer
	Util        *utl.UtilContainer
}

func (*LeasesService) CreateLease

func (s *LeasesService) CreateLease(principalID string, budgetAmount float64, budgetCurrency string, email []string, expiresOn string)

func (*LeasesService) EndLease

func (s *LeasesService) EndLease(accountID, principalID string)

func (*LeasesService) GetLease

func (s *LeasesService) GetLease(leaseID string)

func (*LeasesService) ListLeases

func (s *LeasesService) ListLeases(acctID, principalID, nextAcctID, nextPrincipalID, leaseStatus string, pagLimit int64)

func (*LeasesService) Login added in v0.5.0

func (s *LeasesService) Login(opts *LeaseLoginOptions)

func (*LeasesService) LoginByID added in v0.5.0

func (s *LeasesService) LoginByID(leaseID string, opts *LeaseLoginOptions)

type ServiceContainer

type ServiceContainer struct {
	Config      *configs.Root
	Observation *observ.ObservationContainer
	Util        *utl.UtilContainer
	Deployer
	Accounter
	Leaser
	Initer
	Authenticater
	Usager
}

ServiceContainer is a service that injects its config and util into other services

func New

func New(config *configs.Root, observation *observ.ObservationContainer, util *utl.UtilContainer) *ServiceContainer

New returns a new ServiceContainer given config

type UsageService

type UsageService struct {
	Config      *configs.Root
	Observation *observ.ObservationContainer
	Util        *utl.UtilContainer
}

func (*UsageService) GetUsage

func (s *UsageService) GetUsage(startDate, endDate float64)

type Usager

type Usager interface {
	GetUsage(startDate, endDate float64)
}

Jump to

Keyboard shortcuts

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