Documentation ¶
Index ¶
- func CollisionFreeName(name string, rand *rand.Rand) string
- func CollisionFreeNameWithSeparator(name string, sep rune, rand *rand.Rand) string
- func DetermineResourceName(inputResourceName *string, nameProvider ResourceInfoProvider) string
- func IntPtr(i int) *int
- func RandomSeed() *rand.Rand
- func Start(provider *Provider) error
- func StringPtr(s string) *string
- type CreateRequest
- type CreateResponse
- type DeleteRequest
- type DeleteResponse
- type DeploymentInfoProvider
- type DeploymentInfoProviderData
- type InputValueProvider
- type InputValueProviderData
- type Provider
- type ProviderConfiguration
- type ProviderConfigurationData
- type ProviderResource
- type ReadRequest
- type ReadResponse
- type ResourceInfoProvider
- type ResourceInfoProviderData
- func (p *ResourceInfoProviderData) GetRawResourceName() string
- func (p *ResourceInfoProviderData) GetResourceId() string
- func (p *ResourceInfoProviderData) GetResourceKind() string
- func (p *ResourceInfoProviderData) GetResourceName() string
- func (p *ResourceInfoProviderData) GetResourceNameWithSeparator(sep rune) string
- type State
- type StateProvider
- type StateProviderData
- type UpdateRequest
- type UpdateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollisionFreeName ¶
CollisionFreeName appends a unique suffix to the supplied name. This is used by ResourceInfoProvider.GetResourceName to avoid collisions with other resources, but can also be used in other places where a unique name is required. The suffix is separated using a hyphen (-), if you need to use a different separator, use CollisionFreeNameWithSeparator.
func CollisionFreeNameWithSeparator ¶
CollisionFreeNameWithSeparator appends a unique suffix to the supplied name, using the supplied separator. The given name will also be converted to lowercase, and all non-alphanumeric characters will be replaced with the supplied separator.
func DetermineResourceName ¶
func DetermineResourceName(inputResourceName *string, nameProvider ResourceInfoProvider) string
DetermineResourceName returns the input resource name, if set, and defaults to a collision-free version of the resource name otherwise.
func RandomSeed ¶
Types ¶
type CreateRequest ¶
type CreateRequest struct { Inputs InputValueProvider Resource ResourceInfoProvider Deployment DeploymentInfoProvider }
type CreateResponse ¶
type CreateResponse struct { InitialState State Outputs value.OutputProvider }
type DeleteRequest ¶
type DeleteRequest struct { State StateProvider Resource ResourceInfoProvider Deployment DeploymentInfoProvider }
type DeleteResponse ¶
type DeleteResponse struct { }
type DeploymentInfoProvider ¶
type DeploymentInfoProviderData ¶
type DeploymentInfoProviderData struct { DeploymentId string `json:"deploymentId"` IdempotencyKey string `json:"idempotencyKey"` DeploymentProviderToken string `json:"deploymentProviderToken"` }
func (*DeploymentInfoProviderData) GetDeploymentId ¶
func (p *DeploymentInfoProviderData) GetDeploymentId() string
func (*DeploymentInfoProviderData) GetDeploymentProviderToken ¶
func (p *DeploymentInfoProviderData) GetDeploymentProviderToken() string
GetDeploymentProviderToken returns a temporary token that can be used to verify API requests are sent by the current deployment. Tokens expire after 3h after the deployment was started.
func (*DeploymentInfoProviderData) GetIdempotencyKey ¶
func (p *DeploymentInfoProviderData) GetIdempotencyKey() string
GetIdempotencyKey returns a unique identifier for the deployment step associated to the request and can be used to deduplicate operations that should happen only once in case of a retry. This key is unique to the current step and deployment, a new deployment will generate new idempotency keys for every step.
type InputValueProvider ¶
type InputValueProvider interface {
Get() []value.Input
}
type InputValueProviderData ¶
type InputValueProviderData struct {
Inputs []value.Input `json:"inputs"`
}
func (*InputValueProviderData) Get ¶
func (d *InputValueProviderData) Get() []value.Input
type Provider ¶
type Provider struct { Resources map[string]ProviderResource Functions map[string]value.Function }
type ProviderConfiguration ¶
type ProviderConfiguration interface {
Get() []value.Input
}
type ProviderConfigurationData ¶
type ProviderConfigurationData struct {
Values []value.Input `json:"values"`
}
func (*ProviderConfigurationData) Get ¶
func (p *ProviderConfigurationData) Get() []value.Input
type ProviderResource ¶
type ProviderResource interface { // Create creates a new resource given the resolved inputs. Create(ctx context.Context, request *CreateRequest, config ProviderConfiguration) (*CreateResponse, error) // Read is called during refresh operations to retrieve the current state of the resource. Read(ctx context.Context, request *ReadRequest, config ProviderConfiguration) (*ReadResponse, error) // Update is called to update an existing resource to the desired state. Update(ctx context.Context, request *UpdateRequest, config ProviderConfiguration) (*UpdateResponse, error) // Delete is called to delete an existing resource. Delete(ctx context.Context, request *DeleteRequest, config ProviderConfiguration) (*DeleteResponse, error) }
type ReadRequest ¶
type ReadRequest struct { State StateProvider Resource ResourceInfoProvider Deployment DeploymentInfoProvider }
type ReadResponse ¶
type ReadResponse struct { NextState State Outputs value.OutputProvider }
type ResourceInfoProvider ¶
type ResourceInfoProvider interface { GetResourceId() string // GetResourceName returns resource name suffixed with a random string to avoid name clashes across environments, separated by a hyphen (-). // The result of this method is only deterministic within the same plan step. // Uses GetResourceNameWithSeparator. GetResourceName() string // GetResourceNameWithSeparator behaves like GetResourceName but allows for a custom separator to be used. // Uses CollisionFreeNameWithSeparator. GetResourceNameWithSeparator(sep rune) string // GetRawResourceName returns the user-supplied name of the resource. // Warning: This is *not* unique across environments, and may lead to name clashes, using GetResourceName instead is highly recommended. GetRawResourceName() string GetResourceKind() string }
type ResourceInfoProviderData ¶
type ResourceInfoProviderData struct { ResourceId string `json:"resourceId"` ResourceName string `json:"resourceName"` ResourceKind string `json:"resourceKind"` // contains filtered or unexported fields }
func (*ResourceInfoProviderData) GetRawResourceName ¶
func (p *ResourceInfoProviderData) GetRawResourceName() string
func (*ResourceInfoProviderData) GetResourceId ¶
func (p *ResourceInfoProviderData) GetResourceId() string
func (*ResourceInfoProviderData) GetResourceKind ¶
func (p *ResourceInfoProviderData) GetResourceKind() string
func (*ResourceInfoProviderData) GetResourceName ¶
func (p *ResourceInfoProviderData) GetResourceName() string
func (*ResourceInfoProviderData) GetResourceNameWithSeparator ¶
func (p *ResourceInfoProviderData) GetResourceNameWithSeparator(sep rune) string
type State ¶
type State interface{}
State is an arbitrary data structure that can be used to store resource state.
type StateProvider ¶
type StateProvider interface {
Get() State
}
type StateProviderData ¶
type StateProviderData struct {
State State `json:"state"`
}
func (*StateProviderData) Get ¶
func (p *StateProviderData) Get() State
type UpdateRequest ¶
type UpdateRequest struct { Inputs InputValueProvider State StateProvider Resource ResourceInfoProvider Deployment DeploymentInfoProvider }
type UpdateResponse ¶
type UpdateResponse struct { NextState State Outputs value.OutputProvider }