Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// The API token to used to access your account. It can also be specified via
// the DIGITALOCEAN_TOKEN or DIGITALOCEAN_ACCESS_TOKEN environment variables.
APIToken string `mapstructure:"api_token" required:"true"`
// A non-standard API endpoint URL. Set this if you are using a DigitalOcean API
// compatible service. It can also be specified via environment variable DIGITALOCEAN_API_URL.
APIURL string `mapstructure:"api_url"`
// The maximum number of retries for requests that fail with a 429 or 500-level error.
// The default value is 5. Set to 0 to disable reties.
HTTPRetryMax *int `mapstructure:"http_retry_max" required:"false"`
// The maximum wait time (in seconds) between failed API requests. Default: 30.0
HTTPRetryWaitMax *float64 `mapstructure:"http_retry_wait_max" required:"false"`
// The minimum wait time (in seconds) between failed API requests. Default: 1.0
HTTPRetryWaitMin *float64 `mapstructure:"http_retry_wait_min" required:"false"`
// The name of the image to return. Only one of `name` or `name_regex` may be provided.
Name string `mapstructure:"name"`
// A regex matching the name of the image to return. Only one of `name` or `name_regex` may be provided.
NameRegex string `mapstructure:"name_regex"`
// Filter the images searched by type. This may be one of `application`, `distribution`, or `user`.
// By default, all image types are searched.
Type string `mapstructure:"type"`
// A DigitalOcean region slug (e.g. `nyc3`). When provided, only images available in that region
// will be returned.
Region string `mapstructure:"region"`
// A boolean value determining how to handle multiple matching images. By default, multiple matching images
// results in an error. When set to `true`, the most recently created image is returned instead.
Latest bool `mapstructure:"latest"`
}
type Datasource ¶
type Datasource struct {
// contains filtered or unexported fields
}
func (*Datasource) ConfigSpec ¶
func (d *Datasource) ConfigSpec() hcldec.ObjectSpec
func (*Datasource) Configure ¶
func (d *Datasource) Configure(raws ...interface{}) error
func (*Datasource) OutputSpec ¶
func (d *Datasource) OutputSpec() hcldec.ObjectSpec
type DatasourceOutput ¶
type DatasourceOutput struct {
// The ID of the found image.
ImageID int `mapstructure:"image_id"`
// The regions the found image is availble in.
ImageRegions []string `mapstructure:"image_regions"`
}
func (*DatasourceOutput) FlatMapstructure ¶
func (*DatasourceOutput) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatDatasourceOutput. FlatDatasourceOutput is an auto-generated flat version of DatasourceOutput. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type FlatConfig ¶
type FlatConfig struct {
APIToken *string `mapstructure:"api_token" required:"true" cty:"api_token" hcl:"api_token"`
APIURL *string `mapstructure:"api_url" cty:"api_url" hcl:"api_url"`
HTTPRetryMax *int `mapstructure:"http_retry_max" required:"false" cty:"http_retry_max" hcl:"http_retry_max"`
HTTPRetryWaitMax *float64 `mapstructure:"http_retry_wait_max" required:"false" cty:"http_retry_wait_max" hcl:"http_retry_wait_max"`
HTTPRetryWaitMin *float64 `mapstructure:"http_retry_wait_min" required:"false" cty:"http_retry_wait_min" hcl:"http_retry_wait_min"`
Name *string `mapstructure:"name" cty:"name" hcl:"name"`
NameRegex *string `mapstructure:"name_regex" cty:"name_regex" hcl:"name_regex"`
Type *string `mapstructure:"type" cty:"type" hcl:"type"`
Region *string `mapstructure:"region" cty:"region" hcl:"region"`
Latest *bool `mapstructure:"latest" cty:"latest" hcl:"latest"`
}
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatDatasourceOutput ¶
type FlatDatasourceOutput struct {
ImageID *int `mapstructure:"image_id" cty:"image_id" hcl:"image_id"`
ImageRegions []string `mapstructure:"image_regions" cty:"image_regions" hcl:"image_regions"`
}
FlatDatasourceOutput is an auto-generated flat version of DatasourceOutput. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatDatasourceOutput) HCL2Spec ¶
func (*FlatDatasourceOutput) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a DatasourceOutput. This spec is used by HCL to read the fields of DatasourceOutput. The decoded values from this spec will then be applied to a FlatDatasourceOutput.