Documentation ¶
Overview ¶
Package sourcepackages provides a way of SourcePackages.
Index ¶
- Variables
- func ConditionDeleted(ctx context.Context, _ *v1alpha1.SourcePackage, apiErr error) (bool, error)
- func ConditionReadyTrue(ctx context.Context, obj *v1alpha1.SourcePackage, err error) (bool, error)
- func ConditionUploadReadyTrue(ctx context.Context, obj *v1alpha1.SourcePackage, err error) (bool, error)
- func ExtractConditions(obj *v1alpha1.SourcePackage) (extracted []apis.Condition)
- func ExtractRequestError(err error) error
- func ObservedGenerationMatchesGeneration(obj *v1alpha1.SourcePackage) bool
- func PackageSourcePath(sourcePath string) (cleanup func(), tarFile *os.File, checksum string, err error)
- func WithConditionReporter(ctx context.Context, reporter ConditionReporter) context.Context
- type Client
- type ClientExtension
- type ConditionFuncE
- type ConditionReporter
- type Merger
- type Mutator
- type Poster
- type Predicate
- type ResourceInfo
Constants ¶
This section is empty.
Variables ¶
var ( ConditionReady = apis.ConditionType(v1alpha1.SourcePackageConditionSucceeded) ConditionUploadReady = apis.ConditionType(v1alpha1.SourcePackageConditionUploadReady) )
Functions ¶
func ConditionDeleted ¶
ConditionDeleted is a ConditionFuncE that succeeds if the error returned by the cluster was a not found error.
func ConditionReadyTrue ¶
ConditionReadyTrue is a ConditionFuncE that waits for Condition{Ready v1alpha1.SourcePackageConditionSucceeded } to become true and fails with an error if the condition becomes false.
func ConditionUploadReadyTrue ¶
func ConditionUploadReadyTrue(ctx context.Context, obj *v1alpha1.SourcePackage, err error) (bool, error)
ConditionUploadReadyTrue is a ConditionFuncE that waits for Condition{UploadReady v1alpha1.SourcePackageConditionUploadReady } to become true and fails with an error if the condition becomes false.
func ExtractConditions ¶
func ExtractConditions(obj *v1alpha1.SourcePackage) (extracted []apis.Condition)
ExtractConditions converts the native condition types into an apis.Condition array with the Type, Status, Reason, and Message fields intact.
func ExtractRequestError ¶
ExtractRequestError will return the underlying request error if there is one. This is useful if the request fails and the error has information that would make it actionable.
func ObservedGenerationMatchesGeneration ¶
func ObservedGenerationMatchesGeneration(obj *v1alpha1.SourcePackage) bool
ObservedGenerationMatchesGeneration is a predicate that returns true if the object's ObservedGeneration matches the genration of the object.
func PackageSourcePath ¶
func PackageSourcePath(sourcePath string) ( cleanup func(), tarFile *os.File, checksum string, err error, )
PackageSourcePath tars up the given path, takes the checksum. The cleanup function should ALWAYS be invoked, even if there is an error.
func WithConditionReporter ¶ added in v2.11.16
func WithConditionReporter(ctx context.Context, reporter ConditionReporter) context.Context
WithConditionReporter adds a callback to condition waits.
Types ¶
type Client ¶
type Client interface { Create(ctx context.Context, namespace string, obj *v1alpha1.SourcePackage) (*v1alpha1.SourcePackage, error) Transform(ctx context.Context, namespace string, name string, transformer Mutator) (*v1alpha1.SourcePackage, error) Get(ctx context.Context, namespace string, name string) (*v1alpha1.SourcePackage, error) Delete(ctx context.Context, namespace string, name string) error List(ctx context.Context, namespace string) ([]v1alpha1.SourcePackage, error) Upsert(ctx context.Context, namespace string, newObj *v1alpha1.SourcePackage, merge Merger) (*v1alpha1.SourcePackage, error) WaitFor(ctx context.Context, namespace string, name string, interval time.Duration, condition Predicate) (*v1alpha1.SourcePackage, error) // Utility functions WaitForDeletion(ctx context.Context, namespace string, name string, interval time.Duration) (*v1alpha1.SourcePackage, error) WaitForConditionReadyTrue(ctx context.Context, namespace string, name string, interval time.Duration) (*v1alpha1.SourcePackage, error) WaitForConditionUploadReadyTrue(ctx context.Context, namespace string, name string, interval time.Duration) (*v1alpha1.SourcePackage, error) // ClientExtension can be used by the developer to extend the client. ClientExtension }
Client is the interface for interacting with v1alpha1.SourcePackage types as SourcePackage CF style objects.
type ClientExtension ¶
type ClientExtension interface { // UploadSourcePath packages up (normally via tar) the given source path, // creates a SourcePackage for it, and finally POSTs it to the // upload.kf.dev endpoint. UploadSourcePath(ctx context.Context, sourcePath string, app *v1alpha1.App) error }
ClientExtension holds additional functions that should be exposed by Client.
type ConditionFuncE ¶
type ConditionFuncE func(ctx context.Context, instance *v1alpha1.SourcePackage, apiErr error) (done bool, err error)
ConditionFuncE is a callback used by waitForE. Done should be set to true once the condition succeeds and shouldn't be called anymore. The error will be passed back to the user.
This function MAY retrieve a nil instance and an apiErr. It's up to the function to decide how to handle the apiErr.
type ConditionReporter ¶ added in v2.11.16
type ConditionReporter func(message string)
ConditionReporter reports on changes to conditions while waiting.
type Merger ¶
type Merger func(newObj, oldObj *v1alpha1.SourcePackage) *v1alpha1.SourcePackage
Merger is a type to merge an existing value with a new one.
type Mutator ¶
type Mutator func(*v1alpha1.SourcePackage) error
Mutator is a function that changes v1alpha1.SourcePackage.
type Poster ¶
Poster is a function used to write data to the API server.
func NewPoster ¶
func NewPoster(ki kubernetes.Interface) Poster
NewPoster returns a new Poster function from a Kubernetes Interface.
type Predicate ¶
type Predicate func(*v1alpha1.SourcePackage) bool
Predicate is a boolean function for a v1alpha1.SourcePackage.
type ResourceInfo ¶
type ResourceInfo struct{}
func NewResourceInfo ¶
func NewResourceInfo() *ResourceInfo
NewResourceInfo returns a new instance of ResourceInfo
func (*ResourceInfo) FriendlyName ¶
func (*ResourceInfo) FriendlyName() string
FriendlyName gets the user-facing name of the resource.
func (*ResourceInfo) GroupVersionKind ¶
func (*ResourceInfo) GroupVersionKind(context.Context) schema.GroupVersionKind
GroupVersionKind gets the GVK struct for the resource.
func (*ResourceInfo) GroupVersionResource ¶
func (*ResourceInfo) GroupVersionResource(context.Context) schema.GroupVersionResource
GroupVersionResource gets the GVR struct for the resource.
func (*ResourceInfo) Namespaced ¶
func (*ResourceInfo) Namespaced() bool
Namespaced returns true if the type belongs in a namespace.