config

package
v0.0.0-...-4f22f6d Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ON_DEMAND = "on-demand"
View Source
const SPOT = "spot"

Variables

This section is empty.

Functions

func ConvertSpotBoolToVMProvisioningType

func ConvertSpotBoolToVMProvisioningType(spot bool) string

Types

type Client

type Client struct {
	Iaas         iaas.Provider
	Project      string
	Namespace    string
	BucketName   string
	BucketExists bool
	BucketError  error
}

Client is a client for loading the config file from S3

func New

func New(iaas iaas.Provider, project, namespace string) *Client

New instantiates a new client

func (*Client) ConfigExists

func (client *Client) ConfigExists() (bool, error)

ConfigExists returns true if the configuration file exists

func (*Client) DeleteAll

func (client *Client) DeleteAll(config ConfigView) error

DeleteAll deletes the entire configuration bucket

func (*Client) EnsureBucketExists

func (client *Client) EnsureBucketExists() error

func (*Client) HasAsset

func (client *Client) HasAsset(filename string) (bool, error)

HasAsset returns true if an associated configuration file exists

func (*Client) Load

func (client *Client) Load() (Config, error)

Load loads an existing config file from S3

func (*Client) LoadAsset

func (client *Client) LoadAsset(filename string) ([]byte, error)

LoadAsset loads an associated configuration file

func (*Client) NewConfig

func (client *Client) NewConfig() Config

func (*Client) StoreAsset

func (client *Client) StoreAsset(filename string, contents []byte) error

StoreAsset stores an associated configuration file

func (*Client) Update

func (client *Client) Update(config Config) error

Update stores the control-tower config file to S3

type Config

type Config struct {
	AllowIPs                 string `json:"allow_ips"`
	AllowIPsUnformatted      string `json:"allow_ips_unformatted"`
	AvailabilityZone         string `json:"availability_zone"`
	BitbucketClientID        string `json:"bitbucket_client_id"`
	BitbucketClientSecret    string `json:"bitbucket_client_secret"`
	ConcourseCACert          string `json:"concourse_ca_cert"`
	ConcourseCert            string `json:"concourse_cert"`
	ConcourseKey             string `json:"concourse_key"`
	ConcoursePassword        string `json:"concourse_password"`
	ConcourseUsername        string `json:"concourse_username"`
	ConcourseWebSize         string `json:"concourse_web_size"`
	ConcourseWorkerCount     int    `json:"concourse_worker_count"`
	ConcourseWorkerSize      string `json:"concourse_worker_size"`
	ConfigBucket             string `json:"config_bucket"`
	CredhubAdminClientSecret string `json:"credhub_admin_client_secret"`
	CredhubCACert            string `json:"credhub_ca_cert"`
	CredhubPassword          string `json:"credhub_password"`
	CredhubURL               string `json:"credhub_url"`
	CredhubUsername          string `json:"credhub_username"`
	Deployment               string `json:"deployment"`
	DirectorCACert           string `json:"director_ca_cert"`
	DirectorCert             string `json:"director_cert"`
	DirectorHMUserPassword   string `json:"director_hm_user_password"`
	DirectorKey              string `json:"director_key"`
	DirectorMbusPassword     string `json:"director_mbus_password"`
	DirectorNATSPassword     string `json:"director_nats_password"`
	DirectorPassword         string `json:"director_password"`
	DirectorPublicIP         string `json:"director_public_ip"`
	DirectorRegistryPassword string `json:"director_registry_password"`
	DirectorUsername         string `json:"director_username"`
	Domain                   string `json:"domain"`
	EnableGlobalResources    bool   `json:"enable_global_resources"`
	EnablePipelineInstances  bool   `json:"enable_pipeline_instances"`
	InfluxDbRetention        string `json:"influx_db_retention_period"`
	EncryptionKey            string `json:"encryption_key"`
	GithubClientID           string `json:"github_client_id"`
	GithubClientSecret       string `json:"github_client_secret"`
	GithubHost               string `json:"github_host"`
	GithubCaCert             string `json:"github_ca_cert"`
	GrafanaPassword          string `json:"grafana_password"`
	HostedZoneID             string `json:"hosted_zone_id"`
	HostedZoneRecordPrefix   string `json:"hosted_zone_record_prefix"`
	IAAS                     string `json:"iaas"`
	MainGithubUsers          string `json:"main_github_users"`
	MainGithubTeams          string `json:"main_github_teams"`
	MainGithubOrgs           string `json:"main_github_orgs"`
	MicrosoftClientID        string `json:"microsoft_client_id"`
	MicrosoftClientSecret    string `json:"microsoft_client_secret"`
	MicrosoftTenant          string `json:"microsoft_tenant"`
	Namespace                string `json:"namespace"`
	NetworkCIDR              string `json:"network_cidr"`
	NoMetrics                bool   `json:"no_metrics"`
	PersistentDisk           string `json:"persistent_disk"`
	PrivateCIDR              string `json:"private_cidr"`
	PrivateKey               string `json:"private_key"`
	Project                  string `json:"project"`
	PublicCIDR               string `json:"public_cidr"`
	PublicKey                string `json:"public_key"`
	RDS1CIDR                 string `json:"rds1_cidr"`
	RDS2CIDR                 string `json:"rds2_cidr"`
	RDSDefaultDatabaseName   string `json:"rds_default_database_name"`
	RDSInstanceClass         string `json:"rds_instance_class"`
	RDSPassword              string `json:"rds_password"`
	RDSUsername              string `json:"rds_username"`
	RDSDiskEncryption        bool   `json:"rds_disk_encryption"`
	Region                   string `json:"region"`
	SourceAccessIP           string `json:"source_access_ip"`
	//Spot is deprecated, exists only as we need to migrate old configs to VMProvisioningType
	Spot               bool     `json:"spot"`
	Tags               []string `json:"tags"`
	TFStatePath        string   `json:"tf_state_path"`
	Version            string   `json:"version"`
	VMProvisioningType string   `json:"vm_provisioning_type"`
	WorkerType         string   `json:"worker_type"`
}

