operations

package
v2.25.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package operations contains logic for getting information about resources. This currently includes provider-specific resource logs and a resource map with parent/child information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResourceMap

func NewResourceMap(source []*resource.State) map[resource.URN]*Resource

NewResourceMap constructs a map of resources with parent/child relations, indexed by URN.

Types

type LogEntry

type LogEntry struct {
	ID string
	// Timestamp is a Unix timestamp, in milliseconds
	Timestamp int64
	Message   string
}

LogEntry is a row in the logs for a running compute service

type LogQuery

type LogQuery struct {
	// StartTime is an optional time indiciating that only logs from after this time should be produced.
	StartTime *time.Time `url:"startTime,unix"`
	// EndTime is an optional time indiciating that only logs from before this time should be produced.
	EndTime *time.Time `url:"endTime,unix"`
	// ResourceFilter is a string indicating that logs should be limited to a resource or resources
	ResourceFilter *ResourceFilter `url:"resourceFilter"`
}

LogQuery represents the parameters to a log query operation. All fields are optional, leaving them off returns all logs.

IDEA: We are currently using this type both within the engine and as an apitype. We should consider splitting this into separate types for the engine and on the wire.

type Provider

type Provider interface {
	// GetLogs returns logs matching a query
	GetLogs(query LogQuery) (*[]LogEntry, error)
}

Provider is the interface for making operational requests about the state of a Component (or Components)

func AWSOperationsProvider

func AWSOperationsProvider(
	config map[config.Key]string,
	component *Resource) (Provider, error)

AWSOperationsProvider creates an OperationsProvider capable of answering operational queries based on the underlying resources of the `@pulumi/aws` implementation.

func CloudOperationsProvider

func CloudOperationsProvider(config map[config.Key]string, component *Resource) (Provider, error)

CloudOperationsProvider creates an OperationsProvider capable of answering operational queries based on the underlying resources of the `@pulumi/cloud-aws` implementation.

func GCPOperationsProvider

func GCPOperationsProvider(
	config map[config.Key]string,
	component *Resource) (Provider, error)

GCPOperationsProvider creates an OperationsProvider capable of answering operational queries based on the underlying resources of the `@pulumi/gcp` implementation.

type Resource

type Resource struct {
	Stack    tokens.QName
	Project  tokens.PackageName
	State    *resource.State
	Parent   *Resource
	Children map[resource.URN]*Resource
}

Resource is a tree representation of a resource/component hierarchy

func NewResourceTree

func NewResourceTree(source []*resource.State) *Resource

NewResourceTree constructs a tree representation of a resource/component hierarchy

func (*Resource) GetChild

func (r *Resource) GetChild(typ string, name string) (*Resource, bool)

GetChild find a child with the given type and name or returns `nil`.

func (*Resource) OperationsProvider

func (r *Resource) OperationsProvider(config map[config.Key]string) Provider

OperationsProvider gets an OperationsProvider for this resource.

type ResourceFilter

type ResourceFilter string

ResourceFilter specifies a specific resource or subset of resources. It can be provided in three formats: - Full URN: "<namespace>::<alloc>::<type>::<name>" - Type + Name: "<type>::<name>" - Name: "<name>"

Jump to

Keyboard shortcuts

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