Documentation
¶
Index ¶
- Constants
- Variables
- type ActionDefinition
- type ActionRequest
- type ActionResponse
- type App
- func (a *App) Describe(_ context.Context, _ *connect.Request[appv1.DescribeRequest]) (*connect.Response[appv1.DescribeResponse], error)
- func (a *App) ExecuteResourceAction(ctx context.Context, req *connect.Request[appv1.ExecuteResourceActionRequest]) (*connect.Response[appv1.ExecuteResourceActionResponse], error)
- func (a *App) ExecuteResourceOperation(ctx context.Context, ...) (*connect.Response[appv1.ExecuteResourceOperationResponse], error)
- func (a *App) HealthCheck(ctx context.Context, req *connect.Request[appv1.HealthCheckRequest]) (*connect.Response[appv1.HealthCheckResponse], error)
- func (a *App) ListResources(ctx context.Context, req *connect.Request[appv1.ListResourcesRequest]) (*connect.Response[appv1.ListResourcesResponse], error)
- type AppOption
- type EnvironmentVariable
- type EnvironmentVariableType
- type HealthCheckFunc
- type HealthCheckResponse
- type HealthCheckStatus
- type JSONSchema
- type LifecycleStage
- type Link
- type LinkType
- type ListFunc
- type ListRequest
- type ListResponse
- type Metadata
- type OperationFunc
- type OperationRequest
- type OperationResponse
- type Owner
- type OwnerType
- type Resource
- type ResourceDefinition
- func (rd *ResourceDefinition) AddActionDefinition(ad ActionDefinition)
- func (rd *ResourceDefinition) CreateFn(fn OperationFunc, inputSchema *JSONSchema)
- func (rd *ResourceDefinition) DeleteFn(fn OperationFunc)
- func (rd *ResourceDefinition) HealthCheckFn(fn HealthCheckFunc)
- func (rd *ResourceDefinition) ListFn(fn ListFunc)
- func (rd *ResourceDefinition) ReadFn(fn OperationFunc)
- func (rd *ResourceDefinition) UpdateFn(fn OperationFunc, inputSchema *JSONSchema)
- type TempestSchemaLoader
Constants ¶
const ResourceTypePattern = `^[A-Za-z_][A-Za-z0-9_]*$`
Variables ¶
var GenericEmptySchema []byte
Functions ¶
This section is empty.
Types ¶
type ActionDefinition ¶
type ActionDefinition struct { // Name is the unique identifier for the action. Name string // DisplayName is the name of the action as it should be displayed in the UI. DisplayName string // Description is a short description of the action. Description string // InputSchema is the parsed JSON schema for the input schema. InputSchema *JSONSchema // OutputSchema is the parsed JSON schema for the output schema. OutputSchema *JSONSchema // Handler is the function that will be called when the action is invoked. Handler func(context.Context, *ActionRequest) (*ActionResponse, error) }
type ActionRequest ¶
type ActionRequest struct { // Metadata contains information about the Project and User making the request. // This metadata does not contain information about the Resource being operated on. Metadata *Metadata // Resource is the resource being actioned, and contains the ExternalID of the resource, // as well as the properties at the time of the request. Resource *Resource // Action is the name of the action being performed. Action string // Input contains the input data for the request, after it has been validated against the schema. // Default values have already been applied to missing input properties. Input map[string]any // Environment contains the environment variables that are available to the operation. Environment map[string]EnvironmentVariable }
ActionRequest contains the input data for an operation on a resource.
type ActionResponse ¶
type App ¶
type App struct { appv1connect.UnimplementedAppServiceHandler // contains filtered or unexported fields }
func (*App) ExecuteResourceAction ¶
func (*App) ExecuteResourceOperation ¶
func (*App) HealthCheck ¶
func (*App) ListResources ¶
type AppOption ¶
type AppOption func(*appOptions)
func WithResourceDefinition ¶
func WithResourceDefinition(rd ResourceDefinition) AppOption
func WithResourceDefinitions ¶
func WithResourceDefinitions(rds ...ResourceDefinition) AppOption
type EnvironmentVariable ¶ added in v0.1.2
type EnvironmentVariable struct { Key string Value string Type EnvironmentVariableType }
type EnvironmentVariableType ¶ added in v0.1.2
type EnvironmentVariableType string
const ( ENVIRONMENT_VARIABLE_TYPE_VAR EnvironmentVariableType = "variable" ENVIRONMENT_VARIABLE_TYPE_SECRET EnvironmentVariableType = "secret" ENVIRONMENT_VARIABLE_TYPE_CERTIFICATE EnvironmentVariableType = "certificate" ENVIRONMENT_VARIABLE_TYPE_PRIVATE_KEY EnvironmentVariableType = "private_key" ENVIRONMENT_VARIABLE_TYPE_PUBLIC_KEY EnvironmentVariableType = "public_key" )
type HealthCheckFunc ¶
type HealthCheckFunc func(context.Context) (*HealthCheckResponse, error)
type HealthCheckResponse ¶
type HealthCheckResponse struct { Status HealthCheckStatus Message string }
type HealthCheckStatus ¶
type HealthCheckStatus int
const ( HealthCheckStatusUnknown HealthCheckStatus = iota // unknown HealthCheckStatusHealthy // healthy HealthCheckStatusDegraded // degraded HealthCheckStatusDisrupted // disrupted )
func (HealthCheckStatus) String ¶
func (i HealthCheckStatus) String() string
type JSONSchema ¶
type JSONSchema struct { *jsonschema.Schema // contains filtered or unexported fields }
func MustParseJSONSchema ¶
func MustParseJSONSchema(schema []byte) *JSONSchema
MustParseJSONSchema parses a JSON schema and returns a JSONSchema object. It will panic if the schema cannot be parsed.
func ParseJSONSchema ¶
func ParseJSONSchema(schema []byte) (*JSONSchema, error)
ParseJSONSchema parses a JSON schema and returns a JSONSchema object. The schema is compiled with annotations extraction enabled.
type LifecycleStage ¶
type LifecycleStage int
Represents a stage in the Developer Journey lifecycle.
const ( LifecycleStageCode LifecycleStage = iota + 1 // code LifecycleStageBuild // build LifecycleStageTest // test LifecycleStageRelease // release LifecycleStageDeploy // deploy LifecycleStageOperate // operate LifecycleStageMonitor // monitor LifecycleStageOther // other )
func (LifecycleStage) String ¶
func (i LifecycleStage) String() string
type ListFunc ¶
type ListFunc func(context.Context, *ListRequest) (*ListResponse, error)
type ListRequest ¶
type ListRequest struct { // Metadata contains information about the Project and User making the request. // This metadata does not contain information about the Resource being operated on. Metadata *Metadata // Resource is the resource being listed, and contains at least the Resource Type. Resource *Resource // Next is a token that can be used to fetch the next page of results. Next string }
ListRequest contains the input data for listing resources.
type ListResponse ¶
type ListResponse struct { Resources []*Resource // Next is a token that can be used to fetch the next page of results. Next string }
ListResponse contains the output data for listing resources.
type Metadata ¶
type Metadata struct { // ProjectID is the ID of the Tempest Project. This guaranteed to be unique. ProjectID string // ProjectName is the user defined name of the Tempest Project. ProjectName string // Owners are the user(s) who created or own the Project. Owners []Owner // Author is the user or team who created the Project. Author Owner }
type OperationFunc ¶
type OperationFunc func(context.Context, *OperationRequest) (*OperationResponse, error)
type OperationRequest ¶
type OperationRequest struct { // Metadata contains information about the Project and User making the request. // This metadata does not contain information about the Resource being operated on. Metadata *Metadata // Resource is the resource being operated on, and contains the ExternalID of the resource, // as well as the properties at the time of the request. Resource *Resource // Input contains the input data for the request, after it has been validated against the schema. // Default values have already been applied to missing input properties. Input map[string]any // Environment contains the environment variables that are available to the operation. Environment map[string]EnvironmentVariable }
OperationRequest contains the input data for an operation on a resource.
type OperationResponse ¶
type OperationResponse struct { // Resource contains the properties of the resource after the operation has been performed. Resource *Resource }
OperationResponse contains the output data for an operation on a resource.
type Resource ¶
type Resource struct { // ExternalID is the unique identifier for the resource in the external system. ExternalID string // DisplayName represents the human-readable name of the resource, to be displayed in the Tempest UI. DisplayName string // Type is the name of the ResourceDefinition that this resource is an instance of. Type string // Links are resource-specific links that can help users understand how to use this Resource. // A good example of a link is a LinkTypeExternal with a URL to the external system's UI for this resource. Links []*Link // Properties contains the properties of the resource. These properties are validated against the resource Properties schema. Properties map[string]any }
type ResourceDefinition ¶
type ResourceDefinition struct { // The type by which this resource is identified. Must match `ResourceTypePattern`. Type string // The display name of the type for Tempest to show in the UI. DisplayName string // A description of the Resource type. Description string // PropertiesSchema is the parsed JSON schema for the Properties. PropertiesSchema *JSONSchema // LifecycleStage represents how the Resource fits in the Developer Journey. LifecycleStage LifecycleStage // Links are links to documentation or other resources that can help users // understand how to use this Resource. Links []Link // Markdown formatted instructions for setting up or using the resource. // This field supports resource property variables in the format of {{ resource.<property name> }}. InstructionsMarkdown string // contains filtered or unexported fields }
ResourceDefinition represents a type of resource that can be managed by Tempest.
func (*ResourceDefinition) AddActionDefinition ¶
func (rd *ResourceDefinition) AddActionDefinition(ad ActionDefinition)
func (*ResourceDefinition) CreateFn ¶
func (rd *ResourceDefinition) CreateFn(fn OperationFunc, inputSchema *JSONSchema)
CreateFn adds a Create operation Handler to the ResourceDefinition.
Tempest will use the inputSchema to validate the input data before calling the Handler. The Handler should create the resource in the external system and return the resource's ExternalID and properties. See the Create operation in the Printer example for an example implementation.
func (*ResourceDefinition) DeleteFn ¶
func (rd *ResourceDefinition) DeleteFn(fn OperationFunc)
DeleteFn adds a Delete operation Handler to the ResourceDefinition.
The Handler should delete the resource in the external system. See the Delete operation in the Printer example for an example implementation.
func (*ResourceDefinition) HealthCheckFn ¶
func (rd *ResourceDefinition) HealthCheckFn(fn HealthCheckFunc)
HealthCheckFn adds a HealthCheck Handler to the ResourceDefinition.
The Handler should return the provisioning health of the resource.
func (*ResourceDefinition) ListFn ¶
func (rd *ResourceDefinition) ListFn(fn ListFunc)
ListFn adds a List Handler to the ResourceDefinition. The output will be validated against the ResourceDefinition's Properties schema.
The Handler should query the external system for all resources of this type and return them. See the List operation in the Printer example for an example implementation.
func (*ResourceDefinition) ReadFn ¶
func (rd *ResourceDefinition) ReadFn(fn OperationFunc)
ReadFn adds a Read Operation to the ResourceDefinition.
The Handler should query the external system for the resource's current state and return it. See the Read operation in the Printer example for an example implementation.
func (*ResourceDefinition) UpdateFn ¶
func (rd *ResourceDefinition) UpdateFn(fn OperationFunc, inputSchema *JSONSchema)
UpdateFn adds an Update operation Handler to the ResourceDefinition.
Tempest will use the inputSchema to validate the input data before calling the Handler. The Handler should update the resource in the external system and return the updated resource's properties. See the Update operation in the Printer example for an example implementation.
type TempestSchemaLoader ¶ added in v0.1.5
type TempestSchemaLoader struct {
// contains filtered or unexported fields
}
func NewTempestSchemaLoader ¶ added in v0.1.5
func NewTempestSchemaLoader() *TempestSchemaLoader