Config represents a control-tower configuration file

func (Config) GetAllowIPs

func (c Config) GetAllowIPs() string

func (Config) GetAllowIPsUnformatted

func (c Config) GetAllowIPsUnformatted() string

func (Config) GetAvailabilityZone

func (c Config) GetAvailabilityZone() string

func (Config) GetBitbucketClientID

func (c Config) GetBitbucketClientID() string

func (Config) GetBitbucketClientSecret

func (c Config) GetBitbucketClientSecret() string

func (Config) GetConcourseCACert

func (c Config) GetConcourseCACert() string

func (Config) GetConcourseCert

func (c Config) GetConcourseCert() string

func (Config) GetConcourseKey

func (c Config) GetConcourseKey() string

func (Config) GetConcoursePassword

func (c Config) GetConcoursePassword() string

func (Config) GetConcourseUsername

func (c Config) GetConcourseUsername() string

func (Config) GetConcourseWebSize

func (c Config) GetConcourseWebSize() string

func (Config) GetConcourseWorkerCount

func (c Config) GetConcourseWorkerCount() int

func (Config) GetConcourseWorkerSize

func (c Config) GetConcourseWorkerSize() string

func (Config) GetConfigBucket

func (c Config) GetConfigBucket() string

func (Config) GetCredhubAdminClientSecret

func (c Config) GetCredhubAdminClientSecret() string

func (Config) GetCredhubCACert

func (c Config) GetCredhubCACert() string

func (Config) GetCredhubPassword

func (c Config) GetCredhubPassword() string

func (Config) GetCredhubURL

func (c Config) GetCredhubURL() string

func (Config) GetCredhubUsername

func (c Config) GetCredhubUsername() string

func (Config) GetDeployment

func (c Config) GetDeployment() string

func (Config) GetDirectorCACert

func (c Config) GetDirectorCACert() string

func (Config) GetDirectorCert

