fusion

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRequiredAuthFields   = errors.New("profile does not have required auth fields")
	ErrNoDefaultProfileField  = errors.New("config does not have required field `default_profile`")
	ErrNoProfilesField        = errors.New("config does not have required field `profiles`")
	ErrNoProfileExists        = errors.New("profile does not exist")
	ErrNoProfileEndpointField = errors.New("profile does not have required field `endpoint`")
)
View Source
var DummyOperation hmrest.Operation = hmrest.Operation{
	Status: "Succeeded",
}

Functions

func DiffSuppressForHumanReadableTimePeriod added in v1.0.12

func DiffSuppressForHumanReadableTimePeriod(k, old, new string, d *schema.ResourceData) bool

func DummyInvokeWriteAPI added in v1.0.16

func DummyInvokeWriteAPI(ctx context.Context, client *hmrest.APIClient, body RequestSpec) (operation *hmrest.Operation, err error)

func GetHomeConfigPath added in v1.0.16

func GetHomeConfigPath() (string, error)

func IsValidAddress added in v1.0.12

func IsValidAddress(v interface{}, path cty.Path) diag.Diagnostics

func IsValidCidr added in v1.0.16

func IsValidCidr(v interface{}, path cty.Path) diag.Diagnostics

func IsValidIQN added in v1.0.12

func IsValidIQN(v interface{}, path cty.Path) diag.Diagnostics

func IsValidLocalRetention added in v1.0.12

func IsValidLocalRetention(v interface{}, path cty.Path) diag.Diagnostics

func IsValidOptionalCidr added in v1.0.16

func IsValidOptionalCidr(v interface{}, path cty.Path) diag.Diagnostics

func MakeDummyCreateOperation added in v1.0.16

func MakeDummyCreateOperation(resourceId string) *hmrest.Operation

func NewHMClient

func NewHMClient(ctx context.Context, host, issuerId, privateKey, tokenEndpoint, privateKeyPassword string) (*hmrest.APIClient, error)

func NewHMClientWithAccessToken added in v1.0.16

func NewHMClientWithAccessToken(ctx context.Context, host, accessToken string) (*hmrest.APIClient, error)

func Provider

func Provider() *schema.Provider

Provider is the terraform resource provider called by main.go

Types

type Auth added in v1.0.16

type Auth struct {
	IssuerId           string `json:"issuer_id,omitempty"`
	PrivateKeyFile     string `json:"private_pem_file,omitempty"`
	TokenEndpoint      string `json:"token_endpoint,omitempty"`
	AccessToken        string `json:"access_token,omitempty"`
	PrivateKey         string `json:"private_key,omitempty"`
	PrivateKeyPassword string `json:"private_key_password,omitempty"`
}

type BaseDataSourceFunctions added in v1.0.12

type BaseDataSourceFunctions struct {
	*schema.Resource
	DataSourceKind string
	DataSource     DataSource
}

func NewBaseDataSourceFunctions added in v1.0.12

func NewBaseDataSourceFunctions(resourceKind string, dataSource DataSource, dsSchema map[string]*schema.Schema) *BaseDataSourceFunctions

type BaseResourceFunctions

type BaseResourceFunctions struct {
	*schema.Resource
	ResourceKind string // We're for volume, tenant space, storage class, etc. More likely to come.
	Provider     ResourceProvider
}

Implements interface to Terraform: resource-CRUD

func NewBaseResourceFunctions

func NewBaseResourceFunctions(resourceKind string, provider ResourceProvider) *BaseResourceFunctions

type BaseResourceProvider

type BaseResourceProvider struct {
	ResourceKind string
}

Actually, an empty implementation which returns "not implemented" errors. :-)

func (*BaseResourceProvider) ImportResource added in v1.0.16

func (p *BaseResourceProvider) ImportResource(ctx context.Context, client *hmrest.APIClient, d *schema.ResourceData) (ds []*schema.ResourceData, err error)

func (*BaseResourceProvider) PrepareCreate

func (p *BaseResourceProvider) PrepareCreate(ctx context.Context, d *schema.ResourceData) (fn InvokeWriteAPI, post ResourcePost, err error)

func (*BaseResourceProvider) PrepareDelete

func (p *BaseResourceProvider) PrepareDelete(ctx context.Context, client *hmrest.APIClient, d *schema.ResourceData) (fn InvokeWriteAPI, err error)

func (*BaseResourceProvider) PrepareUpdate

func (p *BaseResourceProvider) PrepareUpdate(ctx context.Context, client *hmrest.APIClient, d *schema.ResourceData) (fn InvokeWriteAPI, patches []ResourcePatch, err error)

func (*BaseResourceProvider) ReadResource

func (p *BaseResourceProvider) ReadResource(ctx context.Context, client *hmrest.APIClient, d *schema.ResourceData) (err error)

type DataSource added in v1.0.12

type DataSource interface {
	// Synchronously reads the data source via its REST API.
	ReadDataSource(ctx context.Context, client *hmrest.APIClient, d *schema.ResourceData) (err error)
}

type InvokeWriteAPI

type InvokeWriteAPI func(ctx context.Context, client *hmrest.APIClient, body RequestSpec) (operation *hmrest.Operation, err error)

type InvokeReadMultiAPI func(ctx context.Context, client *hmrest.APIClient) (resource []interface{}, err error) type InvokeReadSingleAPI func(ctx context.Context, client *hmrest.APIClient) (resource interface{}, err error)

func MakeDummyCreateInvokeWriteAPI added in v1.0.16

func MakeDummyCreateInvokeWriteAPI(resourceId string) InvokeWriteAPI

type ProfileConfig added in v1.0.16

type ProfileConfig struct {
	ApiHost string `json:"endpoint"`
	Auth    `json:"auth"`
}

func GetProfileConfig added in v1.0.16

func GetProfileConfig(path string, profileName string) (ProfileConfig, error)

type RequestSpec

type RequestSpec interface{}

type ResourcePatch

type ResourcePatch interface {
}

type ResourcePost

type ResourcePost interface {
}

type ResourceProvider

type ResourceProvider interface {
	// PrepareCreate returns a function which will call the Create REST API on this object and return an operation;
	// also returns the post body to pass to that function. Invoke the function using the post body.
	PrepareCreate(ctx context.Context, d *schema.ResourceData) (fn InvokeWriteAPI, post ResourcePost, err error)

	// ReadResource synchronously reads the resource via its REST API.
	ReadResource(ctx context.Context, client *hmrest.APIClient, d *schema.ResourceData) (err error)

	// PrepareUpdate returns a function which will call the Update REST API on this object and return an operation.
	// Invoke it with each of the patches.
	PrepareUpdate(ctx context.Context, client *hmrest.APIClient, d *schema.ResourceData) (fn InvokeWriteAPI, patches []ResourcePatch, err error)

	// PrepareDelete returns a function which will call the Delete REST API on this object and return an operation. Invoke it.
	PrepareDelete(ctx context.Context, client *hmrest.APIClient, d *schema.ResourceData) (fn InvokeWriteAPI, err error)

	// ResourceImporter is a function which is called when Terraform is importing a resource.
	ImportResource(ctx context.Context, client *hmrest.APIClient, d *schema.ResourceData) (ds []*schema.ResourceData, err error)
}

This is what you need to implement as the owner of a resource. Use the BaseResourceFunctions to build a schema.

Jump to

Keyboard shortcuts

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