Skip to content
This repository was archived by the owner on Nov 7, 2019. It is now read-only.

Commit 50c238b

Browse files
author
Christopher Hein
authored
Merge pull request #24 from christopherhein/feature/7-adding-sqs
Adding SQS resource
2 parents 655b5e5 + 205995e commit 50c238b

File tree

17 files changed

+1243
-0
lines changed

17 files changed

+1243
-0
lines changed

examples/sqs.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: operator.aws/v1alpha1
2+
kind: SQS
3+
metadata:
4+
name: chrishein-test-sqs-1
5+
spec:
6+
contentBasedDeduplication: false
7+
delaySeconds: 1
8+
usedeadletterQueue: false

models/sqsqueue.yaml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
apiVersion: operator.aws/v1alpha1
2+
kind: ModelDefinition
3+
metadata:
4+
name: SQSResource
5+
spec:
6+
kind: SQSQueue
7+
type: Spec # can be Spec or Data
8+
queue: true
9+
useCloudFormation: true
10+
resource:
11+
name: sqsqueue
12+
plural: sqsqueues
13+
shortNames:
14+
- name: sqs
15+
- name: queue
16+
- name: queues
17+
body:
18+
schema:
19+
type: object
20+
properties:
21+
- key: contentBasedDeduplication
22+
type: bool
23+
description: |
24+
ContentBasedDeduplication enables content deduping on the queue
25+
structKey: ContentBasedDeduplication
26+
templateKey: ContentBasedDeduplication
27+
- key: delaySeconds
28+
type: int
29+
description: |
30+
DelaySeconds is how long the message should delay on recieving.
31+
structKey: DelaySeconds
32+
templateKey: DelaySeconds
33+
- key: maximumMessageSize
34+
type: int
35+
description: |
36+
MaximumMessageSize the maximum size a message should be and int
37+
structKey: MaximumMessageSize
38+
templateKey: MaximumMessageSize
39+
- key: messageRetentionPeriod
40+
type: int
41+
description: |
42+
MaximumMessageSize the maximum size a message should be
43+
MessageRetentionPeriod determines how long to keep a message
44+
structKey: MessageRetentionPeriod
45+
templateKey: MessageRetentionPeriod
46+
- key: receiveMessageWaitTimeSeconds
47+
type: int
48+
description: |
49+
Time it will wait until it tries to find another message to process.
50+
structKey: ReceiveMessageWaitTimeSeconds
51+
templateKey: ReceiveMessageWaitTimeSeconds
52+
- key: usedeadletterQueue
53+
type: bool
54+
description: |
55+
Queue specifically made for messages that cannot be processed
56+
structKey: UsedeadletterQueue
57+
templateKey: UsedeadletterQueue
58+
- key: visibilityTimeout
59+
type: int
60+
description: |
61+
Timeout for processing a message.
62+
structKey: VisibilityTimeout
63+
templateKey: VisibilityTimeout
64+
- key: fifoQueue
65+
type: bool
66+
description: |
67+
Should this queue process messages in a first in first out manner
68+
structKey: FifoQueue
69+
templateKey: FifoQueue
70+
output:
71+
schema:
72+
type: object
73+
properties:
74+
- key: queueURL
75+
type: string
76+
description: |
77+
URL of newly created SQS Queue
78+
structKey: QueueURL
79+
templateKey: QueueURL
80+
- key: queueARN
81+
type: string
82+
description: |
83+
ARN of newly created SQS Queue
84+
structKey: QueueARN
85+
templateKey: QueueARN
86+
- key: queueName
87+
type: string
88+
description: |
89+
Name newly created SQS Queue
90+
structKey: QueueName
91+
templateKey: QueueName
92+
- key: deadLetterQueueURL
93+
type: string
94+
description: |
95+
URL of newly created SQS Queue
96+
structKey: DeadLetterQueueURL
97+
templateKey: DeadLetterQueueURL
98+
- key: deadLetterQueueARN
99+
type: string
100+
description: |
101+
ARN of newly created SQS Queue
102+
structKey: DeadLetterQueueARN
103+
templateKey: DeadLetterQueueARN
104+
- key: deadLetterQueueName
105+
type: string
106+
description: |
107+
Name newly created SQS Queue
108+
structKey: DeadLetterQueueName
109+
templateKey: DeadLetterQueueName
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
// SQSQueue defines the base resource
13+
type SQSQueue struct {
14+
metav1.TypeMeta `json:",inline"`
15+
metav1.ObjectMeta `json:"metadata"`
16+
Spec SQSQueueSpec `json:"spec"`
17+
Status SQSQueueStatus `json:"status"`
18+
Output SQSQueueOutput `json:"output"`
19+
AdditionalResources SQSQueueAdditionalResources `json:"additionalResources"`
20+
}
21+
// SQSQueueSpec defines the Spec resource for SQSQueue
22+
type SQSQueueSpec struct {
23+
CloudFormationTemplateName string `json:"cloudFormationTemplateName"`
24+
CloudFormationTemplateNamespace string `json:"cloudFormationTemplateNamespace"`
25+
ContentBasedDeduplication bool `json:"contentBasedDeduplication"`
26+
DelaySeconds int `json:"delaySeconds"`
27+
MaximumMessageSize int `json:"maximumMessageSize"`
28+
MessageRetentionPeriod int `json:"messageRetentionPeriod"`
29+
ReceiveMessageWaitTimeSeconds int `json:"receiveMessageWaitTimeSeconds"`
30+
UsedeadletterQueue bool `json:"usedeadletterQueue"`
31+
VisibilityTimeout int `json:"visibilityTimeout"`
32+
FifoQueue bool `json:"fifoQueue"`
33+
}
34+
35+
36+
// SQSQueueOutput defines the output resource for SQSQueue
37+
type SQSQueueOutput struct {
38+
QueueURL string `json:"queueURL"`
39+
QueueARN string `json:"queueARN"`
40+
QueueName string `json:"queueName"`
41+
DeadLetterQueueURL string `json:"deadLetterQueueURL"`
42+
DeadLetterQueueARN string `json:"deadLetterQueueARN"`
43+
DeadLetterQueueName string `json:"deadLetterQueueName"`
44+
}
45+
46+
// SQSQueueStatus holds the status of the Cloudformation template
47+
type SQSQueueStatus struct {
48+
ResourceStatus string `json:"resourceStatus"`
49+
ResourceStatusReason string `json:"resourceStatusReason"`
50+
StackID string `json:"stackID"`
51+
}
52+
53+
// SQSQueueAdditionalResources holds the additional resources
54+
type SQSQueueAdditionalResources struct {
55+
}
56+
57+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
58+
59+
// SQSQueueList defines the list attribute for the SQSQueue type
60+
type SQSQueueList struct {
61+
metav1.TypeMeta `json:",inline"`
62+
metav1.ListMeta `json:"metadata"`
63+
Items []SQSQueue `json:"items"`
64+
}
65+
66+
func init() {
67+
localSchemeBuilder.Register(addSQSQueueTypes)
68+
}
69+
70+
func addSQSQueueTypes(scheme *runtime.Scheme) error {
71+
scheme.AddKnownTypes(SchemeGroupVersion,
72+
&SQSQueue{},
73+
&SQSQueueList{},
74+
)
75+
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
76+
return nil
77+
}

pkg/apis/operator.aws/v1alpha1/zz_generated.deepcopy.go

Lines changed: 127 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/clientset/versioned/typed/operator.aws/v1alpha1/fake/fake_operator.aws_client.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)