rest

package
v0.0.0-...-248eda3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: GPL-3.0 Imports: 31 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResourceTypeToken

func GetResourceTypeToken(u string) string

GetResourceTypeToken returns the type token from a resource URN string.

func MakeProvider

func MakeProvider(host *provider.HostClient, name, version string, pulumiSchemaBytes, openapiDocBytes, metadataBytes []byte, callback callback.ProviderCallback) (pulumirpc.ResourceProviderServer, error)

MakeProvider returns an instance of the REST-based resource provider handler.

Types

type Provider

type Provider struct {
	pulumirpc.UnimplementedResourceProviderServer
	// contains filtered or unexported fields
}

Provider implements Pulumi's `ResourceProviderServer` interface. The implemented methods assume that the cloud provider supports RESTful APIs that accept a content-type of `application/json`.

func (*Provider) Attach

Attach sends the engine address to an already running plugin.

func (*Provider) Call

Call dynamically executes a method in the provider associated with a component resource.

func (*Provider) Cancel

Cancel signals the provider to gracefully shut down and abort any ongoing resource operations. Operations aborted in this way will return an error (e.g., `Update` and `Create` will either return a creation error or an initialization error). Since Cancel is advisory and non-blocking, it is up to the host to decide how long to wait after Cancel is called before (e.g.) hard-closing any gRPC connection.

func (*Provider) Check

Check validates that the given property bag is valid for a resource of the given type and returns the inputs that should be passed to successive calls to Diff, Create, or Update for this resource. As a rule, the provider inputs returned by a call to Check should preserve the original representation of the properties as present in the program inputs. Though this rule is not required for correctness, violations thereof can negatively impact the end-user experience, as the provider inputs are used for detecting and rendering diffs.

func (*Provider) CheckConfig

CheckConfig validates the configuration for this provider.

func (*Provider) Configure

Configure configures the resource provider with "globals" that control its behavior.

func (*Provider) Construct

Construct creates a new component resource.

func (*Provider) Create

Create allocates a new instance of the provided resource and returns its unique ID afterwards.

func (*Provider) CreateDeleteRequest

func (p *Provider) CreateDeleteRequest(ctx context.Context, httpEndpointPath string, reqBody []byte, inputs resource.PropertyMap) (*http.Request, error)

CreateDeleteRequest returns a validated DELETE HTTP request for the provided inputs map.

func (*Provider) CreateGetRequest

func (p *Provider) CreateGetRequest(
	ctx context.Context,
	httpEndpointPath string,
	inputs resource.PropertyMap) (*http.Request, error)

CreateGetRequest returns a validated GET HTTP request for the provided inputs map.

func (*Provider) CreatePatchRequest

func (p *Provider) CreatePatchRequest(ctx context.Context, httpEndpointPath string, reqBody []byte, inputs resource.PropertyMap) (*http.Request, error)

CreatePatchRequest returns a validated PATCH HTTP request for the provided inputs map.

func (*Provider) CreatePostRequest

func (p *Provider) CreatePostRequest(ctx context.Context, httpEndpointPath string, reqBody []byte, inputs resource.PropertyMap) (*http.Request, error)

CreatePostRequest returns a validated POST HTTP request for the provided inputs map.

func (*Provider) CreatePutRequest

func (p *Provider) CreatePutRequest(ctx context.Context, httpEndpointPath string, reqBody []byte, inputs resource.PropertyMap) (*http.Request, error)

CreatePutRequest returns a validated PUT HTTP request for the provided inputs map.

func (*Provider) Delete

func (p *Provider) Delete(ctx context.Context, req *pulumirpc.DeleteRequest) (*pbempty.Empty, error)

Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.

func (*Provider) Diff

Diff checks what impacts a hypothetical update will have on the resource's properties.

func (*Provider) DiffConfig

DiffConfig diffs the configuration for this provider.

func (*Provider) GetBaseURL

func (p *Provider) GetBaseURL() string

func (*Provider) GetHTTPClient

func (p *Provider) GetHTTPClient() *http.Client

func (*Provider) GetOpenAPIDoc

func (p *Provider) GetOpenAPIDoc() openapi3.T

func (*Provider) GetPluginInfo

func (p *Provider) GetPluginInfo(context.Context, *pbempty.Empty) (*pulumirpc.PluginInfo, error)

GetPluginInfo returns generic information about this plugin, like its version.

func (*Provider) GetSchema

GetSchema returns the JSON-serialized schema for the provider.

func (*Provider) GetSchemaSpec

func (p *Provider) GetSchemaSpec() pschema.PackageSpec

func (*Provider) Invoke

Invoke dynamically executes a built-in function in the provider.

func (*Provider) Read

Read the current live state associated with a resource.

func (*Provider) StreamInvoke

StreamInvoke dynamically executes a built-in function in the provider. The result is streamed back as a series of messages.

func (*Provider) TransformBody

func (p *Provider) TransformBody(ctx context.Context, bodyMap map[string]interface{}, lookupMap map[string]string)

func (*Provider) Update

Update updates an existing resource with new values.

type Request

type Request interface {
	CreateDeleteRequest(ctx context.Context, httpEndpointPath string, reqBody []byte, inputs resource.PropertyMap) (*http.Request, error)
	CreateGetRequest(ctx context.Context, httpEndpointPath string, inputs resource.PropertyMap) (*http.Request, error)
	CreatePatchRequest(ctx context.Context, httpEndpointPath string, reqBody []byte, inputs resource.PropertyMap) (*http.Request, error)
	CreatePostRequest(ctx context.Context, httpEndpointPath string, reqBody []byte, inputs resource.PropertyMap) (*http.Request, error)
	CreatePutRequest(ctx context.Context, httpEndpointPath string, reqBody []byte, inputs resource.PropertyMap) (*http.Request, error)
}

Request interface is implemented by REST-based providers that perform CRUD operations using RESTful APIs.

Jump to

Keyboard shortcuts

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