func (c Config) GetDirectorCert() string

func (Config) GetDirectorHMUserPassword

func (c Config) GetDirectorHMUserPassword() string

func (Config) GetDirectorKey

func (c Config) GetDirectorKey() string

func (Config) GetDirectorMbusPassword

func (c Config) GetDirectorMbusPassword() string

func (Config) GetDirectorNATSPassword

func (c Config) GetDirectorNATSPassword() string

func (Config) GetDirectorPassword

func (c Config) GetDirectorPassword() string

func (Config) GetDirectorPublicIP

func (c Config) GetDirectorPublicIP() string

func (Config) GetDirectorRegistryPassword

func (c Config) GetDirectorRegistryPassword() string

func (Config) GetDirectorUsername

func (c Config) GetDirectorUsername() string

func (Config) GetDomain

func (c Config) GetDomain() string

func (Config) GetEnableGlobalResources

func (c Config) GetEnableGlobalResources() bool

func (Config) GetEnablePipelineInstances

func (c Config) GetEnablePipelineInstances() bool

func (Config) GetEncryptionKey

func (c Config) GetEncryptionKey() string

func (Config) GetGithubCaCert

func (c Config) GetGithubCaCert() string

func (Config) GetGithubClientID

func (c Config) GetGithubClientID() string

func (Config) GetGithubClientSecret

func (c Config) GetGithubClientSecret() string

func (Config) GetGithubHost

func (c Config) GetGithubHost() string

func (Config) GetGrafanaPassword

func (c Config) GetGrafanaPassword() string

func (Config) GetHostedZoneID

func (c Config) GetHostedZoneID() string

func (Config) GetHostedZoneRecordPrefix

func (c Config) GetHostedZoneRecordPrefix() string

func (Config) GetIAAS

func (c Config) GetIAAS() string

func (Config) GetInfluxDbRetention

func (c Config) GetInfluxDbRetention() string

func (Config) GetMainGithubOrgs

func (c Config) GetMainGithubOrgs() string

func (Config) GetMainGithubTeams

func (c Config) GetMainGithubTeams() string

func (Config) GetMainGithubUsers

func (c Config) GetMainGithubUsers() string

func (Config) GetMicrosoftClientID

func (c Config) GetMicrosoftClientID() string

func (Config) GetMicrosoftClientSecret

func (c Config) GetMicrosoftClientSecret() string

func (Config) GetMicrosoftTenant

func (c Config) GetMicrosoftTenant() string

func (Config) GetNamespace

func (c Config) GetNamespace() string

func (Config) GetNetworkCIDR

func (c Config) GetNetworkCIDR() string

func (Config) GetPersistentDiskSize

func (c Config) GetPersistentDiskSize() string

func (Config) GetPrivateCIDR

func (c Config) GetPrivateCIDR() string

func (Config) GetPrivateKey

func (c Config) GetPrivateKey() string

func (Config) GetProject

func (c Config) GetProject() string

func (Config) GetPublicCIDR

func (c Config) GetPublicCIDR() string

func (Config) GetPublicKey

func (c Config) GetPublicKey() string

func (Config) GetRDS1CIDR

func (c Config) GetRDS1CIDR() string

func (Config) GetRDS2CIDR

func (c Config) GetRDS2CIDR() string

func (Config) GetRDSDefaultDatabaseName

func (c Config) GetRDSDefaultDatabaseName() string

func (Config) GetRDSDiskEncryption

func (c Config) GetRDSDiskEncryption() bool

func (Config) GetRDSInstanceClass

func (c Config) GetRDSInstanceClass() string

func (Config) GetRDSPassword

func (c Config) GetRDSPassword() string

func (Config) GetRDSUsername

func (c Config) GetRDSUsername() string

func (Config) GetRegion

func (c Config) GetRegion() string

func (Config) GetSourceAccessIP

func (c Config) GetSourceAccessIP() string

func (Config) GetTFStatePath

func (c Config) GetTFStatePath() string

func (Config) GetTags

