aws

package
v0.0.0-...-9dcacef Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCachePath = "~/.cache/grm-generate"
)

Variables

This section is empty.

Functions

func AddFieldsToResourceDefinition

func AddFieldsToResourceDefinition(
	ctx context.Context,
	rd *model.ResourceDefinition,
	cfg *config.ResourceConfig,
	ops map[OpType]*awssdkmodel.Operation,
) error

AddFieldsToResourceDefinition iterates over API Operations and a supplied ResourceConfig and adds Fields to the supplied ResourceDefinition, recursing down through any nested fields.

func GetAPIs

func GetAPIs(
	ctx context.Context,
	basePath string,
	modelPaths []string,
) (map[string]*awssdkmodel.API, error)

getAPIs returns a map, keyed by service package name, of API structs for each service package for which we we are discovering resources.

func GetResourceDefinitionsForService

func GetResourceDefinitionsForService(
	ctx context.Context,
	service string,
	api *awssdkmodel.API,
	cfg *config.Config,
) ([]*model.ResourceDefinition, error)

GetResourceDefinitionsForService returns a slice of `ResourceDefinition` structs that describe the top-level resources discovered for a supplied AWS service API

func New

func New(
	opts ...option,
) discover.DiscoversResources

New returns a new DiscoversResources implementer for AWS resources

func VisitMemberShape

func VisitMemberShape(
	ctx context.Context,
	rd *model.ResourceDefinition,
	path *fieldpath.Path,

	cfg *config.ResourceConfig,
	containerShape *awssdkmodel.Shape,
	shapeRef *awssdkmodel.ShapeRef,
) *model.FieldDefinition

VisitMemberShape collects information on the possible field's definition by examining both the FieldConfig and the AWS SDK model ShapeRef and adds a new Field to the supplied ResourceDefinition as appropriate, returning the discovered FieldDefinition representing the member shapeRef.

This function is called recursively for nested fields.

func WithAPIModelPaths

func WithAPIModelPaths(apiModelPaths ...string) option

WithAPIModelPaths instructs the discovery code where to find API models. Expects absolute filepaths. Overrides the `WithCachePath` option.

func WithCachePath

func WithCachePath(path string) option

WithCachePath uses the supplied cache path for discovery of API models

func WithConfig

func WithConfig(cfg *config.Config) option

WithConfig uses the supplied Config as instructions to the discovery code

func WithServices

func WithServices(services ...string) option

WithServices instructs the discovery code which AWS services to discover

Types

type OpType

type OpType int
const (
	OpTypeUnknown OpType = iota
	OpTypeCreate
	OpTypeCreateBatch
	OpTypeDelete
	OpTypeReplace
	OpTypeUpdate
	OpTypeAddChild
	OpTypeAddChildren
	OpTypeRemoveChild
	OpTypeRemoveChildren
	OpTypeGet
	OpTypeList
	OpTypeGetAttributes
	OpTypeSetAttributes
)

Jump to

Keyboard shortcuts

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