config

package
v0.0.72 Latest Latest
Warning

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

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

Documentation

Overview

Package config provides utilities for reading and writing cf-mgmt's configuration.

Index

Constants

This section is empty.

Variables

View Source
var DefaultProtectedOrgs = map[string]bool{
	"system":                  true,
	"p-spring-cloud-services": true,
	"splunk-nozzle-org":       true,
}

DefaultProtectedOrgs lists the organizations that are considered protected and should never be deleted by cf-mgmt.

Functions

func DeleteDirectory added in v0.0.68

func DeleteDirectory(path string) error

DeleteDirectory - deletes a directory

func FileOrDirectoryExists added in v0.0.68

func FileOrDirectoryExists(path string) bool

FileOrDirectoryExists - checks if file exists

func FindFiles added in v0.0.68

func FindFiles(configDir, pattern string) ([]string, error)

FindFiles -

func LoadFile added in v0.0.68

func LoadFile(configFile string, dataType interface{}) error

LoadFile -

func LoadFileBytes added in v0.0.68

func LoadFileBytes(path string) ([]byte, error)

LoadFileBytes - Load a file and return the bytes

func WriteFile added in v0.0.68

func WriteFile(configFile string, dataType interface{}) error

WriteFile -

func WriteFileBytes added in v0.0.68

func WriteFileBytes(configFile string, data []byte) error

WriteFileBytes -

Types

type ASGConfig added in v0.0.68

type ASGConfig struct {
	Rules string
	Name  string
}

ASGConfig describes is an array of Rules

type GlobalConfig added in v0.0.68

type GlobalConfig struct {
	EnableDeleteIsolationSegments bool `yaml:"enable-delete-isolation-segments"`
}

GlobalConfig configuration for global settings

type Manager

type Manager interface {
	Updater
	Reader
}

Manager can read and write the cf-mgmt configuration.

func NewManager

func NewManager(configDir string) Manager

NewManager creates a Manager that is backed by a set of YAML files in the specified configuration directory.

type OrgConfig added in v0.0.48

type OrgConfig struct {
	Org                     string   `yaml:"org"`
	BillingManagerGroup     string   `yaml:"org-billingmanager-group,omitempty"`
	ManagerGroup            string   `yaml:"org-manager-group,omitempty"`
	AuditorGroup            string   `yaml:"org-auditor-group,omitempty"`
	BillingManager          UserMgmt `yaml:"org-billingmanager"`
	Manager                 UserMgmt `yaml:"org-manager"`
	Auditor                 UserMgmt `yaml:"org-auditor"`
	PrivateDomains          []string `yaml:"private-domains"`
	RemovePrivateDomains    bool     `yaml:"enable-remove-private-domains"`
	EnableOrgQuota          bool     `yaml:"enable-org-quota"`
	MemoryLimit             int      `yaml:"memory-limit"`
	InstanceMemoryLimit     int      `yaml:"instance-memory-limit"`
	TotalRoutes             int      `yaml:"total-routes"`
	TotalServices           int      `yaml:"total-services"`
	PaidServicePlansAllowed bool     `yaml:"paid-service-plans-allowed"`
	RemoveUsers             bool     `yaml:"enable-remove-users"`
	TotalPrivateDomains     int      `yaml:"total_private_domains"`
	TotalReservedRoutePorts int      `yaml:"total_reserved_route_ports"`
	TotalServiceKeys        int      `yaml:"total_service_keys"`
	AppInstanceLimit        int      `yaml:"app_instance_limit"`
	DefaultIsoSegment       string   `yaml:"default_isolation_segment"`
}

OrgConfig describes configuration for an org.

func (*OrgConfig) GetAuditorGroups added in v0.0.68

func (o *OrgConfig) GetAuditorGroups() []string

func (*OrgConfig) GetBillingManagerGroups added in v0.0.68

func (o *OrgConfig) GetBillingManagerGroups() []string

func (*OrgConfig) GetManagerGroups added in v0.0.68

func (o *OrgConfig) GetManagerGroups() []string

type Orgs added in v0.0.68

type Orgs struct {
	Orgs             []string `yaml:"orgs"`
	EnableDeleteOrgs bool     `yaml:"enable-delete-orgs"`
	ProtectedOrgs    []string `yaml:"protected_orgs"`
}

Orgs contains cf-mgmt configuration for all orgs.

func (*Orgs) Contains added in v0.0.68

func (o *Orgs) Contains(orgName string) bool

Contains determines whether an org is present in a list of orgs.

type Reader added in v0.0.68

