|
| 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 | +// ElastiCache defines the base resource |
| 13 | +type ElastiCache struct { |
| 14 | + metav1.TypeMeta `json:",inline"` |
| 15 | + metav1.ObjectMeta `json:"metadata"` |
| 16 | + Spec ElastiCacheSpec `json:"spec"` |
| 17 | + Status ElastiCacheStatus `json:"status"` |
| 18 | + Output ElastiCacheOutput `json:"output"` |
| 19 | + AdditionalResources ElastiCacheAdditionalResources `json:"additionalResources"` |
| 20 | +} |
| 21 | + |
| 22 | +// ElastiCacheSpec defines the Spec resource for ElastiCache |
| 23 | +type ElastiCacheSpec struct { |
| 24 | + CloudFormationTemplateName string `json:"cloudFormationTemplateName"` |
| 25 | + CloudFormationTemplateNamespace string `json:"cloudFormationTemplateNamespace"` |
| 26 | + RollbackCount int `json:"rollbackCount"` |
| 27 | + AutoMinorVersionUpgrade bool `json:"AutoMinorVersionUpgrade"` |
| 28 | + AZMode string `json:"AZMode"` |
| 29 | + CacheNodeType string `json:"CacheNodeType"` |
| 30 | + CacheParameterGroupName string `json:"CacheParameterGroupName"` |
| 31 | + CacheSubnetGroupName string `json:"CacheSubnetGroupName"` |
| 32 | + Engine string `json:"Engine"` |
| 33 | + EngineVersion string `json:"EngineVersion"` |
| 34 | + NotificationTopicArn string `json:"NotificationTopicArn"` |
| 35 | + NumCacheNodes int `json:"NumCacheNodes"` |
| 36 | + Port int `json:"Port"` |
| 37 | + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow"` |
| 38 | + PreferredAvailabilityZone string `json:"PreferredAvailabilityZone"` |
| 39 | + PreferredAvailabilityZones string `json:"PreferredAvailabilityZones"` |
| 40 | + SnapshotWindow string `json:"SnapshotWindow"` |
| 41 | + VpcSecurityGroupIds string `json:"VpcSecurityGroupIds"` |
| 42 | +} |
| 43 | + |
| 44 | +// ElastiCacheOutput defines the output resource for ElastiCache |
| 45 | +type ElastiCacheOutput struct { |
| 46 | + RedisEndpointAddress string `json:"RedisEndpointAddress"` |
| 47 | + RedisEndpointPort string `json:"RedisEndpointPort"` |
| 48 | + ConfigurationEndpointAddress string `json:"ConfigurationEndpoint"` |
| 49 | + ConfigurationEndpointPort string `json:"ConfigurationEndpointPort"` |
| 50 | +} |
| 51 | + |
| 52 | +// ElastiCacheStatus holds the status of the Cloudformation template |
| 53 | +type ElastiCacheStatus struct { |
| 54 | + ResourceStatus string `json:"resourceStatus"` |
| 55 | + ResourceStatusReason string `json:"resourceStatusReason"` |
| 56 | + StackID string `json:"stackID"` |
| 57 | +} |
| 58 | + |
| 59 | +// ElastiCacheAdditionalResources holds the additional resources |
| 60 | +type ElastiCacheAdditionalResources struct { |
| 61 | + Services []string `json:"services"` |
| 62 | +} |
| 63 | + |
| 64 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 65 | + |
| 66 | +// ElastiCacheList defines the list attribute for the ElastiCache type |
| 67 | +type ElastiCacheList struct { |
| 68 | + metav1.TypeMeta `json:",inline"` |
| 69 | + metav1.ListMeta `json:"metadata"` |
| 70 | + Items []ElastiCache `json:"items"` |
| 71 | +} |
| 72 | + |
| 73 | +func init() { |
| 74 | + localSchemeBuilder.Register(addElastiCacheTypes) |
| 75 | +} |
| 76 | + |
| 77 | +func addElastiCacheTypes(scheme *runtime.Scheme) error { |
| 78 | + scheme.AddKnownTypes(SchemeGroupVersion, |
| 79 | + &ElastiCache{}, |
| 80 | + &ElastiCacheList{}, |
| 81 | + ) |
| 82 | + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) |
| 83 | + return nil |
| 84 | +} |
0 commit comments