installresources

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Config                   = "configure"
	Verify                   = "verify"
	IamAssessment            = "iam-assessment"
	IamWrite                 = "iam-write"
	SingletonKey             = "_"
	StateMarkdownDescription = `` /* 228-byte string literal not displayed */

)

Variables

View Source
var InstallSteps = []string{Verify, Config}

Order matters here; components installed in this order.

Functions

func OperationPath

func OperationPath(base_path string, step string) string

Types

type Install

type Install struct {
	// This Integration's key
	Integration string
	// This Component's key
	Component string
	// The provider internal data object
	ProviderData *internal.P0ProviderData
	// Extract the item id from the TF state model, or nil if it can not be extracted
	GetId func(data any) *string
	// Convert the API response to the single item's JSON (should just equate to returning &data.Item)
	GetItemJson func(readJson any) any
	// Convert a pointer to the item's JSON model to a pointer to the TF state model.
	// Returns nil if the JSON can not be converted.
	FromJson func(ctx context.Context, diags *diag.Diagnostics, id string, json any) any
	// Convert a pointer to the TF state model to a pointer to an item's JSON model
	ToJson func(data any) any
}

func (*Install) Delete

func (i *Install) Delete(ctx context.Context, diags *diag.Diagnostics, state *tfsdk.State, model any)

Deletes the item from P0.

func (*Install) EnsureConfig

func (i *Install) EnsureConfig(ctx context.Context, diags *diag.Diagnostics, plan *tfsdk.Plan, state *tfsdk.State, model any)

Ensures that the item's configuration has been created in P0. If the item's configuration already exists we'll ignore the error.

func (*Install) Read

func (i *Install) Read(ctx context.Context, diags *diag.Diagnostics, state *tfsdk.State, json any, model any)

Reads current item value.

'json' must be a pointer to a struct of form:

struct{
  Item *ItemConfigurationJson `json:"item"`
}

func (*Install) Rollback

func (i *Install) Rollback(ctx context.Context, diags *diag.Diagnostics, state *tfsdk.State, model any)

"Rollback" does not delete the item from P0; rather, it returns it to the "stage" state.

This prevents double-delete issues when the stage resource is also deleted.

func (*Install) Stage

func (i *Install) Stage(ctx context.Context, diags *diag.Diagnostics, plan *tfsdk.Plan, state *tfsdk.State, json any, model any)

Places the item in the "stage" state in P0. To use, the item's TFSDK model must be passed. For example:

var data ItemConfigurationModel
var json ConfigurationApiResponseJson

func (*Install) UpsertFromStage

func (i *Install) UpsertFromStage(ctx context.Context, diags *diag.Diagnostics, plan *tfsdk.Plan, state *tfsdk.State, json any, model any)

Advances the item to "installed" state.

To use, the item's TFSDK model must be passed. For example:

var data ItemConfigurationModel
var json ConfigurationApiResponseJson
install.Upsert(ctx, &resp.Diagnostics, &req.Plan, &resp.State, &data)

type ReadResponse

type ReadResponse struct {
	Item *any
}

type RootInstall added in v0.5.0

type RootInstall struct {
	// This Integration's key
	Integration string
	// The provider internal data object
	ProviderData *internal.P0ProviderData
	// Convert a pointer to the item's JSON model to a pointer to the TF state model
	FromJson func(ctx context.Context, diags *diag.Diagnostics, json any) any
	// Convert a pointer to the TF state model to a pointer to an item's JSON model
	ToJson func(data any) any
}

func (*RootInstall) Create added in v0.5.0

func (i *RootInstall) Create(ctx context.Context, diags *diag.Diagnostics, plan *tfsdk.Plan, state *tfsdk.State, json any, model any)

Creates the integration + root item in P0.

func (*RootInstall) Delete added in v0.5.0

func (i *RootInstall) Delete(ctx context.Context, diags *diag.Diagnostics, state *tfsdk.State, model any)

Deletes the integration from P0.

func (*RootInstall) Read added in v0.5.0

func (i *RootInstall) Read(ctx context.Context, diags *diag.Diagnostics, state *tfsdk.State, json any, model any)

Reads the integration from P0.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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