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

Commit c6a8e67

Browse files
author
Christopher Hein
authored
Merge pull request #46 from christopherhein/feature/33-sns-topic
Adding SNS Topic Creation
2 parents 794bc44 + 842efb3 commit c6a8e67

File tree

25 files changed

+1273
-186
lines changed

25 files changed

+1273
-186
lines changed

examples/snstopic.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: operator.aws/v1alpha1
2+
kind: SNSTopic
3+
metadata:
4+
name: sns-topic-10

models/snstopic.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: operator.aws/v1alpha1
2+
kind: ModelDefinition
3+
metadata:
4+
name: SNSResource
5+
spec:
6+
kind: SNSTopic
7+
type: Spec # can be Spec or Data
8+
queue: true
9+
useCloudFormation: true
10+
resource:
11+
name: snstopic
12+
plural: snstopics
13+
shortNames:
14+
- name: sns
15+
- name: topic
16+
- name: topics
17+
body:
18+
schema:
19+
type: object
20+
properties:
21+
22+
output:
23+
schema:
24+
type: object
25+
properties:
26+
- key: topicName
27+
type: string
28+
description: |
29+
TopicName is the output topicname incase it changed
30+
structKey: TopicName
31+
templateKey: TopicName

pkg/apis/operator.aws/v1alpha1/s3bucket.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type S3BucketStatus struct {
4949

5050
// S3BucketAdditionalResources holds the additional resources
5151
type S3BucketAdditionalResources struct {
52+
Services []string `json:"services"`
5253
}
5354

5455
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
// SNSTopic defines the base resource
13+
type SNSTopic struct {
14+
metav1.TypeMeta `json:",inline"`
15+
metav1.ObjectMeta `json:"metadata"`
16+
Spec SNSTopicSpec `json:"spec"`
17+
Status SNSTopicStatus `json:"status"`
18+
Output SNSTopicOutput `json:"output"`
19+
AdditionalResources SNSTopicAdditionalResources `json:"additionalResources"`
20+
}
21+
type SNSTopicSpec struct {
22+
CloudFormationTemplateName string `json:"cloudFormationTemplateName"`
23+
CloudFormationTemplateNamespace string `json:"cloudFormationTemplateNamespace"`
24+
}
25+
26+
// SNSTopicOutput defines the output resource for SNSTopic
27+
type SNSTopicOutput struct {
28+
TopicName string `json:"topicName"`
29+
}
30+
31+
// SNSTopicStatus holds the status of the Cloudformation template
32+
type SNSTopicStatus struct {
33+
ResourceStatus string `json:"resourceStatus"`
34+
ResourceStatusReason string `json:"resourceStatusReason"`
35+
StackID string `json:"stackID"`
36+
}
37+
38+
// SNSTopicAdditionalResources holds the additional resources
39+
type SNSTopicAdditionalResources struct {
40+
}
41+
42+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
43+
44+
// SNSTopicList defines the list attribute for the SNSTopic type
45+
type SNSTopicList struct {
46+
metav1.TypeMeta `json:",inline"`
47+
metav1.ListMeta `json:"metadata"`
48+
Items []SNSTopic `json:"items"`
49+
}
50+
51+
func init() {
52+
localSchemeBuilder.Register(addSNSTopicTypes)
53+
}
54+
55+
func addSNSTopicTypes(scheme *runtime.Scheme) error {
56+
scheme.AddKnownTypes(SchemeGroupVersion,
57+
&SNSTopic{},
58+
&SNSTopicList{},
59+
)
60+
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
61+
return nil
62+
}

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

Lines changed: 133 additions & 1 deletion
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)