provider

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MPL-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrResourceInErrorState = errors.New("the resource is in error state")

Functions

func New

func New(version string) func() provider.Provider

func NewFilesystemResource added in v1.1.0

func NewFilesystemResource() resource.Resource

func NewFloatingIPResource added in v1.1.0

func NewFloatingIPResource() resource.Resource

func NewImagesDataSource

func NewImagesDataSource() datasource.DataSource

func NewInstanceResource

func NewInstanceResource() resource.Resource

func NewSSHKeyResource

func NewSSHKeyResource() resource.Resource

func NewSecurityGroupResource

func NewSecurityGroupResource() resource.Resource

func NewSnapshotResource

func NewSnapshotResource() resource.Resource

func NewVolumeResource

func NewVolumeResource() resource.Resource

func RetryPolicy

func RetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error)

Types

type Client

type Client struct {
	*genesiscloud.ClientWithResponses

	PollingInterval time.Duration
}

func NewClient

func NewClient(ctx context.Context, config ClientConfig) (*Client, error)

func (*Client) PollingWait

func (c *Client) PollingWait(ctx context.Context) error

type ClientConfig

type ClientConfig struct {
	genesiscloud.ClientConfig
	PollingInterval time.Duration
}

type ClientLogger

type ClientLogger struct {
	retryablehttp.Logger
	// contains filtered or unexported fields
}

func (ClientLogger) Printf

func (l ClientLogger) Printf(format string, a ...interface{})

type CreateFn

type CreateFn = func(ctx context.Context, defaultTimeout time.Duration) (time.Duration, diag.Diagnostics)

type DataSourceWithClient

type DataSourceWithClient struct {
	// contains filtered or unexported fields
}

func (*DataSourceWithClient) Configure

type DataSourceWithTimeout

type DataSourceWithTimeout struct {
}

func (*DataSourceWithTimeout) ContextWithTimeout

func (d *DataSourceWithTimeout) ContextWithTimeout(ctx context.Context, timeoutFn CreateFn) (context.Context, context.CancelFunc, diag.Diagnostics)

type ErrorResponse

type ErrorResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	Error        *genesiscloud.Error
}

type FilesystemResource added in v1.1.0

type FilesystemResource struct {
	ResourceWithClient
	ResourceWithTimeout
}

FilesystemResource defines the resource implementation.

func (*FilesystemResource) Create added in v1.1.0

func (*FilesystemResource) Delete added in v1.1.0

func (*FilesystemResource) ImportState added in v1.1.0

func (*FilesystemResource) Metadata added in v1.1.0

func (*FilesystemResource) Read added in v1.1.0

func (*FilesystemResource) Schema added in v1.1.0

func (*FilesystemResource) Update added in v1.1.0

type FilesystemResourceModel added in v1.1.0

