convert

package
v3.89.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Converts between Pulumi and Terraform value representations. Conversions are type-driven and require to know Terraform types since Terraform values must be tagged with their corresponding types. Pulumi type metadata is also required to make finer grained distinctions such as int vs float, and to correctly handle object properties that have Pulumi names that differ from their Terraform names.

Copyright 2016-2022, Pulumi Corporation.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePropertyMap

func DecodePropertyMap(ctx context.Context, dec Decoder, v tftypes.Value) (resource.PropertyMap, error)

func DecodePropertyMapFromDynamic

func DecodePropertyMapFromDynamic(
	ctx context.Context,
	dec Decoder,
	objectType tftypes.Object,
	dv *tfprotov6.DynamicValue,
) (resource.PropertyMap, error)

func EncodePropertyMap

func EncodePropertyMap(enc Encoder, pmap resource.PropertyMap) (tftypes.Value, error)

func EncodePropertyMapToDynamic

func EncodePropertyMapToDynamic(enc Encoder, objectType tftypes.Object,
	pmap resource.PropertyMap) (*tfprotov6.DynamicValue, error)

func InferObjectType

func InferObjectType(sm shim.SchemaMap, opts *InferObjectTypeOptions) tftypes.Object

Working with this package requires knowing the tftypes.Object type approximation, and while it is normally available from the underlying Plugin Framework provider, in some test scenarios it is helpful to infer and compute it.

func InferType

func InferType(s shim.Schema, opts *InferObjectTypeOptions) tftypes.Type

Similar to InferObjectType but generalizes to all types.

Types

type Decoder

type Decoder interface {
	// contains filtered or unexported methods
}

func NewObjectDecoder

func NewObjectDecoder(os ObjectSchema) (Decoder, error)

type Encoder

type Encoder interface {
	// contains filtered or unexported methods
}

func NewObjectEncoder

func NewObjectEncoder(os ObjectSchema) (Encoder, error)

type Encoding

type Encoding interface {
	NewConfigEncoder(tftypes.Object) (Encoder, error)
	NewResourceDecoder(resource string, resourceType tftypes.Object) (Decoder, error)
	NewResourceEncoder(resource string, resourceType tftypes.Object) (Encoder, error)
	NewDataSourceDecoder(dataSource string, dataSourceType tftypes.Object) (Decoder, error)
	NewDataSourceEncoder(dataSource string, dataSourceType tftypes.Object) (Encoder, error)
}

func NewEncoding

func NewEncoding(schemaOnlyProvider shim.Provider, providerInfo *tfbridge.ProviderInfo) Encoding

type InferObjectTypeOptions

type InferObjectTypeOptions struct{}

type ObjectSchema

type ObjectSchema struct {
	SchemaMap   shim.SchemaMap                  // required
	SchemaInfos map[string]*tfbridge.SchemaInfo // optional
	Object      *tftypes.Object                 // optional, if not given will be inferred from SchemaMap
}

Schema information that is needed to construct Encoder or Decoder instances.

Jump to

Keyboard shortcuts

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