Documentation
¶
Index ¶
- Variables
- func Deduplicate(s []string) []string
- func GenerateAwsServiceCode(template *AwsTemplate) error
- func PopulateChildStructs(structModel *StructModel, children []*ChildConfig, ...)
- func SnakeToHyphen(str string) string
- func ToSnakeCase(str string) string
- type AwsReferencedResourceTemplate
- type AwsResourceConfig
- type AwsResourceTemplate
- type AwsServiceConfig
- type AwsServiceTemplate
- type AwsTemplate
- func (t *AwsTemplate) GetAwsCatalogFileCode() string
- func (t *AwsTemplate) GetAwsClientFileCode() string
- func (t *AwsTemplate) GetAwsRouterFileCode() string
- func (t *AwsTemplate) GetClientInterfaceFileCode() string
- func (t *AwsTemplate) GetDAOFileCode() string
- func (t *AwsTemplate) GetDynamoDBDAOFileCode() string
- func (t *AwsTemplate) GetImplementedResourcesCode() string
- func (t *AwsTemplate) GetMongoDAOFileCode() string
- func (t *AwsTemplate) GetMultiDAOFileCode() string
- func (t *AwsTemplate) GetS3IonDAOFileCode() string
- func (t *AwsTemplate) GetS3ParquetDAOFileCode() string
- type ChildConfig
- type ExtraFieldConfig
- type FieldModel
- type StructModel
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotAStruct = errors.New("given objects underlying type is not a struct") ErrUnsupportedFieldType = errors.New("given field type is not supported") )
Functions ¶
func Deduplicate ¶
func GenerateAwsServiceCode ¶
func GenerateAwsServiceCode(template *AwsTemplate) error
func PopulateChildStructs ¶
func PopulateChildStructs(structModel *StructModel, children []*ChildConfig, servicePackages []*packages.Package)
func SnakeToHyphen ¶
func ToSnakeCase ¶
Types ¶
type AwsReferencedResourceTemplate ¶
type AwsReferencedResourceTemplate struct {
ServiceName string
ReferencedStructs []*StructModel
RequiredImports []string
}
func (*AwsReferencedResourceTemplate) DetermineRequiredImports ¶
func (t *AwsReferencedResourceTemplate) DetermineRequiredImports()
func (*AwsReferencedResourceTemplate) GetAwsReferencedResourceFileCode ¶
func (t *AwsReferencedResourceTemplate) GetAwsReferencedResourceFileCode() string
type AwsResourceConfig ¶
type AwsResourceConfig struct {
Label string `hcl:"name,label"`
FetchFunction string `hcl:"fetch_function,attr"` // the API function used to fetch the resource
ObjectSourceName string `hcl:"object_source_name,attr"` // the name of the object in the API
ObjectSingularName string `hcl:"object_singular_name,optional"` // the singular name of the object
ObjectPluralName string `hcl:"object_plural_name"` // the plural name of the object
ObjectUniqueId string `hcl:"object_unique_id,attr"` // the name of a field in the object that uniquely identifies it
ObjectResponseField string `hcl:"object_response_field,attr"` // the name of the object in the API response
ModelOnly bool `hcl:"model_only,attr"` // whether or not to only generate data models, not fetching code
Pagination bool `hcl:"pagination,attr"` // whether or not the API supports pagination
UsePostProcessing bool `hcl:"use_post_processing,attr"` // whether or not to use post processing
ConvertTags bool `hcl:"convert_tags,attr"` // whether or not to convert tags to map[string]string
TagFieldName string `hcl:"tag_field_name,optional"` // the name of the field that contains the tags
DisplayFields []string `hcl:"display_fields,optional"` // the fields to display when listing resources
ExcludedFields []string `hcl:"excluded_fields,optional"`
ExtraFields []*ExtraFieldConfig `hcl:"extra_field,block"`
Children []*ChildConfig `hcl:"child,block"`
}
func (AwsResourceConfig) ObjectPluralSnakeName ¶
func (c AwsResourceConfig) ObjectPluralSnakeName() string
func (AwsResourceConfig) ObjectSingularSnakeName ¶
func (c AwsResourceConfig) ObjectSingularSnakeName() string
func (AwsResourceConfig) ObjectUniqueIdSnakeCase ¶
func (c AwsResourceConfig) ObjectUniqueIdSnakeCase() string
type AwsResourceTemplate ¶
type AwsResourceTemplate struct {
ServiceName string
ServiceCapName string
ResourceStruct *StructModel
ResourceConfig *AwsResourceConfig
RequiredImports []string
SdkClientName string
ShouldConvertTags bool
TagListFieldName string
}
func (*AwsResourceTemplate) DetermineRequiredImports ¶
func (t *AwsResourceTemplate) DetermineRequiredImports()
func (*AwsResourceTemplate) GetAwsApiRouteCode ¶
func (t *AwsResourceTemplate) GetAwsApiRouteCode() string
func (*AwsResourceTemplate) GetAwsFetchingFileCode ¶
func (t *AwsResourceTemplate) GetAwsFetchingFileCode() string
func (*AwsResourceTemplate) GetResourceFileCode ¶
func (t *AwsResourceTemplate) GetResourceFileCode() string
type AwsServiceConfig ¶
type AwsServiceConfig struct {
Name string `hcl:"name,label"`
ServiceCapName string `hcl:"service_cap_name,attr"`
SdkPath string `hcl:"sdk_path,attr"`
Resources []*AwsResourceConfig `hcl:"resource,block"`
ExtraUtilizedFunctions []string `hcl:"extra_utilized_functions,optional"`
RegionOverride string `hcl:"region_override,optional"`
TagObjectName string `hcl:"tag_object_name,optional"` // the name of the object in the SDK which represents a tag
}
func (*AwsServiceConfig) HasRegionOverride ¶
func (c *AwsServiceConfig) HasRegionOverride() bool
type AwsServiceTemplate ¶
type AwsServiceTemplate struct {
ServiceName string
TagObjectName string
SdkPath string
SdkClientName string
UtilizedFunctions []string
ServiceConfig *AwsServiceConfig
}
func (*AwsServiceTemplate) GetAwsHelpersFileCode ¶
func (t *AwsServiceTemplate) GetAwsHelpersFileCode() string
func (*AwsServiceTemplate) GetAwsServiceClientInterfaceFileCode ¶
func (t *AwsServiceTemplate) GetAwsServiceClientInterfaceFileCode() string
func (*AwsServiceTemplate) GetAwsServiceInventoryFileCode ¶
func (t *AwsServiceTemplate) GetAwsServiceInventoryFileCode() string
func (*AwsServiceTemplate) GetServiceMetadataRouteFileCode ¶
func (t *AwsServiceTemplate) GetServiceMetadataRouteFileCode() string
type AwsTemplate ¶
type AwsTemplate struct {
Services []*AwsServiceConfig `hcl:"aws_service,block"`
}
func (*AwsTemplate) GetAwsCatalogFileCode ¶
func (t *AwsTemplate) GetAwsCatalogFileCode() string
func (*AwsTemplate) GetAwsClientFileCode ¶
func (t *AwsTemplate) GetAwsClientFileCode() string
func (*AwsTemplate) GetAwsRouterFileCode ¶
func (t *AwsTemplate) GetAwsRouterFileCode() string
func (*AwsTemplate) GetClientInterfaceFileCode ¶
func (t *AwsTemplate) GetClientInterfaceFileCode() string
func (*AwsTemplate) GetDAOFileCode ¶
func (t *AwsTemplate) GetDAOFileCode() string
func (*AwsTemplate) GetDynamoDBDAOFileCode ¶
func (t *AwsTemplate) GetDynamoDBDAOFileCode() string
func (*AwsTemplate) GetImplementedResourcesCode ¶
func (t *AwsTemplate) GetImplementedResourcesCode() string
func (*AwsTemplate) GetMongoDAOFileCode ¶
func (t *AwsTemplate) GetMongoDAOFileCode() string
func (*AwsTemplate) GetMultiDAOFileCode ¶
func (t *AwsTemplate) GetMultiDAOFileCode() string
func (*AwsTemplate) GetS3IonDAOFileCode ¶
func (t *AwsTemplate) GetS3IonDAOFileCode() string
func (*AwsTemplate) GetS3ParquetDAOFileCode ¶
func (t *AwsTemplate) GetS3ParquetDAOFileCode() string
type ChildConfig ¶
type ChildConfig struct {
ObjectSourceName string `hcl:"object_source_name"`
NewFieldName string `hcl:"new_field_name"`
FieldType string `hcl:"field_type"`
ExcludedFields []string `hcl:"excluded_fields,optional"`
ExtraFields []*ExtraFieldConfig `hcl:"extra_field,block"`
Children []*ChildConfig `hcl:"child,block"`
}
type ExtraFieldConfig ¶
type FieldModel ¶
type FieldModel struct {
Name string
Type string
Tags string
IsTimeField bool
ReferencedStructs []*StructModel // Parsed structs referenced by this field, could be multiple if it's a map
}
FieldModel represents a parsed source-code of a struct field
func ParseStructField ¶
func ParseStructField(field *types.Var, excludedFields []string) (*FieldModel, error)
ParseStructField parses a single struct field
type StructModel ¶
type StructModel struct {
Name string
Fields []*FieldModel
}
StructModel represents a parsed source-code of a struct and all its fields
func DeduplicateStructs ¶
func DeduplicateStructs(structs []*StructModel) []*StructModel
func ParseStruct ¶
func ParseStruct(object *types.Named, excludedFields []string, nameOverride *string) (*StructModel, error)
ParseStruct parses a struct and all its fields
func (*StructModel) ConvertTagFields ¶
func (p *StructModel) ConvertTagFields()
func (*StructModel) GetReferencedStructs ¶
func (p *StructModel) GetReferencedStructs() []*StructModel
func (*StructModel) GetRequiredImports ¶
func (p *StructModel) GetRequiredImports() []string
func (*StructModel) MarshalToSourceCode ¶
func (p *StructModel) MarshalToSourceCode() string
func (*StructModel) PopulateFieldTags ¶
func (p *StructModel) PopulateFieldTags(primaryObjectField string)
Click to show internal directories.
Click to hide internal directories.