type FilesystemResourceModel struct {
	CreatedAt types.String `tfsdk:"created_at"`

	// Description The human-readable description for the filesystem.
	Description types.String `tfsdk:"description"`

	// Id The unique ID of the filesystem.
	Id types.String `tfsdk:"id"`

	// Name The human-readable name for the filesystem.
	Name types.String `tfsdk:"name"`

	// MountEndpointRange The mount endpoint range for the filesystem.
	MountEndpointRange types.List `tfsdk:"mount_endpoint_range"`

	// MountBasePath The base path for the filesystem mount.
	MountBasePath types.String `tfsdk:"mount_base_path"`

	// Region The region identifier.
	Region types.String `tfsdk:"region"`

	// Size The storage size of this filesystem given in GiB.
	Size types.Int64 `tfsdk:"size"`

	// Status The filesystem status.
	Status types.String `tfsdk:"status"`

	// Type The storage type of the filesystem.
	Type types.String `tfsdk:"type"`

	// RetainOnDelete Flag to retain the filesystem when the resource is deleted. It has to be deleted manually.
	RetainOnDelete types.Bool `tfsdk:"retain_on_delete"`

	// Timeouts The resource timeouts
	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

func (*FilesystemResourceModel) PopulateFromClientResponse added in v1.1.0

func (data *FilesystemResourceModel) PopulateFromClientResponse(ctx context.Context, filesystem *genesiscloud.Filesystem) (diag diag.Diagnostics)

type FloatingIPResource added in v1.1.0

type FloatingIPResource struct {
	ResourceWithClient
	ResourceWithTimeout
}

FloatingIPResource defines the resource implementation.

func (*FloatingIPResource) Create added in v1.1.0

func (*FloatingIPResource) Delete added in v1.1.0

func (*FloatingIPResource) ImportState added in v1.1.0

func (*FloatingIPResource) Metadata added in v1.1.0

func (*FloatingIPResource) Read added in v1.1.0

func (*FloatingIPResource) Schema added in v1.1.0

func (*FloatingIPResource) Update added in v1.1.0

type FloatingIPResourceModel added in v1.1.0

type FloatingIPResourceModel struct {
	CreatedAt types.String `tfsdk:"created_at"`

	// Id The unique ID of the Floating IP.
	Id types.String `tfsdk:"id"`

	// Name The human-readable name for the Floating IP.
	Name types.String `tfsdk:"name"`

	// IpAddress The IP address of the floating IP.
	IpAddress types.String `tfsdk:"ip_address"`

	// IsPublic A boolean value indicating whether the floating IP is public or private.
	IsPublic types.Bool `tfsdk:"is_public"`

	// Region The region identifier.
	Region types.String `tfsdk:"region"`

	UpdatedAt types.String `tfsdk:"updated_at"`

	// Status The instance status
	Status types.String `tfsdk:"status"`

	// Description The human-readable description for the floating IP.
	Description types.String `tfsdk:"description"`

	// Version The IP version of the floating IP.
	Version types.String `tfsdk:"version"`

	// Timeouts The resource timeouts
	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

func (*FloatingIPResourceModel) PopulateFromClientResponse added in v1.1.0

func (data *FloatingIPResourceModel) PopulateFromClientResponse(ctx context.Context, floatingIP *genesiscloud.FloatingIP) (diag diag.Diagnostics)

type GenesisCloudProvider

type GenesisCloudProvider struct {
	// contains filtered or unexported fields
}

GenesisCloudProvider defines the provider implementation.

func (*GenesisCloudProvider) Configure

func (*GenesisCloudProvider) DataSources

func (p *GenesisCloudProvider) DataSources(ctx context.Context) []func() datasource.DataSource

func (*GenesisCloudProvider) Metadata

func (*GenesisCloudProvider) Resources

func (p *GenesisCloudProvider) Resources(ctx context.Context) []func() resource.Resource

func (*GenesisCloudProvider) Schema

type GenesisCloudProviderModel

type GenesisCloudProviderModel struct {
	Endpoint        types.String `tfsdk:"endpoint"`
	Token           types.String `tfsdk:"token"`
	PollingInterval types.String `tfsdk:"polling_interval"`
}

GenesisCloudProviderModel describes the provider data model.

type ImageModel

type ImageModel struct {
	CreatedAt types.String `tfsdk:"created_at"`

	// Id A unique number that can be used to identify and reference a specific image.
	Id types.String `tfsdk:"id"`

	// Name The display name that has been given to an image.
	Name types.String `tfsdk:"name"`

	// Regions The set of regions in which this image can be used in.
	Regions []types.String `tfsdk:"regions"`

	// Type Describes the kind of image.
	Type types.String `tfsdk:"type"`

	Slug types.String `tfsdk:"slug"`

	Versions types.List `tfsdk:"versions"`
}

func (*ImageModel) PopulateFromClientResponse

func (data *ImageModel) PopulateFromClientResponse(ctx context.Context, image *genesiscloud.Image) (diag diag.Diagnostics)

type ImagesDataSource

type ImagesDataSource struct {
	DataSourceWithClient
	DataSourceWithTimeout
}

ImagesDataSource defines the data source implementation.

func (*ImagesDataSource) Metadata

func (*ImagesDataSource) Read

func (*ImagesDataSource) Schema

type ImagesDataSourceModel

type ImagesDataSourceModel struct {
	Filter ImagesFilterDataSourceModel `tfsdk:"filter"`
	Images []ImageModel                `tfsdk:"images"`
	Id     types.String                `tfsdk:"id"` // placeholder

	// Timeouts The data source timeouts
	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

ImagesDataSourceModel describes the data source data model.

type ImagesFilterDataSourceModel

type ImagesFilterDataSourceModel struct {
	// Region Filter by the region identifier.
	Region types.String `tfsdk:"region"`

	// Type Filter by the kind of image.
	Type types.String `tfsdk:"type"`
}

type InstanceMetadataModel

type InstanceMetadataModel struct {
	// StartupScript A plain text bash script or "cloud-config" file that will be executed after the first instance boot.
	// It is limited to 64 KiB in size. You can use it to configure your instance, e.g. installing the **NVIDIA GPU driver**.
	// Learn more about [startup scripts and installing the GPU driver](https://support.genesiscloud.com/support/solutions/articles/47001122478).
	StartupScript types.String `tfsdk:"startup_script"`
}

type InstanceResource

type InstanceResource struct {
	ResourceWithClient
	ResourceWithTimeout
}

InstanceResource defines the resource implementation.

func (*InstanceResource) ConfigValidators

func (r *InstanceResource) ConfigValidators(ctx context.Context) []resource.ConfigValidator

func (*InstanceResource) Create

func (*InstanceResource) Delete

func (*InstanceResource) ImportState

func (*InstanceResource) Metadata

func (*InstanceResource) Read

func (*InstanceResource) Schema

func (*InstanceResource) Update

type InstanceResourceModel

type InstanceResourceModel struct {
	CreatedAt types.String `tfsdk:"created_at"`

	// Hostname The hostname of your instance.
	Hostname types.String `tfsdk:"hostname"`

	// Id The unique ID of the instance.
	Id types.String `tfsdk:"id"`

	// Image The source image or snapshot of the instance.
	Image types.String `tfsdk:"image"`

	// ImageId The resulting image ID of the instance.
	ImageId types.String `tfsdk:"image_id"`

	// Metadata Option to provide metadata. Currently supported is `startup_script`.
	Metadata *InstanceMetadataModel `tfsdk:"metadata"`

	// DiskSize The disk size of the instance in GiB.
	DiskSize types.Int64 `tfsdk:"disk_size"`

	// Name The human-readable name for the instance.
	Name types.String `tfsdk:"name"`

	// Password The password to access the instance.
	// Your password must have a minimum length of 16 characters.
	// **Please Note**: Only one of `ssh_keys` or `password` can be provided.
	// Password is less secure - we recommend you use an SSH key-pair.
	Password types.String `tfsdk:"password"`

	// PlacementOption The placement option identifier in which instances are physically located relative to each other within a zone.
	PlacementOption types.String `tfsdk:"placement_option"`

	// PrivateIp The private IPv4 IP-Address (IPv4 address).
	PrivateIp types.String `tfsdk:"private_ip"`

	// PublicIp The public IPv4 IP-Address (IPv4 address).
	PublicIp types.String `tfsdk:"public_ip"`

	// Region The region identifier.
	Region types.String `tfsdk:"region"`

	// SecurityGroupIds The security groups of the instance.
	SecurityGroupIds types.Set `tfsdk:"security_group_ids"`

	// SshKeyIds The ssh keys of the instance.
	SshKeyIds types.Set `tfsdk:"ssh_key_ids"`

	// Status The instance status
	Status types.String `tfsdk:"status"`

	// Type The instance type identifier.
	Type types.String `tfsdk:"type"`

	UpdatedAt types.String `tfsdk:"updated_at"`

	// VolumeIds The volumes of the instance
	VolumeIds types.Set `tfsdk:"volume_ids"`

	// FloatingIp The floating IP of the instance.
	FloatingIpId types.String `tfsdk:"floating_ip_id"`

	// Timeouts The resource timeouts
	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

func (*InstanceResourceModel) PopulateFromClientResponse added in v1.1.0

func (data *InstanceResourceModel) PopulateFromClientResponse(ctx context.Context, instance *genesiscloud.Instance) (diag diag.Diagnostics)

type ResourceWithClient

type ResourceWithClient struct {
	// contains filtered or unexported fields
}

func (*ResourceWithClient) Configure

type ResourceWithTimeout

type ResourceWithTimeout struct {
}

func (*ResourceWithTimeout) ContextWithTimeout

func (r *ResourceWithTimeout) ContextWithTimeout(ctx context.Context, timeoutFn CreateFn) (context.Context, context.CancelFunc, diag.Diagnostics)

type SSHKeyResource

type SSHKeyResource struct {
	ResourceWithClient
	ResourceWithTimeout
}

SSHKeyResource defines the resource implementation.

func (*SSHKeyResource) Create

func (*SSHKeyResource) Delete

func (*SSHKeyResource) ImportState

func (*SSHKeyResource) Metadata

func (*SSHKeyResource) Read

func (*SSHKeyResource) Schema

func (*SSHKeyResource) Update

type SSHKeyResourceModel

type SSHKeyResourceModel struct {
	CreatedAt types.String `tfsdk:"created_at"`

	// Fingerprint The fingerprint of the SSH key.
	Fingerprint types.String `tfsdk:"fingerprint"`

	// Id The unique ID of the SSH key.
	Id types.String `tfsdk:"id"`

	// Name The human-readable name for the SSH key.
	Name types.String `tfsdk:"name"`

	// PublicKey SSH public key.
	PublicKey types.String `tfsdk:"public_key"`

	// Timeouts The resource timeouts
	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

func (*SSHKeyResourceModel) PopulateFromClientResponse added in v1.1.0

func (data *SSHKeyResourceModel) PopulateFromClientResponse(ctx context.Context, sshKey *genesiscloud.SSHKey) (diag diag.Diagnostics)

type SecurityGroupResource

type SecurityGroupResource struct {
	ResourceWithClient
	ResourceWithTimeout
}

SecurityGroupResource defines the resource implementation.

func (*SecurityGroupResource) ConfigValidators

func (r *SecurityGroupResource) ConfigValidators(ctx context.Context) []resource.ConfigValidator

func (*SecurityGroupResource) Create

func (*SecurityGroupResource) Delete

func (*SecurityGroupResource) ImportState

func (*SecurityGroupResource) Metadata

func (*SecurityGroupResource) Read

func (*SecurityGroupResource) Schema

func (*SecurityGroupResource) Update

type SecurityGroupResourceModel

type SecurityGroupResourceModel struct {
	CreatedAt types.String `tfsdk:"created_at"`

	// Description The human-readable description for the security group.
	Description types.String `tfsdk:"description"`

	// Id The unique ID of the security group.
	Id types.String `tfsdk:"id"`

	// Name The human-readable name for the security group.
	Name types.String `tfsdk:"name"`

	// Region The region identifier.
	Region types.String `tfsdk:"region"`

	// Rules The security group rules.
	Rules []SecurityGroupRuleModel `tfsdk:"rules"`

	// Status The security group status.
	Status types.String `tfsdk:"status"`

	// Timeouts The resource timeouts
	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

func (*SecurityGroupResourceModel) PopulateFromClientResponse added in v1.1.0

func (data *SecurityGroupResourceModel) PopulateFromClientResponse(ctx context.Context, securityGroup *genesiscloud.SecurityGroup) (diag diag.Diagnostics)

type SecurityGroupRuleModel

type SecurityGroupRuleModel struct {
	// Direction The direction of the rule.
	Direction types.String `tfsdk:"direction"`

	// PortRangeMax The maximum port number of the rule.
	PortRangeMax types.Int64 `tfsdk:"port_range_max"`

	// PortRangeMin The minimum port number of the rule.
	PortRangeMin types.Int64 `tfsdk:"port_range_min"`

	// Protocol The protocol of the rule.
	Protocol types.String `tfsdk:"protocol"`
}

type SnapshotResource

type SnapshotResource struct {
	ResourceWithClient
	ResourceWithTimeout
}

SnapshotResource defines the resource implementation.

func (*SnapshotResource) Create

func (*SnapshotResource) Delete

func (*SnapshotResource) ImportState

func (*SnapshotResource) Metadata

func (*SnapshotResource) Read

func (*SnapshotResource) Schema

func (*SnapshotResource) Update

type SnapshotResourceModel

type SnapshotResourceModel struct {
	CreatedAt types.String `tfsdk:"created_at"`

	// Id The unique ID of the snapshot.
	Id types.String `tfsdk:"id"`

	// Name The human-readable name for the snapshot.
	Name types.String `tfsdk:"name"`

	// Region The region identifier.
	Region types.String `tfsdk:"region"`

	// InstanceId The id of the instance that was snapshotted.
	InstanceId types.String `tfsdk:"instance_id"`

	// Size The storage size of this snapshot given in bytes.
	Size types.Int64 `tfsdk:"size"`

	// Status The snapshot status.
	Status types.String `tfsdk:"status"`

	// RetainOnDelete Flag to retain the snapshot when the resource is deleted. It has to be deleted manually.
	RetainOnDelete types.Bool `tfsdk:"retain_on_delete"`

	// Timeouts The resource timeouts
	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

func (*SnapshotResourceModel) PopulateFromClientResponse added in v1.1.0

func (data *SnapshotResourceModel) PopulateFromClientResponse(ctx context.Context, snapshot *genesiscloud.Snapshot) (diag diag.Diagnostics)

type VolumeResource

type VolumeResource struct {
	ResourceWithClient
	ResourceWithTimeout
}

VolumeResource defines the resource implementation.

func (*VolumeResource) Create

func (*VolumeResource) Delete

func (*VolumeResource) ImportState

func (*VolumeResource) Metadata

func (*VolumeResource) Read

func (*VolumeResource) Schema

func (*VolumeResource) Update

type VolumeResourceModel

type VolumeResourceModel struct {
	CreatedAt types.String `tfsdk:"created_at"`

	// Description The human-readable description for the volume.
	Description types.String `tfsdk:"description"`

	// Id The unique ID of the volume.
	Id types.String `tfsdk:"id"`

	// Name The human-readable name for the volume.
	Name types.String `tfsdk:"name"`

	// Region The region identifier.
	Region types.String `tfsdk:"region"`

	// Size The storage size of this volume given in GiB.
	Size types.Int64 `tfsdk:"size"`

	// Status The volume status.
	Status types.String `tfsdk:"status"`

	// Type The storage type of the volume.
	Type types.String `tfsdk:"type"`

	// RetainOnDelete Flag to retain the volume when the resource is deleted. It has to be deleted manually.
	RetainOnDelete types.Bool `tfsdk:"retain_on_delete"`

	// Timeouts The resource timeouts
	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

func (*VolumeResourceModel) PopulateFromClientResponse added in v1.1.0

func (data *VolumeResourceModel) PopulateFromClientResponse(ctx context.Context, volume *genesiscloud.Volume) (diag diag.Diagnostics)

Jump to

Keyboard shortcuts

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