func (c Config) GetTags() []string

func (Config) GetVersion

func (c Config) GetVersion() string

func (Config) GetWorkerType

func (c Config) GetWorkerType() string

func (Config) IsBitbucketAuthSet

func (c Config) IsBitbucketAuthSet() bool

func (Config) IsGithubAuthSet

func (c Config) IsGithubAuthSet() bool

func (Config) IsGithubEnterpriseAuthSet

func (c Config) IsGithubEnterpriseAuthSet() bool

func (Config) IsMainGithubAuthSet

func (c Config) IsMainGithubAuthSet() bool

func (Config) IsMicrosoftAuthSet

func (c Config) IsMicrosoftAuthSet() bool

func (Config) IsSpot

func (c Config) IsSpot() bool

func (Config) MetricsIsDisabled

func (c Config) MetricsIsDisabled() bool

type ConfigView

type ConfigView interface {
	GetAllowIPs() string
	GetAllowIPsUnformatted() string
	GetAvailabilityZone() string
	GetBitbucketClientID() string
	GetBitbucketClientSecret() string
	GetConcourseCACert() string
	GetConcourseCert() string
	GetConcourseKey() string
	GetConcoursePassword() string
	GetConcourseUsername() string
	GetConcourseWebSize() string
	GetConcourseWorkerCount() int
	GetConcourseWorkerSize() string
	GetConfigBucket() string
	GetCredhubAdminClientSecret() string
	GetCredhubCACert() string
	GetCredhubPassword() string
	GetCredhubURL() string
	GetCredhubUsername() string
	GetDeployment() string
	GetDirectorCACert() string
	GetDirectorCert() string
	GetDirectorHMUserPassword() string
	GetDirectorKey() string
	GetDirectorMbusPassword() string
	GetDirectorNATSPassword() string
	GetDirectorPassword() string
	GetDirectorPublicIP() string
	GetDirectorRegistryPassword() string
	GetDirectorUsername() string
	GetDomain() string
	GetEnableGlobalResources() bool
	GetEnablePipelineInstances() bool
	GetInfluxDbRetention() string
	GetEncryptionKey() string
	GetGithubClientID() string
	GetGithubClientSecret() string
	GetGithubHost() string
	GetGithubCaCert() string
	GetGrafanaPassword() string
	GetHostedZoneID() string
	GetHostedZoneRecordPrefix() string
	GetIAAS() string
	GetMainGithubUsers() string
	GetMainGithubTeams() string
	GetMainGithubOrgs() string
	GetMicrosoftClientID() string
	GetMicrosoftClientSecret() string
	GetMicrosoftTenant() string
	GetNamespace() string
	GetNetworkCIDR() string
	GetPersistentDiskSize() string
	GetPrivateCIDR() string
	GetPrivateKey() string
	GetProject() string
	GetPublicCIDR() string
	GetPublicKey() string
	GetRDS1CIDR() string
	GetRDS2CIDR() string
	GetRDSDefaultDatabaseName() string
	GetRDSInstanceClass() string
	GetRDSPassword() string
	GetRDSUsername() string
	GetRDSDiskEncryption() bool
	GetRegion() string
	GetSourceAccessIP() string
	GetTags() []string
	GetTFStatePath() string
	GetVersion() string
	GetWorkerType() string
	IsBitbucketAuthSet() bool
	IsGithubAuthSet() bool
	IsGithubEnterpriseAuthSet() bool
	IsMainGithubAuthSet() bool
	IsMicrosoftAuthSet() bool
	IsSpot() bool
	MetricsIsDisabled() bool
}

type IClient

type IClient interface {
	Load() (Config, error)
	DeleteAll(config ConfigView) error
	Update(Config) error
	StoreAsset(filename string, contents []byte) error
	HasAsset(filename string) (bool, error)
	ConfigExists() (bool, error)
	LoadAsset(filename string) ([]byte, error)
	NewConfig() Config
	EnsureBucketExists() error
}

counterfeiter: generate . IClient

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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