mapper

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package mapper includes the types and methods for mapping provider, resource, and data source types (explorer package) from an OpenAPI specification into Provider Code Specification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDataSourceRequestMapper added in v0.5.0

func NewDataSourceRequestMapper(datasource explorer.DataSource, name string, cfg config.Config) datasourceRequestMapper

func NewResourceRequestMapper added in v0.5.0

func NewResourceRequestMapper(resource explorer.Resource, name string, cfg config.Config) resourceRequestMapper

Types

type CRUDParameters added in v0.5.0

type CRUDParameters struct {
	Create *NcloudCommonRequestType   `json:"create,omitempty"`
	Read   *NcloudCommonRequestType   `json:"read,omitempty"`
	Update []*NcloudCommonRequestType `json:"update,omitempty"`
	Delete *NcloudCommonRequestType   `json:"delete,omitempty"`
}

type DataSourceMapper

type DataSourceMapper interface {
	MapToIR(*slog.Logger) ([]DetailDataSourceInfo, error)
}

func NewDataSourceMapper

func NewDataSourceMapper(dataSources map[string]explorer.DataSource, cfg config.Config) DataSourceMapper

type DetailDataSourceInfo added in v0.5.0

type DetailDataSourceInfo struct {
	datasource.DataSource
	CRUDParameters      CRUDParameters `json:"crud_parameters"`
	RefreshObjectName   string         `json:"refresh_object_name"`
	ImportStateOverride string         `json:"import_state_override"`
	Id                  string         `json:"id"`
}

type DetailResourceInfo added in v0.5.0

type DetailResourceInfo struct {
	resource.Resource
	CRUDParameters      CRUDParameters `json:"crud_parameters"`
	RefreshObjectName   string         `json:"refresh_object_name"`
	ImportStateOverride string         `json:"import_state_override"`
	Id                  string         `json:"id"`
}

type DetailedRequestType added in v0.5.0

type DetailedRequestType struct {
	spec.RequestType
	Parameters  *RequestParameters `json:"parameters,omitempty"`
	RequestBody *NcloudRequestBody `json:"request_body,omitempty"`
}

type NcloudCommonRequestType added in v0.5.0

type NcloudCommonRequestType struct {
	DetailedRequestType
	Method string `json:"method,omitempty"`
	Path   string `json:"path,omitempty"`
}

type NcloudRequestBody added in v0.5.0

type NcloudRequestBody struct {
	spec.RequestBody
	Required []*RequestParameterAttributes `json:"required,omitempty"`
	Optional []*RequestParameterAttributes `json:"optional,omitempty"`
}

type ProviderMapper

type ProviderMapper interface {
	MapToIR(*slog.Logger) (*ProviderWithEndpoint, error)
}

func NewProviderMapper

func NewProviderMapper(exploredProvider explorer.Provider, cfg config.Config) ProviderMapper

type ProviderWithEndpoint added in v0.5.0

type ProviderWithEndpoint struct {
	provider.Provider
	Endpoint string `json:"endpoint"`
}

type RequestMapper

type RequestMapper interface {
	MapToIR(*slog.Logger) (CRUDParameters, error)
}

type RequestParameterAttributes added in v0.5.0

type RequestParameterAttributes struct {
	Name   string `json:"name,omitempty"`
	Type   string `json:"type,omitempty"`
	Format string `json:"format,omitempty"`
}

type RequestParameters added in v0.5.0

type RequestParameters struct {
	Required []*RequestParameterAttributes `json:"required,omitempty"`
	Optional []*RequestParameterAttributes `json:"optional,omitempty"`
}

type ResourceMapper

type ResourceMapper interface {
	MapToIR(*slog.Logger) ([]DetailResourceInfo, error)
}

func NewResourceMapper

func NewResourceMapper(resources map[string]explorer.Resource, cfg config.Config) ResourceMapper

Directories

Path Synopsis
Package attrmapper contains types and methods that provide an intermediate step between the OpenAPI schema types (libopenapi) and the Provider Code Specification types (terraform-plugin-codegen-spec).
Package attrmapper contains types and methods that provide an intermediate step between the OpenAPI schema types (libopenapi) and the Provider Code Specification types (terraform-plugin-codegen-spec).
Package frameworkvalidators contains functionality for mapping validations onto specification that uses terraform-plugin-framework-validators.
Package frameworkvalidators contains functionality for mapping validations onto specification that uses terraform-plugin-framework-validators.
Package oas contains the logic that determines how to map OpenAPI schemas to the intermediate attrmapper types.
Package oas contains the logic that determines how to map OpenAPI schemas to the intermediate attrmapper types.

Jump to

Keyboard shortcuts

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