util

package
v0.0.0-...-6cb485d Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const OrgsURL = "/v2/organizations"

OrgsURL represents the organizations url path

Variables

This section is empty.

Functions

func CheckUserScope

func CheckUserScope(jwtToken, scope string) (bool, error)

CheckUserScope takes a jwt token and checks for a given uaa scope

func CreateBackupJSON

func CreateBackupJSON(backupModel models.BackupModel) (string, error)

CreateBackupJSON creates backup json

func FreakOut

func FreakOut(err error)

FreakOut logs error and exits the program with exit code 1

func GetFeatureFlags

func GetFeatureFlags(ccAPI cCApi) (*[]*models.FeatureFlagModel, error)

GetFeatureFlags returns feature flags

func GetOrgQuotaDefinitions

func GetOrgQuotaDefinitions(ccAPI cCApi) (interface{}, error)

GetOrgQuotaDefinitions returns the Organization Quota definitions

func GetOrgsResourcesRecurively

func GetOrgsResourcesRecurively(ccAPI cCApi) ([]*models.ResourceModel, error)

GetOrgsResourcesRecurively returns all orgs

func GetResources

func GetResources(cliConnection plugin.CliConnection, url string, relationsDepth int) []*models.ResourceModel

GetResources retrieves resources for a given url

func GetSecurityGroups

func GetSecurityGroups(ccAPI cCApi) (interface{}, error)

GetSecurityGroups return security groups

func GetSharedDomains

func GetSharedDomains(ccAPI cCApi) (interface{}, error)

GetSharedDomains returns shared domains

func GetSpaceQuotaDefinitions

func GetSpaceQuotaDefinitions(ccAPI cCApi) (interface{}, error)

GetSpaceQuotaDefinitions returns the Spaces Quota definitions

func ReadBackupJSON

func ReadBackupJSON(jsonBytes []byte) (*models.BackupModel, error)

ReadBackupJSON reads backup json

func RestoreFlagsResourceModels

func RestoreFlagsResourceModels(flagResources interface{}) *[]*models.FeatureFlagModel

RestoreFlagsResourceModels gets flags as resource models

func RestoreOrgResourceModels

func RestoreOrgResourceModels(orgResources interface{}) *[]*models.ResourceModel

RestoreOrgResourceModels gets orgs as resource models

func RestoreQuotaResourceModels

func RestoreQuotaResourceModels(quotaResources interface{}) *[]*models.ResourceModel

RestoreQuotaResourceModels gets quotas as resource models

func RestoreSpaceQuotaResourceModels

func RestoreSpaceQuotaResourceModels(spaceQuotaResources interface{}) *[]*models.ResourceModel

RestoreSpaceQuotaResourceModels gets space quotas as resource models

Types

type CCResources

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

CCResources represents cc resources

func CreateFeatureFlagsCCResources

func CreateFeatureFlagsCCResources(ccAPI cCApi) *CCResources

CreateFeatureFlagsCCResources creates feature flags resources

func CreateOrgCCResources

func CreateOrgCCResources(ccAPI cCApi) *CCResources

CreateOrgCCResources creates org resource

func CreateQuotaCCResources

func CreateQuotaCCResources(ccAPI cCApi) *CCResources

CreateQuotaCCResources creates quota org resources

func CreateSecurityGroupsCCResources

func CreateSecurityGroupsCCResources(ccAPI cCApi) *CCResources

CreateSecurityGroupsCCResources creates security groups resources

func CreateSharedDomainsCCResources

func CreateSharedDomainsCCResources(ccAPI cCApi) *CCResources

CreateSharedDomainsCCResources creates shared domains resources

func CreateSpaceQuotaCCResources

func CreateSpaceQuotaCCResources(ccAPI cCApi) *CCResources

CreateSpaceQuotaCCResources creates space quota org resources

func (*CCResources) GetResource

func (ccResources *CCResources) GetResource(url string, relationsDepth int) *models.ResourceModel

GetResource gets a resource

func (*CCResources) GetResources

func (ccResources *CCResources) GetResources(url string, relationsDepth int) []*models.ResourceModel

GetResources gets resources

func (*CCResources) TransformToResourceModels

func (ccResources *CCResources) TransformToResourceModels(resources interface{}) *[]*models.ResourceModel

TransformToResourceModels transforms interface to resource models

type CFDroplet

type CFDroplet struct {
	Cli        plugin.CliConnection
	Packager   Packager
	HTTPClient *http.Client
}

CFDroplet utility for saving and whatnot.

func NewCFDroplet

func NewCFDroplet(cli plugin.CliConnection, packager Packager) *CFDroplet

NewCFDroplet builds a new CF droplet

func (*CFDroplet) GetPackager

func (d *CFDroplet) GetPackager() *Packager

GetPackager attached to this dropplet.

func (*CFDroplet) SaveDroplet

func (d *CFDroplet) SaveDroplet(guid string, path string) error

SaveDroplet to the local filesystem.

func (*CFDroplet) UploadDroplet

func (d *CFDroplet) UploadDroplet(guid, path string) error

UploadDroplet uploads an apps droplet

type CFFileReader

type CFFileReader struct {
}

CFFileReader is a wrapper for ioutil.ReadFile

func (*CFFileReader) ReadFile

func (fr *CFFileReader) ReadFile(filename string) ([]byte, error)

ReadFile reads a file

type CFFileWriter

type CFFileWriter struct {
}

CFFileWriter is a wrapper for ioutil.WriteFile

func (*CFFileWriter) WriteFile

func (fw *CFFileWriter) WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFile to disk

type CFPackager

type CFPackager struct {
	Cli    plugin.CliConnection
	Writer FileWriter
	Reader FileReader
}

CFPackager real implementation to download droplets.

func (*CFPackager) GetDroplet

func (packager *CFPackager) GetDroplet(guid string) ([]byte, error)

GetDroplet from CF

func (*CFPackager) SaveDropletToFile

func (packager *CFPackager) SaveDropletToFile(filePath string, data []byte) error

SaveDropletToFile writes a downloaded droplet to file

func (*CFPackager) UploadDroplet

func (packager *CFPackager) UploadDroplet(guid, path string) error

UploadDroplet uploads an apps droplet

type CliConnectionCCApi

type CliConnectionCCApi struct {
	CliConnection plugin.CliConnection
}

CliConnectionCCApi represents the cf cli connection

func (*CliConnectionCCApi) InvokeGet

func (ccAPI *CliConnectionCCApi) InvokeGet(path string) (string, error)

InvokeGet invokes GET on a given path

type Droplet

type Droplet interface {
	SaveDroplet(name string, path string) error
	GetPackager() *Packager
	UploadDroplet(name, path string) error
}

Droplet interface

type FileReader

type FileReader interface {
	ReadFile(filename string) ([]byte, error)
}

FileReader test shim for reading a file.

type FileWriter

type FileWriter interface {
	WriteFile(filename string, data []byte, perm os.FileMode) error
}

FileWriter test shim for writing to a file.

type Packager

type Packager interface {
	GetDroplet(guid string) ([]byte, error)
	SaveDropletToFile(filePath string, data []byte) error
	UploadDroplet(guid, path string) error
}

Packager interaface for implementing downloaders.

Jump to

Keyboard shortcuts

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