Documentation ¶
Index ¶
- Constants
- Variables
- func CleanGoType(api *SDKAPI, cfg *ackgenconfig.Config, shape *awssdkmodel.Shape, ...) (string, string, string)
- func ReplacePkgName(subject string, apiPkgName string, replacePkgAlias string, keepPointer bool) string
- func ResourceManagerMethodFromOpType(opType OpType) string
- type Attr
- type By
- type CRD
- func (r *CRD) AddSpecField(memberNames names.Names, shapeRef *awssdkmodel.ShapeRef)
- func (r *CRD) AddStatusField(memberNames names.Names, shapeRef *awssdkmodel.ShapeRef)
- func (r *CRD) AddTypeImport(packagePath string, alias string)
- func (r *CRD) AdditionalPrinterColumns() []*PrinterColumn
- func (r *CRD) CompareIgnoredFields() []string
- func (r *CRD) Config() *ackgenconfig.Config
- func (r *CRD) CustomUpdateMethodName() string
- func (r *CRD) Documentation() string
- func (r *CRD) ExceptionCode(httpStatusCode int) string
- func (r *CRD) GetAllRenames(op OpType) map[string]string
- func (r *CRD) GetCustomCheckRequiredFieldsMissingMethod(op *awssdkmodel.Operation) string
- func (r *CRD) GetCustomImplementation(op *awssdkmodel.Operation) string
- func (r *CRD) GetIdentifiers() []string
- func (r *CRD) GetImmutableFieldPaths() []string
- func (r *CRD) GetOutputShape(op *awssdkmodel.Operation) (*awssdkmodel.Shape, error)
- func (r *CRD) GetOutputShapeGoType(op *awssdkmodel.Operation) string
- func (r *CRD) GetOutputWrapperFieldPath(op *awssdkmodel.Operation) *string
- func (r *CRD) GetPrimaryKeyField() (*Field, error)
- func (r *CRD) GetResourcePrintOrderByName() string
- func (r *CRD) GetSanitizedMemberPath(memberName string, op *awssdkmodel.Operation, koVarName string) (string, error)
- func (r *CRD) GetStorageVersion(defaultVersion string) (string, error)
- func (r *CRD) GetTagField() (*Field, error)
- func (r *CRD) GetTagFieldName() (string, error)
- func (r *CRD) GetTagKeyMemberName() (keyMemberName string)
- func (r *CRD) GetTagValueMemberName() (valueMemberName string)
- func (r *CRD) HasImmutableFieldChanges() bool
- func (r *CRD) HasMember(memberName string, operationName string) (inSpec bool, inStatus bool)
- func (r *CRD) HasReferenceFields() bool
- func (r *CRD) HasShapeAsMember(toFind string) bool
- func (r *CRD) IsARNPrimaryKey() bool
- func (r *CRD) IsAdoptable() bool
- func (r *CRD) IsPrimaryARNField(fieldName string) bool
- func (r *CRD) IsSecretField(path string) bool
- func (r *CRD) ListOpMatchFieldNames() []string
- func (r *CRD) PrintAgeColumn() bool
- func (r *CRD) PrintSyncedColumn() bool
- func (r *CRD) ReconcileRequeuOnSuccessSeconds() int
- func (r *CRD) ReferencedServiceNames() (serviceNames []string)
- func (r *CRD) SDKAPIPackageName() string
- func (r *CRD) SetAttributesSingleAttribute() bool
- func (r *CRD) SetOutputCustomMethodName(op *awssdkmodel.Operation) *string
- func (r *CRD) SortedFieldNames() []string
- func (r *CRD) SpecFieldNames() []string
- func (r *CRD) SpecIdentifierField() *string
- func (r *CRD) TerminalExceptionCodes() []string
- func (r *CRD) TypeRenames() map[string]string
- func (r *CRD) UnpackAttributes()
- func (r *CRD) UnpacksAttributesMap() bool
- func (r *CRD) UpdateConditionsCustomMethodName() string
- type CustomShape
- type EnumDef
- type EnumValue
- type Field
- func (f *Field) FieldPathWithUnderscore() string
- func (f *Field) GetReferenceFieldName() names.Names
- func (f *Field) GetSetterConfig(opType OpType) *ackgenconfig.SetFieldConfig
- func (f *Field) HasReference() bool
- func (f *Field) IsReference() bool
- func (f *Field) IsRequired() bool
- func (f *Field) ReferenceFieldPath() string
- func (f *Field) ReferencedResourceNamePlural() string
- func (f *Field) ReferencedServiceName() (referencedServiceName string)
- type Model
- func (m *Model) APIGroup() string
- func (m *Model) ApplyShapeIgnoreRules()
- func (m *Model) GetCRDs() ([]*CRD, error)
- func (m *Model) GetConfig() *ackgenconfig.Config
- func (m *Model) GetEnumDefs() ([]*EnumDef, error)
- func (m *Model) GetTypeDefs() ([]*TypeDef, error)
- func (m *Model) IsShapeUsedInCRDs(shapeName string) bool
- func (m *Model) MetaVars() templateset.MetaVars
- func (m *Model) RemoveIgnoredOperations(ops *Ops)
- type OpType
- type OperationMap
- type Ops
- type PrinterColumn
- type SDKAPI
- func (a *SDKAPI) APIInterfaceTypeName() string
- func (a *SDKAPI) CRDNames(cfg *ackgenconfig.Config) []names.Names
- func (a *SDKAPI) GetCustomShapeRef(shapeName string) *awssdkmodel.ShapeRef
- func (a *SDKAPI) GetInputShapeRef(opID string, path string) (*awssdkmodel.ShapeRef, bool)
- func (a *SDKAPI) GetOperationMap(cfg *ackgenconfig.Config) *OperationMap
- func (a *SDKAPI) GetOutputShapeRef(opID string, path string) (*awssdkmodel.ShapeRef, bool)
- func (a *SDKAPI) GetPayloads() []string
- func (a *SDKAPI) GetServiceFullName() string
- func (a *SDKAPI) GetShapeRefFromType(typeOverride string) *awssdkmodel.ShapeRef
- func (a *SDKAPI) GetTypeRenames(cfg *ackgenconfig.Config) map[string]string
- func (a *SDKAPI) HasConflictingTypeName(typeName string, cfg *ackgenconfig.Config) bool
- func (a *SDKAPI) ServiceID() string
- type TypeDef
Constants ¶
const ( // ConflictingNameSuffix is appended to type names when they overlap with // well-known common struct names for things like a CRD itself, or its // Spec/Status subfield struct type name. ConflictingNameSuffix = "_SDK" )
Variables ¶
var ( // ErrNilShapePointer indicates an unexpected nil Shape pointer ErrNilShapePointer = errors.New("found nil Shape pointer") )
var ( // GoTypeToSDKShapeType is a map of Go types to aws-sdk-go // private/model/api.Shape types GoTypeToSDKShapeType = map[string]string{ "int": "integer", "int64": "integer", "float64": "float", "string": "string", "bool": "boolean", "time.Time": "timestamp", } )
Functions ¶
func CleanGoType ¶ added in v0.15.2
func CleanGoType( api *SDKAPI, cfg *ackgenconfig.Config, shape *awssdkmodel.Shape, fieldCfg *ackgenconfig.FieldConfig, ) (string, string, string)
CleanGoType returns a tuple of three strings representing the normalized Go types in "element", "normal" and "with package name" format for a particular Shape.
func ReplacePkgName ¶
func ReplacePkgName( subject string, apiPkgName string, replacePkgAlias string, keepPointer bool, ) string
ReplacePkgName accepts a type string (`subject`), as returned by `aws-sdk-go/private/model/api:Shape.GoTypeWithPkgName()` and replaces the package name of the aws-sdk-go SDK API (e.g. "ecr" for the ECR API) with a different package alias, typically the string "svcsdk" which is the alias we use in our Go code generating functions that get placed into files like `services/$SERVICE/pkg/resource/$RESOURCE/sdk.go`.
As an example, if ReplacePkgName() is called with the following parameters:
subject: "*ecr.Repository" apiPkgName: "ecr" replacePkgAlias: "svcsdk" keepPointer: true
the returned string would be "*svcsdk.Repository"
Why do we need to do this? Well, the Go code-generating functions return strings of Go code that construct various aws-sdk-go "service API shapes".
For example, the `github.com/aws/aws-sdk-go/services/ecr.DescribeRepositoriesResponse` struct returns a slice of `github.com/aws/aws-sdk-go/services/ecr.Repository` structs. The `aws-sdk-go/private/model/api.Shape` object that represents these `Repository` structs has a `GoTypeWithPkgName()` method that returns the string "*ecr.Repository". But because in our `templates/pkg/resource/sdk.go.tpl` file [0], you will note that we always alias the aws-sdk-go "service api" package as "svcsdk". So, we need a way to replace the "ecr." in the type string with "svcsdk.".
func ResourceManagerMethodFromOpType ¶ added in v0.16.0
ResourceManagerMethodFromOpType returns the string representing the AWSResourceManager method ("Create", "Update", "Delete" or "ReadOne") corresponding to the supplied OpType.
Types ¶
type By ¶ added in v0.0.6
type By func(a, b *PrinterColumn) bool
By can sort two PrinterColumns
func (By) Sort ¶ added in v0.0.6
func (by By) Sort(subject []*PrinterColumn)
Sort does an in-place sort of the supplied printer columns
type CRD ¶
type CRD struct { Names names.Names Kind string Plural string // Ops are the CRUD operations controlling this resource Ops Ops // SpecFields is a map, keyed by the **original SDK member name** of // Field objects representing those fields in the CRD's Spec struct // field. SpecFields map[string]*Field // StatusFields is a map, keyed by the **original SDK member name** of // Field objects representing those fields in the CRD's Status struct // field. Note that there are no fields in StatusFields that are also in // SpecFields. StatusFields map[string]*Field // Fields is a map, keyed by the **renamed/normalized field path**, of // Field objects representing a field in the CRD's Spec or Status objects. Fields map[string]*Field // TypeImports is a map, keyed by an import string, with the map value // being the import alias TypeImports map[string]string // ShortNames represent the CRD list of aliases. Short names allow shorter // strings to match a CR on the CLI. ShortNames []string // contains filtered or unexported fields }
CRD describes a single top-level resource in an AWS service API
func NewCRD ¶
NewCRD returns a pointer to a new `ackmodel.CRD` struct that describes a single top-level resource in an AWS service API
func (*CRD) AddSpecField ¶
func (r *CRD) AddSpecField( memberNames names.Names, shapeRef *awssdkmodel.ShapeRef, )
AddSpecField adds a new Field of a given name and shape into the Spec field of a CRD
func (*CRD) AddStatusField ¶
func (r *CRD) AddStatusField( memberNames names.Names, shapeRef *awssdkmodel.ShapeRef, )
AddStatusField adds a new Field of a given name and shape into the Status field of a CRD
func (*CRD) AddTypeImport ¶
AddTypeImport adds an entry in the CRD's TypeImports map for an import line and optional alias
func (*CRD) AdditionalPrinterColumns ¶
func (r *CRD) AdditionalPrinterColumns() []*PrinterColumn
AdditionalPrinterColumns returns a sorted list of PrinterColumn structs for the resource
func (*CRD) CompareIgnoredFields ¶
CompareIgnoredFields returns the list of fields compare logic should ignore
func (*CRD) Config ¶
func (r *CRD) Config() *ackgenconfig.Config
Config returns a pointer to the generator config
func (*CRD) CustomUpdateMethodName ¶
CustomUpdateMethodName returns the name of the custom resourceManager method for updating the resource state, if any has been specified in the generator config
func (*CRD) Documentation ¶ added in v0.2.3
Documentation returns the base documentation string for the API formatted as a Go code comment block
func (*CRD) ExceptionCode ¶
ExceptionCode returns the name of the resource's Exception code for the Exception having the exception code. If the generator config has instructions for overriding the name of an exception code for a resource for a particular HTTP status code, we return that, otherwise we look through the API model definitions looking for a match
func (*CRD) GetAllRenames ¶ added in v0.6.0
GetAllRenames returns all the field renames observed in the generator config for a given OpType.
func (*CRD) GetCustomCheckRequiredFieldsMissingMethod ¶ added in v0.5.0
func (r *CRD) GetCustomCheckRequiredFieldsMissingMethod( op *awssdkmodel.Operation, ) string
GetCustomCheckRequiredFieldsMissingMethod returns custom check required fields missing method as string for custom resource
func (*CRD) GetCustomImplementation ¶
func (r *CRD) GetCustomImplementation( op *awssdkmodel.Operation, ) string
GetCustomImplementation returns custom implementation method name for the supplied operation as specified in generator config
func (*CRD) GetIdentifiers ¶ added in v0.13.1
GetIdentifiers returns the identifier fields of a given CRD which can be singular or plural. Note, these fields will be the *original* field names from the API model shape, not renamed field names.
func (*CRD) GetImmutableFieldPaths ¶ added in v0.2.2
GetImmutableFieldPaths returns list of immutable field paths present in CRD
func (*CRD) GetOutputShape ¶ added in v0.3.0
func (r *CRD) GetOutputShape( op *awssdkmodel.Operation, ) (*awssdkmodel.Shape, error)
GetOutputShape returns the Output shape for a given operation and applies wrapper field path overrides.
func (*CRD) GetOutputShapeGoType ¶ added in v0.3.0
func (r *CRD) GetOutputShapeGoType( op *awssdkmodel.Operation, ) string
GetOutputShapeGoType returns the Go type of the supplied operation's Output shape, renamed to use the standardized svcsdk alias.
func (*CRD) GetOutputWrapperFieldPath ¶ added in v0.2.3
func (r *CRD) GetOutputWrapperFieldPath( op *awssdkmodel.Operation, ) *string
GetOutputWrapperFieldPath returns the JSON-Path of the output wrapper field as *string for a given operation.
func (*CRD) GetPrimaryKeyField ¶ added in v0.14.0
GetPrimaryKeyField returns the field designated as the primary key, nil if none are specified or an error if multiple are designated.
func (*CRD) GetResourcePrintOrderByName ¶ added in v0.2.3
GetResourcePrintOrderByName returns the Printer Column order-by field name
func (*CRD) GetSanitizedMemberPath ¶ added in v0.13.1
func (r *CRD) GetSanitizedMemberPath( memberName string, op *awssdkmodel.Operation, koVarName string) (string, error)
GetSanitizedMemberPath takes a shape member field, checks for renames, checks for existence in Spec and Status, then constructs and returns the var path. Returns error if memberName is not present in either Spec or Status.
func (*CRD) GetStorageVersion ¶ added in v0.16.4
GetStorageVersion returns the configured storage API version for the CRD, or the specified default version.
func (*CRD) GetTagField ¶ added in v0.19.0
GetTagField return the model.Field representing the Tag field for CRD. If no such field is found an error is returned.
func (*CRD) GetTagFieldName ¶ added in v0.19.0
GetTagFieldName returns the name of field containing AWS tags. The default name is "Tags". If no tag field is found inside the CRD, an error is returned
func (*CRD) GetTagKeyMemberName ¶ added in v0.19.0
GetTagKeyMemberName returns the member name which represents tag key. The default value is "Key". This is only applicable for tag fields with shape list of struct.If the tag field shape is not list of struct, an empty string is returned.
func (*CRD) GetTagValueMemberName ¶ added in v0.19.0
GetTagValueMemberName returns the member name which represents tag value. The default value is "Value". This is only applicable for tag fields with shape list of struct.If the tag field shape is not list of struct, an empty string is returned.
func (*CRD) HasImmutableFieldChanges ¶ added in v0.2.2
HasImmutableFieldChanges helper function that return true if there are any immutable field changes
func (*CRD) HasMember ¶ added in v0.16.0
HasMember returns true in the respective field if Spec xor Status field contains memberName or rename
func (*CRD) HasReferenceFields ¶ added in v0.16.0
HasReferenceFields returns true if any of the fields in CRD is a reference field. Otherwise returns false
func (*CRD) HasShapeAsMember ¶
HasShapeAsMember returns true if the supplied Shape name appears in *any* payload shape of *any* Operation for the resource. It recurses down through the resource's Operation Input and Output shapes and their member shapes looking for a shape with the supplied name
func (*CRD) IsARNPrimaryKey ¶ added in v0.14.0
IsARNPrimaryKey returns true if the CRD uses its ARN as its primary key in ReadOne calls.
func (*CRD) IsAdoptable ¶ added in v0.1.0
IsAdoptable returns true if the resource can be adopted
func (*CRD) IsPrimaryARNField ¶
IsPrimaryARNField returns true if the supplied field name is likely the resource's ARN identifier field.
func (*CRD) IsSecretField ¶ added in v0.2.0
IsSecretField returns true if the supplied field *path* refers to a Field that is a SecretKeyReference
func (*CRD) ListOpMatchFieldNames ¶
ListOpMatchFieldNames returns a slice of strings representing the field names in the List operation's Output shape's element Shape that we should check a corresponding value in the target Spec exists.
func (*CRD) PrintAgeColumn ¶ added in v0.2.3
PrintAgeColumn returns whether the code generator should append 'Age' kubebuilder:printcolumn comment marker
func (*CRD) PrintSyncedColumn ¶ added in v0.19.0
PrintSyncedColumn returns whether the code generator should append 'Sync' kubebuilder:printcolumn comment marker
func (*CRD) ReconcileRequeuOnSuccessSeconds ¶ added in v0.3.1
ReconcileRequeuOnSuccessSeconds returns the duration after which to requeue the custom resource as int
func (*CRD) ReferencedServiceNames ¶ added in v0.18.0
ReferencedServiceNames returns the set of service names for ACK controllers whose resources are referenced inside the CRD. The service name is the go package name for the AWS service inside aws-sdk-go.
If a CRD has no reference fields, nil is returned(zero vale of slice)
func (*CRD) SDKAPIPackageName ¶
SDKAPIPackageName returns the aws-sdk-go package name used for this resource's API
func (*CRD) SetAttributesSingleAttribute ¶
SetAttributesSingleAttribute returns true if the supplied resource name has a SetAttributes operation that only actually changes a single attribute at a time. See: SNS SetTopicAttributes API call, which is entirely different from the SNS SetPlatformApplicationAttributes API call, which sets multiple attributes at once. :shrug:
func (*CRD) SetOutputCustomMethodName ¶
func (r *CRD) SetOutputCustomMethodName( op *awssdkmodel.Operation, ) *string
SetOutputCustomMethodName returns custom set output operation as *string for given operation on custom resource
func (*CRD) SortedFieldNames ¶ added in v0.18.0
SortedFieldNames returns the fieldNames of the CRD in a sorted order.
func (*CRD) SpecFieldNames ¶
SpecFieldNames returns a sorted slice of field names for the Spec fields
func (*CRD) SpecIdentifierField ¶ added in v0.1.0
SpecIdentifierField returns the name of the "Name" or string identifier field in the Spec.
func (*CRD) TerminalExceptionCodes ¶
TerminalExceptionCodes returns terminal exception codes as []string for custom resource
func (*CRD) TypeRenames ¶
TypeRenames returns a map of original type name to renamed name (some type definition names conflict with generated names)
func (*CRD) UnpackAttributes ¶
func (r *CRD) UnpackAttributes()
UnpackAttributes grabs instructions about fields that are represented in the AWS API as a `map[string]*string` but are actually real, schema'd fields and adds Field definitions for those fields.
func (*CRD) UnpacksAttributesMap ¶
UnpacksAttributesMap returns true if the underlying API has Get{Resource}Attributes/Set{Resource}Attributes API calls that map real, schema'd fields to a raw `map[string]*string` for this resource (see SNS and SQS APIs)
func (*CRD) UpdateConditionsCustomMethodName ¶
UpdateConditionsCustomMethodName returns custom update conditions operation as *string for custom resource
type CustomShape ¶ added in v0.15.2
type CustomShape struct { Shape *awssdkmodel.Shape ShapeRef *awssdkmodel.ShapeRef MemberShapeName *string ValueShapeName *string }
CustomShape represents a shape created by the generator that does not exist in the standard AWS SDK models.
func NewCustomListShape ¶ added in v0.15.2
func NewCustomListShape(shape *awssdkmodel.Shape, ref *awssdkmodel.ShapeRef, memberShapeName string) *CustomShape
NewCustomListShape creates a custom shape object for a new list.
func NewCustomMapShape ¶ added in v0.15.2
func NewCustomMapShape(shape *awssdkmodel.Shape, ref *awssdkmodel.ShapeRef, valueShapeName string) *CustomShape
NewCustomMapShape creates a custom shape object for a new map.
type EnumDef ¶
EnumDef is the definition of an enumeration type for a field present in either a CRD or a TypeDef
type Field ¶
type Field struct { // CRD is the a pointer to the top-level custom resource definition // descriptor for the field or field's parent (if a nested field) CRD *CRD // Names is a set of normalized names for the field Names names.Names // Path is a "field path" that indicates where the field is within the CRD. // For example "Spec.Name" or "Status.BrokerInstances..Endpoint". Note for // the latter example, the field path indicates that the field `Endpoint` // is an attribute of the `Status.BrokerInstances` top-level field and the // double dot (`..` indicates that BrokerInstances is a list type). Path string // GoType is a string containing the Go data type for the field GoType string // GoTypeElem indicates the Go data type for the type of list element if // the field is a list type GoTypeElem string GoTypeWithPkgName string ShapeRef *awssdkmodel.ShapeRef FieldConfig *ackgenconfig.FieldConfig // MemberFields is a map, keyed by the *renamed, cleaned, camel-cased name* of // member fields when this Field is a struct type. MemberFields map[string]*Field }
Field represents a single field in the CRD's Spec or Status objects. The field may be a direct field of the Spec or Status object or may be a field of a list or struct-type field of the Spec or Status object. We call these latter fields "nested fields" and they are identified by the Field.Path attribute.
func NewField ¶ added in v0.2.0
func NewField( crd *CRD, path string, fieldNames names.Names, shapeRef *awssdkmodel.ShapeRef, cfg *ackgenconfig.FieldConfig, ) *Field
NewField returns a pointer to a new Field object
func NewReferenceField ¶ added in v0.16.0
NewReferenceField returns a pointer to a new Field object. The go-type of field is either slice of '*AWSResourceReferenceWrapper' or '*AWSResourceReferenceWrapper' depending on whether 'shapeRef' parameter has 'list' type or not, respectively
func (*Field) FieldPathWithUnderscore ¶ added in v0.18.2
FieldPathWithUnderscore replaces the period in fieldPath with underscore. This method is useful for generating go method name from the fieldPath.
func (*Field) GetReferenceFieldName ¶ added in v0.16.4
GetReferenceFieldName returns the corresponding Reference field name Reference field name is generated by removing the identifier suffix like 'Id', 'Arn', 'Name' etc and adding 'Ref(s)' as suffix.
func (*Field) GetSetterConfig ¶ added in v0.16.0
func (f *Field) GetSetterConfig(opType OpType) *ackgenconfig.SetFieldConfig
GetSetterConfig returns the SetFieldConfig object associated with this field and a supplied operation type, or nil if none exists.
func (*Field) HasReference ¶ added in v0.16.0
HasReference returns true if the supplied field *path* refers to a Field that contains 'ReferencesConfig' i.e. has a corresponding reference field. Ex: ``` Integration:
fields: ApiId: references: resource: API path: Status.APIID
``` For the above configuration, 'HasReference' for 'ApiId'(Original name) field will return true because a corresponding 'APIRef' field will be generated by ACK code-generator
func (*Field) IsReference ¶ added in v0.16.0
IsReference returns true if the Field has type '*ackv1alpha1.AWSResourceReferenceWrapper' or '[]*ackv1alpha1.AWSResourceReferenceWrapper'. These fields are not part of aws-sdk-go model and they are generated by ACK code-generator to accept references of other resource(s).
func (*Field) IsRequired ¶
IsRequired checks the FieldConfig for Field and returns if the field is marked as required or not.A
If there is no required override present for this field in FieldConfig, IsRequired will return if the shape is marked as required in AWS SDK Private model We use this to append kubebuilder:validation:Required markers to validate using the CRD validation schema
func (*Field) ReferenceFieldPath ¶ added in v0.18.2
ReferenceFieldPath returns the fieldPath for the corresponding Reference field. It replaces the fieldName with ReferenceFieldName at the end of fieldPath
func (*Field) ReferencedResourceNamePlural ¶ added in v0.17.1
ReferencedResourceNamePlural returns the plural of referenced resource when the field has a 'ReferencesConfig' If the field does not have 'ReferencesConfig', empty string is returned
func (*Field) ReferencedServiceName ¶ added in v0.17.1
ReferencedServiceName returns the serviceName for the referenced resource when the field has 'ReferencesConfig' If the field does not have 'ReferencesConfig', empty string is returned
type Model ¶ added in v0.5.0
type Model struct { SDKAPI *SDKAPI // contains filtered or unexported fields }
Model contains the ACK model for the generator to process and apply templates against.
func New ¶ added in v0.5.0
func New( SDKAPI *SDKAPI, servicePackageName string, apiVersion string, cfg ackgenconfig.Config, ) (*Model, error)
New returns a new Model struct for a supplied API model. Optionally, pass a file path to a generator config file that can be used to instruct the code generator how to handle the API properly
func (*Model) APIGroup ¶ added in v0.15.0
APIGroup returns the normalized Kubernetes APIGroup for the AWS service API, e.g. "sns.services.k8s.aws"
func (*Model) ApplyShapeIgnoreRules ¶ added in v0.5.0
func (m *Model) ApplyShapeIgnoreRules()
ApplyShapeIgnoreRules removes the ignored shapes and fields from the API object so that they are not considered in any of the calculations of code generator.
func (*Model) GetCRDs ¶ added in v0.5.0
GetCRDs returns a slice of `CRD` structs that describe the top-level resources discovered by the code generator for an AWS service API
func (*Model) GetConfig ¶ added in v0.5.0
func (m *Model) GetConfig() *ackgenconfig.Config
GetConfig returns the configuration option used to define the current generator.
func (*Model) GetEnumDefs ¶ added in v0.5.0
GetEnumDefs returns a slice of pointers to `EnumDef` structs which represent string fields whose value is constrained to one or more specific string values.
func (*Model) GetTypeDefs ¶ added in v0.5.0
GetTypeDefs returns a slice of `TypeDef` pointers
func (*Model) IsShapeUsedInCRDs ¶ added in v0.5.0
IsShapeUsedInCRDs returns true if the supplied shape name is a member of amy CRD's payloads or those payloads sub-member shapes
func (*Model) MetaVars ¶ added in v0.5.0
func (m *Model) MetaVars() templateset.MetaVars
MetaVars returns a MetaVars struct populated with metadata about the AWS service API
func (*Model) RemoveIgnoredOperations ¶ added in v0.5.0
RemoveIgnoredOperations updates Ops argument by setting those operations to nil that are configured to be ignored in generator config for the AWS service
type OpType ¶
type OpType int
func GetOpTypeAndResourceNameFromOpID ¶
func GetOpTypeAndResourceNameFromOpID( opID string, cfg *ackgenconfig.Config, ) (OpType, string)
GetOpTypeAndResourceNameFromOpID guesses the resource name and type of operation from the OperationID
func OpTypeFromString ¶
type OperationMap ¶
type OperationMap map[OpType]map[string]*awssdkmodel.Operation
type Ops ¶
type Ops struct { Create *awssdkmodel.Operation ReadOne *awssdkmodel.Operation ReadMany *awssdkmodel.Operation Update *awssdkmodel.Operation Delete *awssdkmodel.Operation GetAttributes *awssdkmodel.Operation SetAttributes *awssdkmodel.Operation }
Ops are the CRUD operations controlling a particular resource
func (Ops) IterOps ¶
func (ops Ops) IterOps() []*awssdkmodel.Operation
IterOps returns a slice of Operations for a resource
type PrinterColumn ¶
type PrinterColumn struct { CRD *CRD Name string Type string Priority int JSONPath string Index int }
PrinterColumn represents a single field in the CRD's Spec or Status objects
type SDKAPI ¶
type SDKAPI struct { API *awssdkmodel.API APIGroupSuffix string CustomShapes []*CustomShape // contains filtered or unexported fields }
SDKAPI contains an API model for a single AWS service API
func NewSDKAPI ¶ added in v0.15.2
func NewSDKAPI(api *awssdkmodel.API, apiGroupSuffix string) *SDKAPI
NewSDKAPI returns a pointer to a new `ackmodel.SDKAPI` struct that describes the AWS SDK API and its respective groupings, mappings and renamings.
func (*SDKAPI) APIInterfaceTypeName ¶ added in v0.15.2
APIInterfaceTypeName returns the name of the aws-sdk-go primary API interface type name.
func (*SDKAPI) CRDNames ¶
func (a *SDKAPI) CRDNames(cfg *ackgenconfig.Config) []names.Names
CRDNames returns a slice of names structs for all top-level resources in the API
func (*SDKAPI) GetCustomShapeRef ¶ added in v0.15.2
func (a *SDKAPI) GetCustomShapeRef(shapeName string) *awssdkmodel.ShapeRef
GetCustomShapeRef finds a ShapeRef for a custom shape using either its member or its value shape name.
func (*SDKAPI) GetInputShapeRef ¶
GetInputShapeRef finds a ShapeRef for a supplied member path (dot-notation) for given API operation
func (*SDKAPI) GetOperationMap ¶
func (a *SDKAPI) GetOperationMap(cfg *ackgenconfig.Config) *OperationMap
GetOperationMap returns a map, keyed by the operation type and operation ID/name, of aws-sdk-go private/model/api.Operation struct pointers
func (*SDKAPI) GetOutputShapeRef ¶
GetOutputShapeRef finds a ShapeRef for a supplied member path (dot-notation) for given API operation
func (*SDKAPI) GetPayloads ¶
GetPayloads returns a slice of strings of Shape names representing input and output request/response payloads
func (*SDKAPI) GetServiceFullName ¶
func (*SDKAPI) GetShapeRefFromType ¶ added in v0.16.2
func (a *SDKAPI) GetShapeRefFromType( typeOverride string, ) *awssdkmodel.ShapeRef
GetShapeRefFromType returns a ShapeRef given a string representing the Go type. If no shape can be determined, returns nil.
func (*SDKAPI) GetTypeRenames ¶
func (a *SDKAPI) GetTypeRenames(cfg *ackgenconfig.Config) map[string]string
GetTypeRenames returns a map of original type name to renamed name (some type definition names conflict with generated names)
func (*SDKAPI) HasConflictingTypeName ¶
func (a *SDKAPI) HasConflictingTypeName(typeName string, cfg *ackgenconfig.Config) bool
HasConflictingTypeName returns true if the supplied type name will conflict with any generated type in the service's API package
type TypeDef ¶
TypeDef is a Go type definition for structs that are member fields of the Spec or Status structs in Custom Resource Definitions (CRDs).
func (*TypeDef) GetAttribute ¶ added in v0.18.2
GetAttribute returns the Attribute with name "attrName". This method performs case-insensitive matching to find the Attribute.