|
| 1 | +package v1alpha1 |
| 2 | + |
| 3 | +import ( |
| 4 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 5 | + "k8s.io/apimachinery/pkg/runtime" |
| 6 | +) |
| 7 | + |
| 8 | +// +genclient |
| 9 | +// +genclient:noStatus |
| 10 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 11 | + |
| 12 | +// DynamoDB defines the base resource |
| 13 | +type DynamoDB struct { |
| 14 | + metav1.TypeMeta `json:",inline"` |
| 15 | + metav1.ObjectMeta `json:"metadata"` |
| 16 | + Spec DynamoDBSpec `json:"spec"` |
| 17 | + Status DynamoDBStatus `json:"status"` |
| 18 | + Output DynamoDBOutput `json:"output"` |
| 19 | + AdditionalResources DynamoDBAdditionalResources `json:"additionalResources"` |
| 20 | +} |
| 21 | +// DynamoDBHashAttribute defines the HashAttribute resource for DynamoDB |
| 22 | +type DynamoDBHashAttribute struct { |
| 23 | + Name string `json:"Name"` |
| 24 | + Type string `json:"Type"` |
| 25 | +} |
| 26 | + |
| 27 | +// DynamoDBRangeAttribute defines the RangeAttribute resource for DynamoDB |
| 28 | +type DynamoDBRangeAttribute struct { |
| 29 | + Name string `json:"Name"` |
| 30 | + Type string `json:"Type"` |
| 31 | +} |
| 32 | + |
| 33 | +// DynamoDBSpec defines the Spec resource for DynamoDB |
| 34 | +type DynamoDBSpec struct { |
| 35 | + CloudFormationTemplateName string `json:"cloudFormationTemplateName"` |
| 36 | + CloudFormationTemplateNamespace string `json:"cloudFormationTemplateNamespace"` |
| 37 | + TableName string `json:"tableName"` |
| 38 | + RangeAttribute DynamoDBRangeAttribute `json:"rangeAttribute"` |
| 39 | + ReadCapacityUnits int `json:"readCapacityUnits"` |
| 40 | + WriteCapacityUnits int `json:"writeCapacityUnits"` |
| 41 | + HashAttribute DynamoDBHashAttribute `json:"hashAttribute"` |
| 42 | +} |
| 43 | + |
| 44 | + |
| 45 | +// DynamoDBOutput defines the output resource for DynamoDB |
| 46 | +type DynamoDBOutput struct { |
| 47 | + TableName string `json:"tableName"` |
| 48 | + TableARN string `json:"tableARN"` |
| 49 | +} |
| 50 | + |
| 51 | +// DynamoDBStatus holds the status of the Cloudformation template |
| 52 | +type DynamoDBStatus struct { |
| 53 | + ResourceStatus string `json:"resourceStatus"` |
| 54 | + ResourceStatusReason string `json:"resourceStatusReason"` |
| 55 | + StackID string `json:"stackID"` |
| 56 | +} |
| 57 | + |
| 58 | +// DynamoDBAdditionalResources holds the additional resources |
| 59 | +type DynamoDBAdditionalResources struct { |
| 60 | +} |
| 61 | + |
| 62 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 63 | + |
| 64 | +// DynamoDBList defines the list attribute for the DynamoDB type |
| 65 | +type DynamoDBList struct { |
| 66 | + metav1.TypeMeta `json:",inline"` |
| 67 | + metav1.ListMeta `json:"metadata"` |
| 68 | + Items []DynamoDB `json:"items"` |
| 69 | +} |
| 70 | + |
| 71 | +func init() { |
| 72 | + localSchemeBuilder.Register(addDynamoDBTypes) |
| 73 | +} |
| 74 | + |
| 75 | +func addDynamoDBTypes(scheme *runtime.Scheme) error { |
| 76 | + scheme.AddKnownTypes(SchemeGroupVersion, |
| 77 | + &DynamoDB{}, |
| 78 | + &DynamoDBList{}, |
| 79 | + ) |
| 80 | + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) |
| 81 | + return nil |
| 82 | +} |
0 commit comments