type Reader interface {
	Orgs() (Orgs, error)
	OrgSpaces(orgName string) (*Spaces, error)
	Spaces() ([]Spaces, error)
	GetOrgConfigs() ([]OrgConfig, error)
	GetSpaceConfigs() ([]SpaceConfig, error)
	GetASGConfigs() ([]ASGConfig, error)
	GetGlobalConfig() (GlobalConfig, error)
	GetSpaceDefaults() (*SpaceConfig, error)
	GetOrgConfig(orgName string) (*OrgConfig, error)
	GetSpaceConfig(orgName, spaceName string) (*SpaceConfig, error)
}

Reader is used to read the cf-mgmt configuration.

type SpaceConfig added in v0.0.48

type SpaceConfig struct {
	Org                     string   `yaml:"org"`
	Space                   string   `yaml:"space"`
	Developer               UserMgmt `yaml:"space-developer"`
	Manager                 UserMgmt `yaml:"space-manager"`
	Auditor                 UserMgmt `yaml:"space-auditor"`
	DeveloperGroup          string   `yaml:"space-developer-group,omitempty"`
	ManagerGroup            string   `yaml:"space-manager-group,omitempty"`
	AuditorGroup            string   `yaml:"space-auditor-group,omitempty"`
	AllowSSH                bool     `yaml:"allow-ssh"`
	EnableSpaceQuota        bool     `yaml:"enable-space-quota"`
	MemoryLimit             int      `yaml:"memory-limit"`
	InstanceMemoryLimit     int      `yaml:"instance-memory-limit"`
	TotalRoutes             int      `yaml:"total-routes"`
	TotalServices           int      `yaml:"total-services"`
	PaidServicePlansAllowed bool     `yaml:"paid-service-plans-allowed"`
	EnableSecurityGroup     bool     `yaml:"enable-security-group"`
	SecurityGroupContents   string   `yaml:"security-group-contents,omitempty"`
	RemoveUsers             bool     `yaml:"enable-remove-users"`
	TotalPrivateDomains     int      `yaml:"total_private_domains"`
	TotalReservedRoutePorts int      `yaml:"total_reserved_route_ports"`
	TotalServiceKeys        int      `yaml:"total_service_keys"`
	AppInstanceLimit        int      `yaml:"app_instance_limit"`
	IsoSegment              string   `yaml:"isolation_segment"`
	ASGs                    []string `yaml:"named-security-groups"`
}

SpaceConfig describes attributes for a space.

func (*SpaceConfig) GetAuditorGroups added in v0.0.68

func (i *SpaceConfig) GetAuditorGroups() []string

func (*SpaceConfig) GetDeveloperGroups added in v0.0.68

func (i *SpaceConfig) GetDeveloperGroups() []string

func (*SpaceConfig) GetManagerGroups added in v0.0.68

func (i *SpaceConfig) GetManagerGroups() []string

type Spaces added in v0.0.68

type Spaces struct {
	Org                string   `yaml:"org"`
	Spaces             []string `yaml:"spaces"`
	EnableDeleteSpaces bool     `yaml:"enable-delete-spaces"`
}

Spaces describes cf-mgmt config for all spaces.

func (*Spaces) Contains added in v0.0.68

func (s *Spaces) Contains(spaceName string) bool

Contains determines whether a space is present in a list of spaces.

type Updater added in v0.0.68

type Updater interface {
	AddOrgToConfig(orgConfig *OrgConfig) error
	AddSpaceToConfig(spaceConfig *SpaceConfig) error
	AddSecurityGroupToSpace(orgName, spaceName string, securityGroupDefinition []byte) error
	AddSecurityGroup(securityGroupName string, securityGroupDefinition []byte) error
	CreateConfigIfNotExists(uaaOrigin string) error
	DeleteConfigIfExists() error

	SaveSpaceConfig(spaceConfig *SpaceConfig) error
	SaveOrgConfig(orgConfig *OrgConfig) error

	DeleteOrgConfig(orgName string) error
	DeleteSpaceConfig(orgName, spaceName string) error
}

Updater is used to update the cf-mgmt configuration.

type UserMgmt added in v0.0.68

type UserMgmt struct {
	LDAPUsers  []string `yaml:"ldap_users"`
	Users      []string `yaml:"users"`
	SamlUsers  []string `yaml:"saml_users"`
	LDAPGroup  string   `yaml:"ldap_group,omitempty"`
	LDAPGroups []string `yaml:"ldap_groups"`
}

UserMgmt specifies users and groups that can be associated to a particular org or space.

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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