repositories

package
v0.0.0-...-d88c78e Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StartedState DesiredState = "STARTED"
	StoppedState DesiredState = "STOPPED"

	Kind            string = "CFApp"
	APIVersion      string = "workloads.cloudfoundry.org/v1alpha1"
	TimestampFormat string = time.RFC3339
	CFAppGUIDLabel  string = "apps.cloudfoundry.org/appGuid"
)
View Source
const (
	BuildStateStaging = "STAGING"
	BuildStateStaged  = "STAGED"
	BuildStateFailed  = "FAILED"

	StagingConditionType   = "Staging"
	SucceededConditionType = "Succeeded"
)
View Source
const (
	OrgNameLabel   = "cloudfoundry.org/org-name"
	SpaceNameLabel = "cloudfoundry.org/space-name"
)
View Source
const (
	PackageStateAwaitingUpload = "AWAITING_UPLOAD"
	PackageStateReady          = "READY"
)

Variables

This section is empty.

Functions

func BuildCRClient

func BuildCRClient(config *rest.Config) (crclient.Client, error)

func BuildK8sClient

func BuildK8sClient(config *rest.Config) (k8sclient.Interface, error)

func UploadSourceImage

func UploadSourceImage(imageRef string, packageSrcFile multipart.File, credentialOption remote.Option) (imageRefWithDigest string, err error)

Types

type AppEnvVarsRecord

type AppEnvVarsRecord struct {
	Name                 string
	AppGUID              string
	SpaceGUID            string
	EnvironmentVariables map[string]string
}

type AppRecord

type AppRecord struct {
	Name          string
	GUID          string
	SpaceGUID     string
	DropletGUID   string
	Labels        map[string]string
	Annotations   map[string]string
	State         DesiredState
	Lifecycle     Lifecycle
	EnvSecretName string
	CreatedAt     string
	UpdatedAt     string
}

type AppRepo

type AppRepo struct{}

func (*AppRepo) CreateApp

func (f *AppRepo) CreateApp(ctx context.Context, client client.Client, appRecord AppRecord) (AppRecord, error)

func (*AppRepo) CreateAppEnvironmentVariables

func (f *AppRepo) CreateAppEnvironmentVariables(ctx context.Context, client client.Client, envVariables AppEnvVarsRecord) (AppEnvVarsRecord, error)

func (*AppRepo) FetchApp

func (f *AppRepo) FetchApp(ctx context.Context, client client.Client, appGUID string) (AppRecord, error)

func (*AppRepo) FetchAppList

func (f *AppRepo) FetchAppList(ctx context.Context, client client.Client) ([]AppRecord, error)

func (*AppRepo) FetchNamespace

func (f *AppRepo) FetchNamespace(ctx context.Context, client client.Client, nsGUID string) (SpaceRecord, error)

func (*AppRepo) SetAppDesiredState

func (f *AppRepo) SetAppDesiredState(ctx context.Context, c client.Client, message SetAppDesiredStateMessage) (AppRecord, error)

func (*AppRepo) SetCurrentDroplet

func (f *AppRepo) SetCurrentDroplet(ctx context.Context, c client.Client, message SetCurrentDropletMessage) (CurrentDropletRecord, error)

type AuthorizedNamespacesProvider

type AuthorizedNamespacesProvider interface {
	GetAuthorizedNamespaces(context.Context, authorization.Identity) ([]string, error)
}

type BuildCreateMessage

type BuildCreateMessage struct {
	AppGUID         string
	PackageGUID     string
	SpaceGUID       string
	StagingMemoryMB int
	StagingDiskMB   int
	Lifecycle       Lifecycle
	Labels          map[string]string
	Annotations     map[string]string
}

type BuildRecord

type BuildRecord struct {
	GUID            string
	State           string
	CreatedAt       string
	UpdatedAt       string
	StagingErrorMsg string
	StagingMemoryMB int
	StagingDiskMB   int
	Lifecycle       Lifecycle
	PackageGUID     string
	DropletGUID     string
	AppGUID         string
	Labels          map[string]string
	Annotations     map[string]string
}

type BuildRepo

type BuildRepo struct {
}

func (*BuildRepo) CreateBuild

