Documentation ¶
Index ¶
- Constants
- func AddFieldsToResourceDefinition(ctx context.Context, rd *model.ResourceDefinition, cfg *config.ResourceConfig, ...) error
- func GetAPIs(ctx context.Context, basePath string, modelPaths []string) (map[string]*awssdkmodel.API, error)
- func GetResourceDefinitionsForService(ctx context.Context, service string, api *awssdkmodel.API, cfg *config.Config) ([]*model.ResourceDefinition, error)
- func New(opts ...option) discover.DiscoversResources
- func VisitMemberShape(ctx context.Context, rd *model.ResourceDefinition, path *fieldpath.Path, ...) *model.FieldDefinition
- func WithAPIModelPaths(apiModelPaths ...string) option
- func WithCachePath(path string) option
- func WithConfig(cfg *config.Config) option
- func WithServices(services ...string) option
- type OpType
Constants ¶
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 ¶
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