Skip to content

Commit

Permalink
Update examples for s3 bucket notifications and sqs queue policies
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Bush <[email protected]>
  • Loading branch information
mbbush committed Mar 18, 2024
1 parent c04b0d2 commit 6da65a9
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 24 deletions.
84 changes: 84 additions & 0 deletions examples/s3/v1beta1/bucketnotification-sqs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

apiVersion: s3.aws.upbound.io/v1beta1
kind: BucketNotification
metadata:
name: example
annotations:
meta.upbound.io/example-id: s3/v1beta1/bucketnotification
labels:
testing.upbound.io/example-name: bucket-notification
spec:
forProvider:
region: us-west-1
bucketSelector:
matchLabels:
testing.upbound.io/example-name: bucket-notification
queue:
- events:
- "s3:ObjectCreated:*"
filterSuffix: ".log"
queueArnSelector:
matchLabels:
testing.upbound.io/example-name: bucket-notification

---
apiVersion: s3.aws.upbound.io/v1beta1
kind: Bucket
metadata:
name: bucket-notification
annotations:
meta.upbound.io/example-id: s3/v1beta1/bucketnotification
crossplane.io/external-name: ${Rand.RFC1123Subdomain}
labels:
testing.upbound.io/example-name: bucket-notification
spec:
forProvider:
region: us-west-1

---
apiVersion: sqs.aws.upbound.io/v1beta1
kind: Queue
metadata:
name: bucket-notification
annotations:
meta.upbound.io/example-id: s3/v1beta1/bucketnotification
labels:
testing.upbound.io/example-name: bucket-notification
spec:
forProvider:
region: us-west-1
name: bucket-notification

---
apiVersion: sqs.aws.upbound.io/v1beta1
kind: QueuePolicy
metadata:
name: bucket-notification
annotations:
meta.upbound.io/example-id: s3/v1beta1/bucketnotification
labels:
testing.upbound.io/example-name: bucket-notification
spec:
forProvider:
region: us-west-1
queueUrlSelector:
matchLabels:
testing.upbound.io/example-name: bucket-notification
policy: |
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "example",
"Effect": "Allow",
"Principal": {
"Service": "s3.amazonaws.com"
},
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:us-west-1:*:bucket-notification"
}
]
}
65 changes: 62 additions & 3 deletions examples/s3/v1beta1/bucketnotification.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,76 @@ kind: BucketNotification
metadata:
name: example
annotations:
upjet.upbound.io/manual-intervention: "Requires a TopicPolicy for the referenced Topic and TopicPolicy is not covered yet."
meta.upbound.io/example-id: s3/v1beta1/bucketnotification
labels:
testing.upbound.io/example-name: bucket-notification
spec:
forProvider:
region: us-west-1
bucketSelector:
matchLabels:
testing.upbound.io/example-name: s3
testing.upbound.io/example-name: bucket-notification
topic:
- events:
- "s3:ObjectCreated:*"
filterSuffix: ".log"
topicArnSelector:
matchLabels:
testing.upbound.io/example-name: s3
testing.upbound.io/example-name: bucket-notification

---
apiVersion: s3.aws.upbound.io/v1beta1
kind: Bucket
metadata:
name: bucket-notification
annotations:
meta.upbound.io/example-id: s3/v1beta1/bucketnotification
crossplane.io/external-name: ${Rand.RFC1123Subdomain}
labels:
testing.upbound.io/example-name: bucket-notification
spec:
forProvider:
region: us-west-1
---
apiVersion: sns.aws.upbound.io/v1beta1
kind: Topic
metadata:
name: bucket-notification
annotations:
meta.upbound.io/example-id: s3/v1beta1/bucketnotification
labels:
testing.upbound.io/example-name: bucket-notification
spec:
forProvider:
region: us-west-1

---
apiVersion: sns.aws.upbound.io/v1beta1
kind: TopicPolicy
metadata:
name: bucket-notification
annotations:
meta.upbound.io/example-id: s3/v1beta1/bucketnotification
labels:
testing.upbound.io/example-name: bucket-notification
spec:
forProvider:
region: us-west-1
arnSelector:
matchLabels:
testing.upbound.io/example-name: bucket-notification
policy: |
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "example",
"Effect": "Allow",
"Principal": {
"Service": "s3.amazonaws.com"
},
"Action": "sns:Publish",
"Resource": "arn:aws:sns:us-west-1:*:bucket-notification"
}
]
}
42 changes: 21 additions & 21 deletions examples/sqs/v1beta1/queuepolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,43 @@
apiVersion: sqs.aws.upbound.io/v1beta1
kind: QueuePolicy
metadata:
labels:
testing.upbound.io/example-name: test
name: test
name: queue-policy
annotations:
upjet.upbound.io/manual-intervention: "This resource requires manual intervention for adding resource and source ARNs."
meta.upbound.io/example-id: sqs/v1beta1/queue-policy
labels:
testing.upbound.io/example-name: queue-policy
spec:
forProvider:
region: us-west-1
queueUrlSelector:
matchLabels:
testing.upbound.io/example-name: queue-policy
policy: |
{
"Version": "2012-10-17",
"Id": "sqspolicy",
"Statement": [
{
"Sid": "First",
"Sid": "example",
"Effect": "Allow",
"Principal": "*",
"Principal": {
"Service": "s3.amazonaws.com"
},
"Action": "sqs:SendMessage",
"Resource": "${resource_arn}",
"Condition": {
"ArnEquals": {
"aws:SourceArn": "${source_arn}}"
}
}
"Resource": "arn:aws:sqs:us-west-1:*:queue-policy"
}
]
}
queueUrlSelector:
matchLabels:
testing.upbound.io/example-name: example
region: us-west-1
---

apiVersion: sns.aws.upbound.io/v1beta1
kind: Topic
apiVersion: sqs.aws.upbound.io/v1beta1
kind: Queue
metadata:
name: user-updates-topic
name: queue-policy
annotations:
meta.upbound.io/example-id: sqs/v1beta1/queuepolicy
labels:
testing.upbound.io/example-name: queue-policy
spec:
forProvider:
region: us-west-1
name: queue-policy

0 comments on commit 6da65a9

Please sign in to comment.