func (b *BuildRepo) CreateBuild(ctx context.Context, k8sClient client.Client, message BuildCreateMessage) (BuildRecord, error)

func (*BuildRepo) FetchBuild

func (b *BuildRepo) FetchBuild(ctx context.Context, k8sClient client.Client, buildGUID string) (BuildRecord, error)

type CFOrgRepository

type CFOrgRepository interface {
	CreateOrg(context context.Context, org OrgRecord) (OrgRecord, error)
	FetchOrgs(context context.Context, orgNames []string) ([]OrgRecord, error)
}

type CurrentDropletRecord

type CurrentDropletRecord struct {
	AppGUID     string
	DropletGUID string
}

type DesiredState

type DesiredState string

type Destination

type Destination struct {
	GUID        string
	AppGUID     string
	ProcessType string
	Port        int
}

type DomainRecord

type DomainRecord struct {
	Name      string
	GUID      string
	CreatedAt string
	UpdatedAt string
}

type DomainRepo

type DomainRepo struct{}

func (*DomainRepo) FetchDomain

func (f *DomainRepo) FetchDomain(ctx context.Context, client client.Client, domainGUID string) (DomainRecord, error)

type DropletRecord

type DropletRecord struct {
	GUID            string
	State           string
	CreatedAt       string
	UpdatedAt       string
	DropletErrorMsg string
	Lifecycle       Lifecycle
	Stack           string
	ProcessTypes    map[string]string
	AppGUID         string
	PackageGUID     string
	Labels          map[string]string
	Annotations     map[string]string
}

type DropletRepo

type DropletRepo struct{}

func (*DropletRepo) FetchDroplet

func (r *DropletRepo) FetchDroplet(ctx context.Context, k8sClient client.Client, dropletGUID string) (DropletRecord, error)

type HealthCheck

type HealthCheck struct {
	Type string
	Data HealthCheckData
}

type HealthCheckData

type HealthCheckData struct {
	HTTPEndpoint             string
	InvocationTimeoutSeconds int64
	TimeoutSeconds           int64
}

type Lifecycle

type Lifecycle struct {
	Type string
	Data LifecycleData
}

type LifecycleData

type LifecycleData struct {
	Buildpacks []string
	Stack      string
}

type NotFoundError

type NotFoundError struct {
	Err error
}

func (NotFoundError) Error

func (e NotFoundError) Error() string

func (NotFoundError) Unwrap

func (e NotFoundError) Unwrap() error

type OrgRecord

