manager

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

types/manager

The types/manager package contains interfaces that manage cloud resources.

These interfaces are specifically designed in such a way as to not have any dependencies on Kubernetes libraries. This is because the generated implementations of these interfaces are intended to be used by any client that wishes to standardize its calling of cloud service APIs using a declarative resource management strategy but isn't dependent on the Kubernetes controller-runtime or reconciliation logic.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory interface {
	// Manager returns a Manager that manages cloud resources on behalf of a
	// particular set of cloud credentials
	Manager(
		schema.Kind,
		credentials.Credentials,
	) (Manager, error)
}

Factory returns a Manager that can be used to manage cloud resources for a particular Resource Kind and cloud credentials

type Manager

type Manager interface {
	// Get returns the currently-observed state of the supplied Resource in
	// the backend cloud service API.
	//
	// Implementers should return (nil, pkg/errors.NotFound) when the backend
	// cloud service API cannot find the resource.
	Get(
		context.Context,
		resource.Identifiers,
	) (resource.Resource, error)
	// Create attempts to create the supplied Resource in the backend cloud
	// service API, returning a Resource representing the newly-created
	// resource
	Create(
		context.Context,
		resource.Resource,
	) (resource.Resource, error)
	// Update attempts to mutate the supplied desired Resource in the backend
	// cloud service API, returning a Resource representing the newly-mutated
	// resource.
	//
	// A `compare.Delta` is provided to help implementing structs understand
	// which fields between the desired and latest resources have changed.
	Update(
		context.Context,
		resource.Resource,
		resource.Resource,
		*compare.Delta,
	) (resource.Resource, error)
	// Delete attempts to destroy the supplied Resource in the backend cloud
	// service API, returning a Resource representing the resource being
	// deleted (if delete is asynchronous and takes time)
	Delete(
		context.Context,
		resource.Resource,
	) (resource.Resource, error)
}

Manager is responsible for providing a consistent way to perform CRUD operations in a backend cloud service API for Resources.

Use a Factory to create a Manager for a particular Kind and Credentials.

Jump to

Keyboard shortcuts

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