datalist

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResource

func NewResource(config *ResourceConfig) *schema.Resource

Returns a new "data list" resource given the specified configuration. This is a resource with `filter` and `sort` attributes that can select a subset of records from a list of records for a particular type of resource.

Types

type ResourceConfig

type ResourceConfig struct {
	// The schema for a single instance of the resource.
	RecordSchema map[string]*schema.Schema

	// The name of the attribute in the resource through which to expose results.
	ResultAttributeName string

	// The description of the attribute in the resource through which to expose results.
	ResultAttributeDescription string

	// Given a record returned from the GetRecords function, flatten the record to a
	// map acceptable to the Set method on schema.ResourceData.
	FlattenRecord func(record, meta interface{}, extra map[string]interface{}) (map[string]interface{}, error)

	// Return all of the records on which the data list resource should operate.
	// The `meta` argument is the same meta argument passed into the resource's Read
	// function.
	GetRecords func(meta interface{}, extra map[string]interface{}) ([]interface{}, error)

	// Extra parameters to expose on the datasource alongside `filter` and `sort`.
	ExtraQuerySchema map[string]*schema.Schema
}

This is the configuration for a "data list" resource. It represents the schema and operations needed to create the data list resource.

Jump to

Keyboard shortcuts

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