type OrgRecord struct {
	Name        string
	GUID        string
	Suspended   bool
	Labels      map[string]string
	Annotations map[string]string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type OrgRepo

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

func NewOrgRepo

func NewOrgRepo(rootNamespace string, privilegedClient client.WithWatch, timeout time.Duration) *OrgRepo

func (*OrgRepo) CreateOrg

func (r *OrgRepo) CreateOrg(ctx context.Context, org OrgRecord) (OrgRecord, error)

func (*OrgRepo) CreateSpace

func (r *OrgRepo) CreateSpace(ctx context.Context, space SpaceRecord) (SpaceRecord, error)

func (*OrgRepo) FetchOrgs

func (r *OrgRepo) FetchOrgs(ctx context.Context, names []string) ([]OrgRecord, error)

func (*OrgRepo) FetchSpaces

func (r *OrgRepo) FetchSpaces(ctx context.Context, organizationGUIDs, names []string) ([]SpaceRecord, error)

type OrgRepoAuthDecorator

type OrgRepoAuthDecorator struct {
	CFOrgRepository
	// contains filtered or unexported fields
}

func NewOrgRepoAuthDecorator

func NewOrgRepoAuthDecorator(
	repo CFOrgRepository,
	identity authorization.Identity,
	nsProvider AuthorizedNamespacesProvider,
) *OrgRepoAuthDecorator

func (*OrgRepoAuthDecorator) FetchOrgs

func (r *OrgRepoAuthDecorator) FetchOrgs(ctx context.Context, names []string) ([]OrgRecord, error)

type PackageCreateMessage

type PackageCreateMessage struct {
	Type      string
	AppGUID   string
	SpaceGUID string
}

type PackageRecord

type PackageRecord struct {
	GUID      string
	Type      string
	AppGUID   string
	SpaceGUID string
	State     string
	CreatedAt string
	UpdatedAt string
}

type PackageRepo

type PackageRepo struct{}

func (*PackageRepo) CreatePackage

func (r *PackageRepo) CreatePackage(ctx context.Context, client client.Client, message PackageCreateMessage) (PackageRecord, error)

func (*PackageRepo) FetchPackage

func (r *PackageRepo) FetchPackage(ctx context.Context, client client.Client, guid string) (PackageRecord, error)

func (*PackageRepo) UpdatePackageSource

func (r *PackageRepo) UpdatePackageSource(ctx context.Context, c client.Client, message PackageUpdateSourceMessage) (PackageRecord, error)

type PackageUpdateSourceMessage

type PackageUpdateSourceMessage struct {
	GUID               string
	SpaceGUID          string
	ImageRef           string
	RegistrySecretName string
}

type PermissionDeniedOrNotFoundError

type PermissionDeniedOrNotFoundError struct {
	Err error
}

func (PermissionDeniedOrNotFoundError) Error

func (PermissionDeniedOrNotFoundError) Unwrap

type ProcessRecord

type ProcessRecord struct {
	GUID        string
	SpaceGUID   string
	AppGUID     string
	Type        string
	Command     string
	Instances   int
	MemoryMB    int64
	DiskQuotaMB int64
	Ports       []int32
	HealthCheck HealthCheck
	Labels      map[string]string
	Annotations map[string]string
	CreatedAt   string
	UpdatedAt   string
}

type ProcessRepository

type ProcessRepository struct{}

func (*ProcessRepository) FetchProcess

func (r *ProcessRepository) FetchProcess(ctx context.Context, client client.Client, processGUID string) (ProcessRecord, error)

func (*ProcessRepository) FetchProcessesForApp

func (r *ProcessRepository) FetchProcessesForApp(ctx context.Context, k8sClient client.Client, appGUID, spaceGUID string) ([]ProcessRecord, error)

type ResourceNotFoundError

type ResourceNotFoundError struct {
	Err error
}

func (ResourceNotFoundError) Error

func (e ResourceNotFoundError) Error() string

func (ResourceNotFoundError) Unwrap

func (e ResourceNotFoundError) Unwrap() error

type RouteRecord

type RouteRecord struct {
	GUID         string
	SpaceGUID    string
	DomainRef    DomainRecord
	Host         string
	Path         string
	Protocol     string
	Destinations []Destination
	Labels       map[string]string
	Annotations  map[string]string
	CreatedAt    string
	UpdatedAt    string
}

func (RouteRecord) UpdateDomainRef

func (r RouteRecord) UpdateDomainRef(d DomainRecord) RouteRecord

type RouteRepo

type RouteRepo struct{}

func (*RouteRepo) CreateRoute

func (f *RouteRepo) CreateRoute(ctx context.Context, client client.Client, routeRecord RouteRecord) (RouteRecord, error)

func (*RouteRepo) FetchRoute

func (f *RouteRepo) FetchRoute(ctx context.Context, client client.Client, routeGUID string) (RouteRecord, error)

func (*RouteRepo) FetchRouteList

func (f *RouteRepo) FetchRouteList(ctx context.Context, client client.Client) ([]RouteRecord, error)

func (*RouteRepo) FetchRoutesForApp

func (f *RouteRepo) FetchRoutesForApp(ctx context.Context, k8sClient client.Client, appGUID string, spaceGUID string) ([]RouteRecord, error)

type SetAppDesiredStateMessage

type SetAppDesiredStateMessage struct {
	AppGUID      string
	SpaceGUID    string
	DesiredState string
}

type SetCurrentDropletMessage

type SetCurrentDropletMessage struct {
	AppGUID     string
	DropletGUID string
	SpaceGUID   string
}

type SpaceRecord

type SpaceRecord struct {
	Name             string
	GUID             string
	OrganizationGUID string
	Labels           map[string]string
	Annotations      map[string]string
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

Directories

Path Synopsis
fake
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
fake
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