Documentation ¶
Index ¶
- Variables
- func AddOptionalFieldsToSchema(schema map[string]*schema.Schema, keys ...string)
- func FindExact[T any](slice []T, finder func(T) bool, searchName string) (T, error)
- func FixDatasourceSchemaFlags(schema map[string]*schema.Schema, required bool, keys ...string)
- func NewRegionalID(idI interface{}, fallBackRegion scw.Region) string
- func NewZonedID(idI interface{}, fallBackZone scw.Zone) string
- func SchemaFromResourceSchema(rs map[string]*schema.Schema) map[string]*schema.Schema
- func SingularDataSourceFindError(resourceType string, err error) error
- type TooManyResultsError
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyResults = &TooManyResultsError{}
Functions ¶
func AddOptionalFieldsToSchema ¶
AddOptionalFieldsToSchema
code imported from Google's terraform provider. source: https://github.com/hashicorp/terraform-provider-google/blob/main/google/tpgresource/datasource_helpers.go
func FindExact ¶ added in v2.39.0
FindExact finds the first element in 'slice' matching the condition defined by 'finder'. It returns the first matching element and an error if either no match is found or multiple matches are found.
func FixDatasourceSchemaFlags ¶
FixDatasourceSchemaFlags is a convenience func that toggles the Computed, Optional + Required flags on a schema element. This is useful when the schema has been generated (using `datasourceSchemaFromResourceSchema` above for example) and therefore the attribute flags were not set appropriately when first added to the schema definition. Currently only supports top-level schema elements.
code imported from Google's terraform provider. source: https://github.com/hashicorp/terraform-provider-google/blob/main/google/tpgresource/datasource_helpers.go
func NewRegionalID ¶
func NewZonedID ¶
func SchemaFromResourceSchema ¶
SchemaFromResourceSchema is a recursive func that converts an existing Resource schema to a Datasource schema. All schema elements are copied, but certain attributes are ignored or changed: - all attributes have Computed = true - all attributes have ForceNew, Required = false - Validation funcs and attributes (e.g. MaxItems) are not copied
code imported from Google's terraform provider. source: https://github.com/hashicorp/terraform-provider-google/blob/main/google/tpgresource/datasource_helpers.go
func SingularDataSourceFindError ¶ added in v2.39.0
SingularDataSourceFindError returns a standard error message for a singular data source's non-nil resource find error.
Types ¶
type TooManyResultsError ¶ added in v2.39.0
type TooManyResultsError struct { Count int LastRequest interface{} }
func (*TooManyResultsError) As ¶ added in v2.39.0
func (e *TooManyResultsError) As(target interface{}) bool
func (*TooManyResultsError) Error ¶ added in v2.39.0
func (e *TooManyResultsError) Error() string
func (*TooManyResultsError) Is ¶ added in v2.39.0
func (e *TooManyResultsError) Is(err error) bool