Documentation ¶
Overview ¶
Package config provides utilities for reading and writing cf-mgmt's configuration.
Index ¶
- Constants
- Variables
- func AsString(i *int) string
- func ByteSize(bytes *int) string
- func DeleteDirectory(path string) error
- func FileOrDirectoryExists(path string) bool
- func FindFiles(configDir, pattern string) ([]string, error)
- func FutureTime(t time.Time, timeToAdd string) (string, error)
- func LoadFile(configFile string, dataType interface{}) error
- func LoadFileBytes(path string) ([]byte, error)
- func RenameDirectory(originalDirectory, newDirectory string) error
- func StringToMegabytes(s string) (string, error)
- func ToInteger(s string) (*int, error)
- func ToMegabytes(s string) (*int, error)
- func WriteFile(configFile string, dataType interface{}) error
- func WriteFileBytes(configFile string, data []byte) error
- type ASGConfig
- type Broker
- type GlobalConfig
- type LdapConfig
- type Manager
- type Metadata
- type OrgConfig
- type OrgQuota
- type Orgs
- type PlanInfo
- type PlanVisibility
- type Reader
- type Service
- func (s *Service) AddAllAccessPlan(planName string)
- func (s *Service) AddLimitedAccessPlan(planName string, orgsToAdd, orgsToRemove []string)
- func (s *Service) AddNoAccessPlan(planName string)
- func (s *Service) GetLimitedPlan(planName string) *PlanVisibility
- func (s *Service) LimitedAccessPlanNames() []string
- type SharedDomain
- type SpaceConfig
- func (i *SpaceConfig) GetAuditorGroups() []string
- func (i *SpaceConfig) GetDeveloperGroups() []string
- func (i *SpaceConfig) GetManagerGroups() []string
- func (s *SpaceConfig) GetQuota() SpaceQuota
- func (s *SpaceConfig) GetSecurityGroupContents() string
- func (i *SpaceConfig) GetSupporterGroups() []string
- type SpaceQuota
- type Spaces
- type Updater
- type UserMgmt
- type UserOrigin
Constants ¶
const ( MEGABYTE = 1.0 GIGABYTE = 1024 * MEGABYTE TERABYTE = 1000000 * MEGABYTE )
const UNLIMITED = "unlimited"
Variables ¶
var DefaultProtectedOrgs = []string{
"^system$",
"splunk-nozzle-org",
"redis-test-ORG",
"appdynamics-org",
"credhub-service-broker-org",
"^p-",
}
DefaultProtectedOrgs lists the organizations that are considered protected and should never be deleted by cf-mgmt. Note that these are regexes.
Functions ¶
func DeleteDirectory ¶ added in v0.0.68
DeleteDirectory - deletes a directory
func FileOrDirectoryExists ¶ added in v0.0.68
FileOrDirectoryExists - checks if file exists
func LoadFileBytes ¶ added in v0.0.68
LoadFileBytes - Load a file and return the bytes
func RenameDirectory ¶ added in v1.0.9
RenameDirectory -
func StringToMegabytes ¶ added in v1.0.12
func ToMegabytes ¶ added in v1.0.12
func WriteFileBytes ¶ added in v0.0.68
WriteFileBytes -
Types ¶
type Broker ¶ added in v1.0.31
func (*Broker) GetService ¶ added in v1.0.31
type GlobalConfig ¶ added in v0.0.68
type GlobalConfig struct { EnableDeleteIsolationSegments bool `yaml:"enable-delete-isolation-segments"` EnableUnassignSecurityGroups bool `yaml:"enable-unassign-security-groups"` SkipUnassignSecurityGroupRegex string `yaml:"skip-unassign-security-group-regex"` RunningSecurityGroups []string `yaml:"running-security-groups"` StagingSecurityGroups []string `yaml:"staging-security-groups"` MetadataPrefix string `yaml:"metadata-prefix"` EnableServiceAccess bool `yaml:"enable-service-access"` IgnoreLegacyServiceAccess bool `yaml:"ignore-legacy-service-access"` ServiceAccess []*Broker `yaml:"service-access"` ProtectedUsers []string `yaml:"protected-users"` }
GlobalConfig configuration for global settings
func (*GlobalConfig) GetBroker ¶ added in v1.0.31
func (g *GlobalConfig) GetBroker(brokerName string) *Broker
func (*GlobalConfig) GetPlanInfo ¶ added in v1.0.31
func (g *GlobalConfig) GetPlanInfo(brokerName, serviceName, planName string) PlanInfo
type LdapConfig ¶ added in v1.0.0
type LdapConfig struct { Enabled bool `yaml:"enabled"` LdapHost string `yaml:"ldapHost"` LdapPort int `yaml:"ldapPort"` TLS bool `yaml:"use_tls"` BindDN string `yaml:"bindDN"` BindPassword string `yaml:"bindPwd,omitempty"` UserSearchBase string `yaml:"userSearchBase"` UserNameAttribute string `yaml:"userNameAttribute"` UserMailAttribute string `yaml:"userMailAttribute"` UserObjectClass string `yaml:"userObjectClass"` GroupSearchBase string `yaml:"groupSearchBase"` GroupAttribute string `yaml:"groupAttribute"` GroupObjectClass string `yaml:"groupObjectClass"` Origin string `yaml:"origin"` InsecureSkipVerify string `yaml:"insecure_skip_verify"` CACert string `yaml:"ca_cert"` UseIDForSAMLUser bool `yaml:"useIDForSAMLUser"` MinTLSVersion string `yaml:"minTLSVersion"` MaxTLSVersion string `yaml:"maxTLSVersion"` }
Config -
type Manager ¶
Manager can read and write the cf-mgmt configuration.
func NewManager ¶
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"` OriginalOrg string `yaml:"original-org,omitempty"` 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 string `yaml:"memory-limit,omitempty"` InstanceMemoryLimit string `yaml:"instance-memory-limit,omitempty"` TotalRoutes string `yaml:"total-routes,omitempty"` TotalServices string `yaml:"total-services,omitempty"` PaidServicePlansAllowed bool `yaml:"paid-service-plans-allowed"` RemoveUsers bool `yaml:"enable-remove-users"` TotalPrivateDomains string `yaml:"total_private_domains,omitempty"` TotalReservedRoutePorts string `yaml:"total_reserved_route_ports,omitempty"` TotalServiceKeys string `yaml:"total_service_keys,omitempty"` AppInstanceLimit string `yaml:"app_instance_limit,omitempty"` AppTaskLimit string `yaml:"app_task_limit,omitempty"` LogRateLimitBytesPerSecond string `yaml:"log_rate_limit_bytes_per_second,omitempty"` DefaultIsoSegment string `yaml:"default_isolation_segment"` ServiceAccess map[string][]string `yaml:"service-access,omitempty"` NamedQuota string `yaml:"named_quota"` Metadata *Metadata `yaml:"metadata"` }
OrgConfig describes configuration for an org.
func (*OrgConfig) GetAuditorGroups ¶ added in v0.0.68
func (*OrgConfig) GetBillingManagerGroups ¶ added in v0.0.68
func (*OrgConfig) GetManagerGroups ¶ added in v0.0.68
type OrgQuota ¶ added in v1.0.12
type OrgQuota struct { Name string `yaml:"-"` TotalPrivateDomains string `yaml:"total_private_domains"` TotalReservedRoutePorts string `yaml:"total_reserved_route_ports"` TotalServiceKeys string `yaml:"total_service_keys"` AppInstanceLimit string `yaml:"app_instance_limit"` AppTaskLimit string `yaml:"app_task_limit"` MemoryLimit string `yaml:"memory-limit"` InstanceMemoryLimit string `yaml:"instance-memory-limit"` TotalRoutes string `yaml:"total-routes"` TotalServices string `yaml:"total-services"` PaidServicePlansAllowed bool `yaml:"paid-service-plans-allowed"` LogRateLimitBytesPerSecond string `yaml:"log_rate_limit_bytes_per_second"` }
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
Contains determines whether an org is present in a list of orgs.
func (*Orgs) ProtectedOrgList ¶ added in v1.0.8
type PlanVisibility ¶ added in v1.0.31
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) GetDefaultASGConfigs() ([]ASGConfig, error) GetGlobalConfig() (*GlobalConfig, error) GetSpaceDefaults() (*SpaceConfig, error) GetOrgConfig(orgName string) (*OrgConfig, error) GetSpaceConfig(orgName, spaceName string) (*SpaceConfig, error) LdapConfig(bindUser, bindPassword, ldapServer string) (*LdapConfig, error) GetOrgQuotas() ([]OrgQuota, error) GetSpaceQuotas(org string) ([]SpaceQuota, error) GetOrgQuota(name string) (*OrgQuota, error) GetSpaceQuota(name, org string) (*SpaceQuota, error) }
Reader is used to read the cf-mgmt configuration.
type Service ¶ added in v1.0.31
type Service struct { Name string `yaml:"service"` AllAccessPlans []string `yaml:"all_access_plans,omitempty"` LimitedAccessPlans []*PlanVisibility `yaml:"limited_access_plans,omitempty"` NoAccessPlans []string `yaml:"no_access_plans,omitempty"` }
func (*Service) AddAllAccessPlan ¶ added in v1.0.31
func (*Service) AddLimitedAccessPlan ¶ added in v1.0.31
func (*Service) AddNoAccessPlan ¶ added in v1.0.31
func (*Service) GetLimitedPlan ¶ added in v1.0.31
func (s *Service) GetLimitedPlan(planName string) *PlanVisibility
func (*Service) LimitedAccessPlanNames ¶ added in v1.0.31
type SharedDomain ¶ added in v1.0.12
type SharedDomain struct {}
type SpaceConfig ¶ added in v0.0.48
type SpaceConfig struct { Org string `yaml:"org"` Space string `yaml:"space"` OriginalSpace string `yaml:"original-space,omitempty"` Developer UserMgmt `yaml:"space-developer"` Manager UserMgmt `yaml:"space-manager"` Auditor UserMgmt `yaml:"space-auditor"` Supporter UserMgmt `yaml:"space-supporter"` DeveloperGroup string `yaml:"space-developer-group,omitempty"` ManagerGroup string `yaml:"space-manager-group,omitempty"` AuditorGroup string `yaml:"space-auditor-group,omitempty"` SupporterGroup string `yaml:"space-supporter-group,omitempty"` AllowSSH bool `yaml:"allow-ssh"` AllowSSHUntil string `yaml:"allow-ssh-until,omitempty"` EnableSpaceQuota bool `yaml:"enable-space-quota"` EnableSecurityGroup bool `yaml:"enable-security-group"` EnableUnassignSecurityGroup bool `yaml:"enable-unassign-security-group"` SecurityGroupContents string `yaml:"security-group-contents,omitempty"` RemoveUsers bool `yaml:"enable-remove-users"` IsoSegment string `yaml:"isolation_segment"` ASGs []string `yaml:"named-security-groups"` MemoryLimit string `yaml:"memory-limit,omitempty"` InstanceMemoryLimit string `yaml:"instance-memory-limit,omitempty"` TotalRoutes string `yaml:"total-routes,omitempty"` TotalServices string `yaml:"total-services,omitempty"` PaidServicePlansAllowed bool `yaml:"paid-service-plans-allowed"` TotalReservedRoutePorts string `yaml:"total_reserved_route_ports,omitempty"` TotalServiceKeys string `yaml:"total_service_keys,omitempty"` AppInstanceLimit string `yaml:"app_instance_limit,omitempty"` AppTaskLimit string `yaml:"app_task_limit,omitempty"` LogRateLimitBytesPerSecond string `yaml:"log_rate_limit_bytes_per_second,omitempty"` NamedQuota string `yaml:"named_quota"` Metadata *Metadata `yaml:"metadata"` }
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
func (*SpaceConfig) GetQuota ¶ added in v1.0.12
func (s *SpaceConfig) GetQuota() SpaceQuota
func (*SpaceConfig) GetSecurityGroupContents ¶ added in v1.0.26
func (s *SpaceConfig) GetSecurityGroupContents() string
func (*SpaceConfig) GetSupporterGroups ¶ added in v1.0.52
func (i *SpaceConfig) GetSupporterGroups() []string
type SpaceQuota ¶ added in v1.0.12
type SpaceQuota struct { Name string `yaml:"-"` Org string `yaml:"-"` MemoryLimit string `yaml:"memory-limit"` InstanceMemoryLimit string `yaml:"instance-memory-limit"` TotalRoutes string `yaml:"total-routes"` TotalServices string `yaml:"total-services"` PaidServicePlansAllowed bool `yaml:"paid-service-plans-allowed"` TotalReservedRoutePorts string `yaml:"total_reserved_route_ports"` TotalServiceKeys string `yaml:"total_service_keys"` AppInstanceLimit string `yaml:"app_instance_limit"` AppTaskLimit string `yaml:"app_task_limit"` LogRateLimitBytesPerSecond string `yaml:"log_rate_limit_bytes_per_second"` }
func (*SpaceQuota) IsUnlimitedMemory ¶ added in v1.0.12
func (s *SpaceQuota) IsUnlimitedMemory() bool
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.
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 AddOrgQuota(orgQuota OrgQuota) error AddSpaceQuota(spaceQuota SpaceQuota) error AddDefaultSecurityGroup(securityGroupName string, securityGroupDefinition []byte) error CreateConfigIfNotExists(uaaOrigin string) error DeleteConfigIfExists() error AssociateOrgAuditor(origin UserOrigin, orgName, user string) error AssociateSpaceDeveloper(origin UserOrigin, orgName, spaceName, user string) error AssociateSpaceAuditor(origin UserOrigin, orgName, spaceName, user string) error SaveOrgSpaces(spaces *Spaces) error SaveSpaceConfig(spaceConfig *SpaceConfig) error SaveOrgConfig(orgConfig *OrgConfig) error RenameOrgConfig(orgConfig *OrgConfig) error RenameSpaceConfig(spaceConfig *SpaceConfig) error DeleteOrgConfig(orgName string) error DeleteSpaceConfig(orgName, spaceName string) error SaveOrgs(*Orgs) error SaveGlobalConfig(*GlobalConfig) error SaveOrgQuota(*OrgQuota) error SaveSpaceQuota(*SpaceQuota) 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.
type UserOrigin ¶ added in v1.0.45
type UserOrigin int
UserOrigin is an enum type encoding from what source a user originated. Choices are: internal, saml, ldap. If you give a UserOrigin value that lies outside of these options, the behaviour is undefined.
const ( // InternalOrigin corresponds to a UAA user InternalOrigin UserOrigin = iota // SAMLOrigin corresponds to a SAML backed user SAMLOrigin // LDAPOrigin corresponds to a LDAP backed user LDAPOrigin )