Documentation ¶
Overview ¶
Package utils contains utility functions for the tfcore package.
Index ¶
- func CombineProtoSchemas(ctx context.Context, googleSchema *schema.Provider, ...) (co *tfprotov5.Schema, err error)
- func MustCombineMaps[T interface{}](m1, m2 map[string]T) map[string]T
- func StartTunnel(ctx context.Context, d *schema.ResourceData, config *google.Config) (proxyURL string, err error)
- func UpdateSchemaWithDefaults(smap map[string]*schema.Schema) map[string]*schema.Schema
- func WrapSchemaResource(resource *schema.Resource) *schema.Resource
- type CombinedSchema
- type WrappedProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineProtoSchemas ¶ added in v0.0.4
func CombineProtoSchemas(ctx context.Context, googleSchema *schema.Provider, protoSchema *tfprotov5.GetProviderSchemaResponse, toReplace, replaceWith string) (co *tfprotov5.Schema, err error)
CombineProtoSchemas combines google schemas and tfproto schemas into a single schema this differs from CombineSchemas in that it supports tfproto schemas.
func MustCombineMaps ¶
MustCombineMaps attempts to combine two maps. Panics if maps can not be combined.
func StartTunnel ¶
func StartTunnel(ctx context.Context, d *schema.ResourceData, config *google.Config) (proxyURL string, err error)
StartTunnel and returns the proxy url nolint: cyclop
func UpdateSchemaWithDefaults ¶ added in v0.0.4
UpdateSchemaWithDefaults adds extra fields to the schema needed for the google tunnel.
func WrapSchemaResource ¶
WrapSchemaResource wraps a schema.resource to extract the underlying provider interface. This way, we can configure context on both the underlying provider interfaces without modifying the underlying provider. This allows are only modification to the provider itself to be the addition of the proxy_url field and the proxy starter. nolint: staticcheck, wrapcheck, gocognit, cyclop
Types ¶
type CombinedSchema ¶
type CombinedSchema struct { Schema map[string]*schema.Schema MetaSchema map[string]*schema.Schema ResourceMap, DataSourceMap map[string]*schema.Resource }
CombinedSchema returns the combined schema of only schema, metaSchema, resourceMaps and dataSourceMaps.
func CombineSchemas ¶
func CombineSchemas(googleProvider, underlyingProvider *schema.Provider, toReplace, replaceWith string) (co CombinedSchema)
CombineSchemas provides 2 helm schemas toReplace and replaceWith are used to specify to the provider to replace note: while this does not enforce which provider is used, it will fail if one provider is not a google-like provider (in terms of the fields it has)
type WrappedProvider ¶
type WrappedProvider interface { // UnderlyingProvider gets the underlying provider UnderlyingProvider() interface{} GoogleProvider() interface{} }
WrappedProvider is a provider that wraps another provider. This is used to wrap the underlying provider with the google provider.