apihelper

package
v0.0.0-...-c9320f9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrManagedServiceNotFound = errors.New("managed service not found")
)
View Source
var (
	ErrManagedServicePlanNotFound = errors.New("managed service plan not found")
)
View Source
var (
	ErrOrgNotFound = errors.New("organization not found")
)
View Source
var (
	ErrSharedDomainNotFound = errors.New("shared domain not found")
)

Functions

This section is empty.

Types

type APIHelper

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

APIHelper implementation

func (*APIHelper) CheckApp

func (api *APIHelper) CheckApp(mapp App, rservices IServices, spaceguid string, create bool) (ImportedApp, error)

func (*APIHelper) CheckOrg

func (api *APIHelper) CheckOrg(name string, create bool) (ImportedOrg, error)

func (*APIHelper) CheckServiceInstance

func (api *APIHelper) CheckServiceInstance(service Service, spaceguid string, create bool) (ImportedService, error)

func (*APIHelper) CheckSpace

func (api *APIHelper) CheckSpace(name string, orgguid string, create bool) (ImportedSpace, error)

func (*APIHelper) GetBlob

func (api *APIHelper) GetBlob(orgname string, spacename string, blobURL string, filename string, swg *sizedwaitgroup.SizedWaitGroup)

Download file

func (*APIHelper) GetDomainGuid

func (api *APIHelper) GetDomainGuid(name string) (string, error)

GetDomainGuid returns a shared domain guid

func (*APIHelper) GetOrg

func (api *APIHelper) GetOrg(name string) (Organization, error)

GetOrg returns a struct that represents critical fields in the JSON

func (*APIHelper) GetOrgQuota

func (api *APIHelper) GetOrgQuota() (Quotas, error)

GetOrgQuota returns Quotas

func (*APIHelper) GetOrgSpaces

func (api *APIHelper) GetOrgSpaces(spacesURL string) (Spaces, error)

GetOrgSpaces returns the spaces in an org.

func (*APIHelper) GetOrgs

func (api *APIHelper) GetOrgs() (Orgs, error)

GetOrgs returns a struct that represents critical fields in the JSON

func (*APIHelper) GetQuotaMemoryLimit

func (api *APIHelper) GetQuotaMemoryLimit(quotaURL string) (float64, error)

GetQuotaMemoryLimit retruns the amount of memory (in MB) that the org is allowed

func (*APIHelper) GetSecurityGroups

func (api *APIHelper) GetSecurityGroups() (map[string]SecurityGroup, error)

GetSecurityGroups returns SecurityGroups

func (*APIHelper) GetServiceInstanceGuid

func (api *APIHelper) GetServiceInstanceGuid(name string, stype string, spaceguid string) (string, error)

GetServiceInstanceGuid returns a service instance guid

func (*APIHelper) GetSpaceAppsAndServices

func (api *APIHelper) GetSpaceAppsAndServices(space Space) (Apps, Services, SecurityGroups, SecurityGroups, error)

GetSpaceAppsAndServices returns the apps and the services in a space

func (*APIHelper) PutBlob

func (api *APIHelper) PutBlob(blobURL string, filename string, swg *sizedwaitgroup.SizedWaitGroup)

Upload file

func (*APIHelper) StartApp

func (api *APIHelper) StartApp(appguid string) error

type App

type App struct {
	Guid                    string
	Name                    string
	Memory                  float64
	Instances               float64
	DiskQuota               float64
	State                   string
	Command                 string
	HealthCheckType         string
	HealthCheckTimeout      float64
	HealthCheckHttpEndpoint string
	Diego                   bool
	EnableSsh               bool
	EnviornmentVar          map[string]interface{}
	ServiceNames            []interface{}
	URLs                    []interface{}
}

App representation

type Apps

type Apps []App

func GetApps

func GetApps(api *APIHelper, spaceGuid string, summaryJSON map[string]interface{}) (Apps, error)

type CFAPIHelper

type CFAPIHelper interface {
	GetOrgs() (Orgs, error)
	GetOrg(string) (Organization, error)
	GetDomainGuid(name string) (string, error)
	GetServiceInstanceGuid(name string, stype string, spaceguid string) (string, error)
	GetOrgQuota() (Quotas, error)
	GetSecurityGroups() (map[string]SecurityGroup, error)
	GetQuotaMemoryLimit(string) (float64, error)
	GetOrgSpaces(string) (Spaces, error)
	GetSpaceAppsAndServices(space Space) (Apps, Services, SecurityGroups, SecurityGroups, error)
	GetBlob(orgname string, spacename string, blobURL string, filename string, swg *sizedwaitgroup.SizedWaitGroup)
	PutBlob(blobURL string, filename string, swg *sizedwaitgroup.SizedWaitGroup)
	CheckOrg(name string, create bool) (ImportedOrg, error)
	CheckSpace(name string, orgguid string, create bool) (ImportedSpace, error)
	CheckApp(mapp App, rservices IServices, spaceguid string, create bool) (ImportedApp, error)
	StartApp(appguid string) error
	CheckServiceInstance(service Service, spaceguid string, create bool) (ImportedService, error)
}

CFAPIHelper to wrap cf curl results

func New

type IApps

type IApps []ImportedApp

type IOrgs

type IOrgs []ImportedOrg

type IServices

type IServices []ImportedService

type ISpaces

type ISpaces []ImportedSpace

type ImportedApp

type ImportedApp struct {
	Guid     string
	Name     string
	Droplet  string
	Src      string
	OrgState string
}

type ImportedOrg

type ImportedOrg struct {
	Guid   string
	Name   string
	Spaces ISpaces
}

type ImportedService

type ImportedService struct {
	Guid string
	Name string
}

type ImportedSpace

type ImportedSpace struct {
	Guid     string
	Name     string
	Apps     IApps
	Services IServices
}

type Organization

type Organization struct {
	Name      string
	QuotaGUID string
	SpacesURL string
}

Organization representation

type Orgs

type Orgs []Organization

type Quota

type Quota struct {
	Name                    string
	NonBasicServicesAllowed bool
	TotalServices           float64
	TotalRoutes             float64
	TotalPrivateDomain      float64
	MemoryLimit             float64
	TrialDBAllowed          bool
	InstanceMemoryLimit     float64
	AppInstanceLimit        float64
	AppTaskLimit            float64
	TotalServiceKeys        float64
	TotalReservedRoutePorts float64
}

type Quotas

type Quotas map[string]Quota

type Rule

type Rule struct {
	Description string
	Destination string
	Log         bool
	Ports       string
	Protocol    string
}

type Rules

type Rules []Rule

type SecurityGroup

type SecurityGroup struct {
	Name           string
	Rules          Rules
	RunningDefault bool
	StagingDefault bool
}

type SecurityGroups

type SecurityGroups []SecurityGroup

func GetSecurityGroups

func GetSecurityGroups(api *APIHelper, securityGroupURL string) (SecurityGroups, error)

type Service

type Service struct {
	InstanceName string
	Label        string
	ServicePlan  string
	Type         string
	Credentials  map[string]interface{}
	SyslogDrain  string
}

Service representation

type Services

type Services []Service

func GetServices

func GetServices(api *APIHelper, summaryJSON map[string]interface{}) (Services, error)

type Space

type Space struct {
	Guid                    string
	Name                    string
	SummaryURL              string
	SecurityGroupURL        string
	StagingSecurityGroupURL string
}

Space representation

type Spaces

type Spaces []Space

Jump to

Keyboard shortcuts

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