├── cmd ├── awssnssource │ ├── kodata │ │ ├── HEAD │ │ └── refs │ ├── main.go │ └── Dockerfile ├── awssqssource │ ├── kodata │ │ ├── HEAD │ │ └── refs │ ├── Dockerfile │ ├── main.go │ └── README.md ├── awscloudwatchsource │ ├── kodata │ │ ├── HEAD │ │ └── refs │ ├── main.go │ └── Dockerfile ├── awscodecommitsource │ ├── kodata │ │ ├── HEAD │ │ └── refs │ ├── main.go │ ├── Dockerfile │ └── README.md ├── awsdynamodbsource │ ├── kodata │ │ ├── HEAD │ │ └── refs │ ├── main.go │ └── Dockerfile ├── awskinesissource │ ├── kodata │ │ ├── HEAD │ │ └── refs │ ├── main.go │ ├── Dockerfile │ └── README.md ├── awscloudwatchlogssource │ ├── kodata │ │ ├── HEAD │ │ └── refs │ ├── main.go │ └── Dockerfile ├── awscognitoidentitysource │ ├── kodata │ │ ├── HEAD │ │ └── refs │ ├── main.go │ ├── Dockerfile │ └── README.md ├── awscognitouserpoolsource │ ├── kodata │ │ ├── HEAD │ │ └── refs │ ├── cloudbuild.yaml │ ├── main.go │ ├── Dockerfile │ └── README.md ├── aws-event-sources-controller │ ├── kodata │ │ ├── HEAD │ │ └── refs │ └── Dockerfile └── awsperformanceinsightssource │ ├── main.go │ └── Dockerfile ├── hack ├── kinesisproducer │ ├── .gitignore │ ├── Makefile │ ├── go.mod │ └── README.md ├── tools.go ├── boilerplate │ └── boilerplate.go.txt └── release-notes.sh ├── images ├── saws.png ├── klass-logo.png └── triggermesh-cloud.png ├── licenses └── EULA.pdf ├── .gcloudignore ├── .gitignore ├── .dockerignore ├── schemas ├── com.amazon.cloudwatch.metrics.message.json ├── com.amazon.logs.log.json ├── com.amazon.kinesis.stream_record.json ├── com.amazon.codecommit.push.json └── com.amazon.cloudwatch.metrics.metric.json ├── pkg ├── adapter │ ├── testing │ │ ├── doc.go │ │ └── controller.go │ ├── awssnssource │ │ ├── status │ │ │ ├── doc.go │ │ │ └── clock.go │ │ ├── events.go │ │ ├── controller_test.go │ │ └── adapter_test.go │ ├── common │ │ ├── controller │ │ │ └── controller.go │ │ ├── router │ │ │ └── router.go │ │ └── sharedmain │ │ │ └── sharedmain.go │ └── awscognitoidentitysource │ │ └── events.go ├── reconciler │ ├── testing │ │ ├── doc.go │ │ ├── aws.go │ │ └── utils.go │ ├── common │ │ ├── resource │ │ │ ├── doc.go │ │ │ ├── knservice.go │ │ │ ├── object.go │ │ │ └── deployment.go │ │ ├── doc.go │ │ ├── env.go │ │ ├── status.go │ │ ├── skip │ │ │ └── skip.go │ │ ├── event │ │ │ └── event.go │ │ ├── labels.go │ │ └── events.go │ ├── awssnssource │ │ ├── events.go │ │ └── controller_test.go │ ├── awss3source │ │ ├── controller_test.go │ │ └── events.go │ ├── awssqssource │ │ ├── controller_test.go │ │ └── reconciler.go │ ├── awskinesissource │ │ ├── controller_test.go │ │ └── reconciler.go │ ├── awsdynamodbsource │ │ ├── controller_test.go │ │ └── reconciler.go │ ├── awscloudwatchsource │ │ ├── controller_test.go │ │ └── reconciler.go │ ├── awscodecommitsource │ │ ├── controller_test.go │ │ └── reconciler.go │ ├── awscloudwatchlogssource │ │ ├── controller_test.go │ │ └── reconciler.go │ ├── awscognitoidentitysource │ │ ├── controller_test.go │ │ └── reconciler.go │ ├── awscognitouserpoolsource │ │ ├── controller_test.go │ │ └── reconciler.go │ └── awsperformanceinsightssource │ │ ├── controller_test.go │ │ └── reconciler.go ├── client │ └── generated │ │ ├── clientset │ │ └── internalclientset │ │ │ ├── fake │ │ │ └── doc.go │ │ │ ├── doc.go │ │ │ ├── scheme │ │ │ └── doc.go │ │ │ └── typed │ │ │ └── sources │ │ │ └── v1alpha1 │ │ │ ├── fake │ │ │ └── doc.go │ │ │ ├── doc.go │ │ │ └── generated_expansion.go │ │ ├── injection │ │ └── informers │ │ │ ├── sources │ │ │ └── v1alpha1 │ │ │ │ ├── awss3source │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ ├── awssnssource │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ ├── awssqssource │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ ├── awskinesissource │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ ├── awsdynamodbsource │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ ├── awscloudwatchsource │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ ├── awscodecommitsource │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ ├── awscloudwatchlogssource │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ ├── awscognitoidentitysource │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ ├── awscognitouserpoolsource │ │ │ │ ├── fake │ │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ │ └── fake │ │ │ │ │ └── fake.go │ │ │ │ └── awsperformanceinsightssource │ │ │ │ ├── fake │ │ │ │ └── fake.go │ │ │ │ └── filtered │ │ │ │ └── fake │ │ │ │ └── fake.go │ │ │ └── factory │ │ │ └── fake │ │ │ └── fake.go │ │ └── informers │ │ └── externalversions │ │ ├── internalinterfaces │ │ └── factory_interfaces.go │ │ └── sources │ │ └── interface.go ├── apis │ ├── sources │ │ └── v1alpha1 │ │ │ ├── doc.go │ │ │ ├── common_types.go │ │ │ └── conditions.go │ ├── arn.go │ └── duration.go ├── routing │ ├── routing.go │ └── routing_test.go ├── testing │ ├── event │ │ └── event.go │ └── structs │ │ └── structs.go └── aws │ └── s3 │ └── s3.go ├── config ├── 100-namespace.yaml ├── 201-serviceaccounts.yaml ├── samples │ ├── awssqssource.yaml │ ├── awskinesissource.yaml │ ├── awsdynamodbsource.yaml │ ├── awscognitouserpoolsource.yaml │ ├── awss3source.yaml │ ├── awscognitoidentitysource.yaml │ ├── awscloudwatchlogssource.yaml │ ├── awscodecommitsource.yaml │ ├── awscloudwatchsource.yaml │ └── awssnssource.yaml └── 202-clusterrolebindings.yaml ├── cloudbuild.yaml ├── go.mod └── kustomization.yaml /cmd/awssnssource/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/awssnssource/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /cmd/awssqssource/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/awssqssource/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /hack/kinesisproducer/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | vendor -------------------------------------------------------------------------------- /cmd/awscloudwatchsource/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/awscloudwatchsource/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /cmd/awscodecommitsource/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/awscodecommitsource/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /cmd/awsdynamodbsource/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/awsdynamodbsource/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /cmd/awskinesissource/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/awskinesissource/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /cmd/awscloudwatchlogssource/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/awscloudwatchlogssource/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /cmd/awscognitoidentitysource/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/awscognitoidentitysource/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /cmd/awscognitouserpoolsource/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/awscognitouserpoolsource/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /cmd/aws-event-sources-controller/kodata/HEAD: -------------------------------------------------------------------------------- 1 | ../../../.git/HEAD -------------------------------------------------------------------------------- /cmd/aws-event-sources-controller/kodata/refs: -------------------------------------------------------------------------------- 1 | ../../../.git/refs -------------------------------------------------------------------------------- /images/saws.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triggermesh/aws-event-sources/HEAD/images/saws.png -------------------------------------------------------------------------------- /hack/kinesisproducer/Makefile: -------------------------------------------------------------------------------- 1 | PACKAGE = awskinesisproducer 2 | include ../../scripts/inc.Makefile 3 | -------------------------------------------------------------------------------- /licenses/EULA.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triggermesh/aws-event-sources/HEAD/licenses/EULA.pdf -------------------------------------------------------------------------------- /images/klass-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triggermesh/aws-event-sources/HEAD/images/klass-logo.png -------------------------------------------------------------------------------- /images/triggermesh-cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triggermesh/aws-event-sources/HEAD/images/triggermesh-cloud.png -------------------------------------------------------------------------------- /hack/kinesisproducer/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/triggermesh/aws-event-sources/hack/kinesisproducer 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/aws/aws-sdk-go v1.29.31 7 | github.com/sirupsen/logrus v1.2.0 8 | ) 9 | -------------------------------------------------------------------------------- /hack/tools.go: -------------------------------------------------------------------------------- 1 | // +build tools 2 | 3 | package hack 4 | 5 | // These imports ensure build tools are included in Go modules. 6 | // See https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module 7 | import ( 8 | _ "k8s.io/code-generator" 9 | ) 10 | -------------------------------------------------------------------------------- /.gcloudignore: -------------------------------------------------------------------------------- 1 | #!include:.dockerignore 2 | !Dockerfile 3 | 4 | # Explicit inclusions are handled differently from .dockerignore files. 5 | # Ref. https://stackoverflow.com/a/29932318 6 | !/.git/ 7 | /.git/* 8 | !/.git/HEAD 9 | !.git/refs/ 10 | !/hack/ 11 | /hack/* 12 | !/hack/inc.Codegen.mk 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Local configurations and secrets 2 | /.env/ 3 | /.local/ 4 | 5 | # Continuous integration 6 | 7 | # Editors and IDEs 8 | *.swo 9 | *.swp 10 | *~ 11 | /*.sublime-project 12 | /*.sublime-workspace 13 | /.DS_Store 14 | /.idea/ 15 | /.vscode/ 16 | 17 | # Build artifacts 18 | **/_output 19 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # Top level files and directories 2 | /.circleci/ 3 | /.git/ 4 | /test/ 5 | /hack/ 6 | !/hack/inc.Codegen.mk 7 | /.dockerignore 8 | /.gcloudignore 9 | /cloudbuild.yaml 10 | /kustomization.yaml 11 | 12 | # Files copied to KO_DATA_PATH directory 13 | !/.git/HEAD 14 | !/.git/refs/ 15 | 16 | # Patterns 17 | **/config/ 18 | **/*.md 19 | **/*_test.go 20 | **/.gitignore 21 | **/Dockerfile 22 | 23 | # Binaries 24 | **/_output/ 25 | -------------------------------------------------------------------------------- /schemas/com.amazon.cloudwatch.metrics.message.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/MessageData", 4 | "definitions": { 5 | "MessageData": { 6 | "required": [ 7 | "Code", 8 | "Value" 9 | ], 10 | "properties": { 11 | "Code": { 12 | "type": "string" 13 | }, 14 | "Value": { 15 | "type": "string" 16 | } 17 | }, 18 | "additionalProperties": false, 19 | "type": "object" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /hack/kinesisproducer/README.md: -------------------------------------------------------------------------------- 1 | ## AWS Kinesis producer for populating kinesis stream with testing data 2 | 3 | This event producer is meant to be used as a producer of messages to Kinesis stream to test working source code. 4 | 5 | ### Build 6 | 7 | ``` 8 | dep ensure -v 9 | go build . 10 | ``` 11 | 12 | ### Local Usage 13 | 14 | Define a few environment variables: 15 | 16 | ``` 17 | export STREAM=default 18 | export AWS_REGION=us-east-1 19 | export AWS_ACCESS_KEY_ID=<> 20 | export AWS_SECRET_ACCESS_KEY=<> 21 | ``` 22 | 23 | Then just run the local binary in your shell to send messages to a defined kinesis stream -------------------------------------------------------------------------------- /hack/boilerplate/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | -------------------------------------------------------------------------------- /schemas/com.amazon.logs.log.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/OutputLogEvent", 4 | "definitions": { 5 | "OutputLogEvent": { 6 | "required": [ 7 | "IngestionTime", 8 | "Message", 9 | "Timestamp" 10 | ], 11 | "properties": { 12 | "IngestionTime": { 13 | "type": "integer" 14 | }, 15 | "Message": { 16 | "type": "string" 17 | }, 18 | "Timestamp": { 19 | "type": "integer" 20 | } 21 | }, 22 | "additionalProperties": false, 23 | "type": "object" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /pkg/adapter/testing/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package testing contains test helpers for adapters. 18 | package testing 19 | -------------------------------------------------------------------------------- /pkg/reconciler/testing/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package testing contains test helpers for reconcilers. 18 | package testing 19 | -------------------------------------------------------------------------------- /config/100-namespace.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | apiVersion: v1 16 | kind: Namespace 17 | metadata: 18 | name: triggermesh 19 | -------------------------------------------------------------------------------- /pkg/reconciler/common/resource/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package resource contains helpers to generate Kubernetes API objects. 18 | package resource 19 | -------------------------------------------------------------------------------- /pkg/reconciler/common/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package common contains reconciliation helpers shared between source reconcilers. 18 | package common 19 | -------------------------------------------------------------------------------- /pkg/adapter/awssnssource/status/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package status contains types and helpers to manipulate the status of source objects. 18 | package status 19 | -------------------------------------------------------------------------------- /config/201-serviceaccounts.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | apiVersion: v1 16 | kind: ServiceAccount 17 | metadata: 18 | name: aws-event-sources-controller 19 | namespace: triggermesh 20 | -------------------------------------------------------------------------------- /cmd/awscognitouserpoolsource/cloudbuild.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | 3 | - name: gcr.io/kaniko-project/executor:latest 4 | args: 5 | - --dockerfile=cmd/${_CMD}/Dockerfile 6 | - --destination=gcr.io/$PROJECT_ID/${_CMD}:${COMMIT_SHA} 7 | - --destination=gcr.io/$PROJECT_ID/${_CMD}:${_KANIKO_IMAGE_TAG} 8 | - --cache-repo=gcr.io/$PROJECT_ID/${_CMD}/cache 9 | - --cache=${_KANIKO_USE_BUILD_CACHE} 10 | - --no-push=${_KANIKO_NO_PUSH} 11 | - ${_KANIKO_EXTRA_ARGS} 12 | waitFor: ['-'] 13 | 14 | timeout: 600s 15 | 16 | substitutions: 17 | _CMD: awscognitouserpoolsource 18 | _KANIKO_IMAGE_TAG: latest 19 | _KANIKO_NO_PUSH: 'false' 20 | _KANIKO_USE_BUILD_CACHE: 'true' 21 | _KANIKO_EXTRA_ARGS: '' 22 | 23 | options: 24 | substitution_option: ALLOW_LOOSE 25 | 26 | tags: 27 | - aws-event-sources 28 | -------------------------------------------------------------------------------- /pkg/client/generated/clientset/internalclientset/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated fake clientset. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/adapter/awssnssource/events.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awssnssource 18 | 19 | // Reasons for API Events 20 | const ( 21 | ReasonSourceNotReady = "NotReady" 22 | ReasonHandlerDeregistered = "Deregistered" 23 | ) 24 | -------------------------------------------------------------------------------- /pkg/client/generated/clientset/internalclientset/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package internalclientset 21 | -------------------------------------------------------------------------------- /pkg/apis/sources/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains API Schema definitions for the sources/v1alpha1 API group. 18 | // +k8s:deepcopy-gen=package 19 | // +groupName=sources.triggermesh.io 20 | package v1alpha1 21 | -------------------------------------------------------------------------------- /cloudbuild.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | 3 | - name: gcr.io/kaniko-project/executor:v1.6.0-debug 4 | args: 5 | - --dockerfile=cmd/${_CMD}/Dockerfile 6 | - --build-arg=VERSION=${_KANIKO_IMAGE_TAG} 7 | - --destination=gcr.io/$PROJECT_ID/${_CMD}:${COMMIT_SHA} 8 | - --destination=gcr.io/$PROJECT_ID/${_CMD}:${_KANIKO_IMAGE_TAG} 9 | - --cache-repo=gcr.io/$PROJECT_ID/${_CMD}/cache 10 | - --cache=${_KANIKO_USE_BUILD_CACHE} 11 | - --no-push=${_KANIKO_NO_PUSH} 12 | - --snapshotMode=redo 13 | - --use-new-run 14 | - ${_KANIKO_EXTRA_ARGS} 15 | waitFor: ['-'] 16 | 17 | timeout: 1800s 18 | 19 | substitutions: 20 | _CMD: 21 | _KANIKO_IMAGE_TAG: latest 22 | _KANIKO_NO_PUSH: 'false' 23 | _KANIKO_USE_BUILD_CACHE: 'true' 24 | _KANIKO_EXTRA_ARGS: 25 | 26 | options: 27 | substitution_option: ALLOW_LOOSE 28 | 29 | tags: 30 | - aws-event-sources 31 | -------------------------------------------------------------------------------- /pkg/client/generated/clientset/internalclientset/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package contains the scheme of the automatically generated clientset. 20 | package scheme 21 | -------------------------------------------------------------------------------- /pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1alpha1 21 | -------------------------------------------------------------------------------- /pkg/routing/routing.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package routing 18 | 19 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 | 21 | // URLPath returns a URL path to route requests for the given source object. 22 | func URLPath(src metav1.Object) string { 23 | return "/" + src.GetNamespace() + "/" + src.GetName() 24 | } 25 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/triggermesh/aws-event-sources 2 | 3 | go 1.15 4 | 5 | // Top-level module control over the exact version used for important direct dependencies. 6 | // https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive 7 | replace k8s.io/client-go => k8s.io/client-go v0.19.7 8 | 9 | require ( 10 | github.com/aws/aws-sdk-go v1.37.1 11 | github.com/cloudevents/sdk-go/v2 v2.2.0 12 | github.com/google/go-cmp v0.5.5 13 | github.com/google/uuid v1.2.0 14 | github.com/kelseyhightower/envconfig v1.4.0 15 | github.com/stretchr/testify v1.6.1 16 | go.opencensus.io v0.23.0 17 | go.uber.org/zap v1.16.0 18 | k8s.io/api v0.19.7 19 | k8s.io/apimachinery v0.19.7 20 | k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible 21 | k8s.io/code-generator v0.19.7 22 | knative.dev/eventing v0.22.1 23 | knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0 24 | knative.dev/serving v0.22.0 25 | ) 26 | -------------------------------------------------------------------------------- /cmd/awskinesissource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "knative.dev/eventing/pkg/adapter/v2" 21 | 22 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awskinesissource" 23 | ) 24 | 25 | func main() { 26 | adapter.Main("awskinesissource", awskinesissource.NewEnvConfig, awskinesissource.NewAdapter) 27 | } 28 | -------------------------------------------------------------------------------- /cmd/awsdynamodbsource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "knative.dev/eventing/pkg/adapter/v2" 21 | 22 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awsdynamodbsource" 23 | ) 24 | 25 | func main() { 26 | adapter.Main("awsdynamodbsource", awsdynamodbsource.NewEnvConfig, awsdynamodbsource.NewAdapter) 27 | } 28 | -------------------------------------------------------------------------------- /cmd/awscloudwatchsource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "knative.dev/eventing/pkg/adapter/v2" 21 | 22 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awscloudwatchsource" 23 | ) 24 | 25 | func main() { 26 | adapter.Main("awscloudwatchsource", awscloudwatchsource.NewEnvConfig, awscloudwatchsource.NewAdapter) 27 | } 28 | -------------------------------------------------------------------------------- /cmd/awscodecommitsource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "knative.dev/eventing/pkg/adapter/v2" 21 | 22 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awscodecommitsource" 23 | ) 24 | 25 | func main() { 26 | adapter.Main("awscodecommitsource", awscodecommitsource.NewEnvConfig, awscodecommitsource.NewAdapter) 27 | } 28 | -------------------------------------------------------------------------------- /cmd/awscloudwatchlogssource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "knative.dev/eventing/pkg/adapter/v2" 21 | 22 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awscloudwatchlogssource" 23 | ) 24 | 25 | func main() { 26 | adapter.Main("awscloudwatchlogssource", awscloudwatchlogssource.NewEnvConfig, awscloudwatchlogssource.NewAdapter) 27 | } 28 | -------------------------------------------------------------------------------- /cmd/awscognitoidentitysource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "knative.dev/eventing/pkg/adapter/v2" 21 | 22 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awscognitoidentitysource" 23 | ) 24 | 25 | func main() { 26 | adapter.Main("awscognitoidentitysource", awscognitoidentitysource.NewEnvConfig, awscognitoidentitysource.NewAdapter) 27 | } 28 | -------------------------------------------------------------------------------- /cmd/awscognitouserpoolsource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "knative.dev/eventing/pkg/adapter/v2" 21 | 22 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awscognitouserpoolsource" 23 | ) 24 | 25 | func main() { 26 | adapter.Main("awscognitouserpoolsource", awscognitouserpoolsource.NewEnvConfig, awscognitouserpoolsource.NewAdapter) 27 | } 28 | -------------------------------------------------------------------------------- /cmd/awssnssource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awssnssource" 21 | "github.com/triggermesh/aws-event-sources/pkg/adapter/common/sharedmain" 22 | ) 23 | 24 | func main() { 25 | sharedmain.MainWithController(awssnssource.NewEnvConfig, awssnssource.NewController, awssnssource.NewAdapter) 26 | } 27 | -------------------------------------------------------------------------------- /cmd/awsperformanceinsightssource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "knative.dev/eventing/pkg/adapter/v2" 21 | 22 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awsperformanceinsightssource" 23 | ) 24 | 25 | func main() { 26 | adapter.Main("awsperformanceinsightssource", awsperformanceinsightssource.NewEnvConfig, awsperformanceinsightssource.NewAdapter) 27 | } 28 | -------------------------------------------------------------------------------- /schemas/com.amazon.kinesis.stream_record.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Record", 4 | "definitions": { 5 | "Record": { 6 | "required": [ 7 | "ApproximateArrivalTimestamp", 8 | "Data", 9 | "EncryptionType", 10 | "PartitionKey", 11 | "SequenceNumber" 12 | ], 13 | "properties": { 14 | "ApproximateArrivalTimestamp": { 15 | "type": "string", 16 | "format": "date-time" 17 | }, 18 | "Data": { 19 | "type": "string", 20 | "media": { 21 | "binaryEncoding": "base64" 22 | } 23 | }, 24 | "EncryptionType": { 25 | "type": "string" 26 | }, 27 | "PartitionKey": { 28 | "type": "string" 29 | }, 30 | "SequenceNumber": { 31 | "type": "string" 32 | } 33 | }, 34 | "additionalProperties": false, 35 | "type": "object" 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /pkg/reconciler/testing/aws.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package testing 18 | 19 | import "github.com/triggermesh/aws-event-sources/pkg/apis" 20 | 21 | // NewARN returns a ARN with the given attributes. 22 | func NewARN(service, resource string) apis.ARN { 23 | return apis.ARN{ 24 | Partition: "aws", 25 | Service: service, 26 | Region: "us-test-0", 27 | AccountID: "123456789012", 28 | Resource: resource, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pkg/testing/event/event.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package event contains test helpers for Kubernetes API events. 18 | package event 19 | 20 | import "fmt" 21 | 22 | // Eventf returns the attributes of an API event in the format returned by 23 | // Kubernetes' FakeRecorder. 24 | func Eventf(eventtype, reason, messageFmt string, args ...interface{}) string { 25 | return fmt.Sprintf(eventtype+" "+reason+" "+messageFmt, args...) 26 | } 27 | -------------------------------------------------------------------------------- /pkg/routing/routing_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package routing 18 | 19 | import ( 20 | "testing" 21 | 22 | "github.com/stretchr/testify/assert" 23 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 24 | ) 25 | 26 | func TestURLPath(t *testing.T) { 27 | obj := &struct { 28 | metav1.ObjectMeta 29 | }{ 30 | ObjectMeta: metav1.ObjectMeta{ 31 | Namespace: "testns", 32 | Name: "testname", 33 | }, 34 | } 35 | 36 | assert.Equal(t, URLPath(obj), "/testns/testname") 37 | } 38 | -------------------------------------------------------------------------------- /pkg/reconciler/common/env.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package common 18 | 19 | // Common environment variables propagated to adapters. 20 | const ( 21 | EnvName = "NAME" 22 | EnvNamespace = "NAMESPACE" 23 | 24 | envSink = "K_SINK" 25 | envComponent = "K_COMPONENT" 26 | envMetricsPrometheusPort = "METRICS_PROMETHEUS_PORT" 27 | 28 | EnvARN = "ARN" 29 | EnvAccessKeyID = "AWS_ACCESS_KEY_ID" 30 | EnvSecretAccessKey = "AWS_SECRET_ACCESS_KEY" //nolint:gosec 31 | ) 32 | -------------------------------------------------------------------------------- /pkg/adapter/awssnssource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awssnssource 18 | 19 | import ( 20 | "testing" 21 | 22 | adaptesting "github.com/triggermesh/aws-event-sources/pkg/adapter/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awssnssource/fake" 26 | ) 27 | 28 | func TestNewController(t *testing.T) { 29 | adaptesting.TestControllerConstructor(t, NewController("controller-test"), &adapter{}) 30 | } 31 | -------------------------------------------------------------------------------- /kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | resources: 16 | - config/200-clusterroles.yaml 17 | - config/201-serviceaccounts.yaml 18 | - config/202-clusterrolebindings.yaml 19 | - config/300-awscloudwatch.yaml 20 | - config/300-awscloudwatchlogs.yaml 21 | - config/300-awscodecommit.yaml 22 | - config/300-awscognitoidentity.yaml 23 | - config/300-awscognitouserpool.yaml 24 | - config/300-awsdynamodb.yaml 25 | - config/300-awskinesis.yaml 26 | - config/300-awsperformanceinsights.yaml 27 | - config/300-awss3.yaml 28 | - config/300-awssns.yaml 29 | - config/300-awssqs.yaml 30 | - config/500-controller.yaml 31 | 32 | -------------------------------------------------------------------------------- /pkg/reconciler/common/status.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package common 18 | 19 | import duckv1 "knative.dev/pkg/apis/duck/v1" 20 | 21 | // CreateCloudEventAttributes returns CloudEvent attributes for the event types 22 | // supported by the source. 23 | func CreateCloudEventAttributes(source string, eventTypes []string) []duckv1.CloudEventAttributes { 24 | ceAttributes := make([]duckv1.CloudEventAttributes, len(eventTypes)) 25 | 26 | for i, typ := range eventTypes { 27 | ceAttributes[i] = duckv1.CloudEventAttributes{ 28 | Type: typ, 29 | Source: source, 30 | } 31 | } 32 | 33 | return ceAttributes 34 | } 35 | -------------------------------------------------------------------------------- /pkg/adapter/common/controller/controller.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package controller contains helpers shared between controllers embedded in 18 | // source adapters. 19 | package controller 20 | 21 | import "knative.dev/pkg/controller" 22 | 23 | // Opts returns a callback function that sets the controller's agent name and 24 | // configures the reconciler to skip status updates. 25 | func Opts(component string) controller.OptionsFn { 26 | return func(impl *controller.Impl) controller.Options { 27 | return controller.Options{ 28 | AgentName: component, 29 | SkipStatusUpdates: true, 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /pkg/reconciler/awssnssource/events.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awssnssource 18 | 19 | const ( 20 | // ReasonSubscribed indicates the successful creation of a SNS subscription. 21 | ReasonSubscribed = "Subscribed" 22 | // ReasonUnsubscribed indicates the successful deletion of a SNS subscription. 23 | ReasonUnsubscribed = "Unsubscribed" 24 | // ReasonFailedSubscribe indicates a failure during the subscription to a SNS topic. 25 | ReasonFailedSubscribe = "FailedSubscribe" 26 | // ReasonFailedUnsubscribe indicates a failure during the deletion of a SNS subscription. 27 | ReasonFailedUnsubscribe = "FailedUnsubscribe" 28 | ) 29 | -------------------------------------------------------------------------------- /pkg/reconciler/common/skip/skip.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh, Inc 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package skip allows a Context to carry the intention to skip parts of the 18 | // code execution. Mainly used to avoid variances while testing certain 19 | // functions. 20 | package skip 21 | 22 | import "context" 23 | 24 | type skipKey struct{} 25 | 26 | // EnableSkip returns a copy of a parent context with skipping enabled. 27 | func EnableSkip(ctx context.Context) context.Context { 28 | return context.WithValue(ctx, skipKey{}, struct{}{}) 29 | } 30 | 31 | // Skip returns whether the given context has skipping enabled. 32 | func Skip(ctx context.Context) bool { 33 | return ctx.Value(skipKey{}) != nil 34 | } 35 | -------------------------------------------------------------------------------- /pkg/adapter/awscognitoidentitysource/events.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019-2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscognitoidentitysource 18 | 19 | import ( 20 | "time" 21 | 22 | "github.com/aws/aws-sdk-go/service/cognitosync" 23 | ) 24 | 25 | // CognitoIdentitySyncEvent represents the payload of a Cognito sync event. 26 | type CognitoIdentitySyncEvent struct { 27 | CreationDate *time.Time 28 | DataStorage *int64 29 | DatasetName *string 30 | IdentityID *string 31 | LastModifiedBy *string 32 | LastModifiedDate *time.Time 33 | NumRecords *int64 34 | EventType *string 35 | Region *string 36 | IdentityPoolID *string 37 | DatasetRecords []*cognitosync.Record 38 | } 39 | -------------------------------------------------------------------------------- /pkg/aws/s3/s3.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package sqs contains helpers for AWS S3. 18 | package s3 19 | 20 | import "github.com/triggermesh/aws-event-sources/pkg/apis" 21 | 22 | // RealBucketARN returns a string representation of the given S3 bucket ARN 23 | // which matches the official format defined by AWS. 24 | // https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazons3.html#amazons3-resources-for-iam-policies 25 | // 26 | // This is necessary because our AWSS3Source API enforces that bucket ARNs 27 | // include a region and an account ID, which are both absent from the public 28 | // ARN. 29 | func RealBucketARN(arn apis.ARN) string { 30 | arnCpy := arn 31 | arnCpy.Region = "" 32 | arnCpy.AccountID = "" 33 | 34 | return arnCpy.String() 35 | } 36 | -------------------------------------------------------------------------------- /pkg/reconciler/common/resource/knservice.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package resource 18 | 19 | import ( 20 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 | servingv1 "knative.dev/serving/pkg/apis/serving/v1" 22 | ) 23 | 24 | // NewKnService creates a Knative Service object. 25 | func NewKnService(ns, name string, opts ...ObjectOption) *servingv1.Service { 26 | d := &servingv1.Service{ 27 | ObjectMeta: metav1.ObjectMeta{ 28 | Namespace: ns, 29 | Name: name, 30 | }, 31 | } 32 | 33 | for _, opt := range opts { 34 | opt(d) 35 | } 36 | 37 | // ensure the container name is not empty 38 | containers := d.Spec.Template.Spec.Containers 39 | if len(containers) == 1 && containers[0].Name == "" { 40 | containers[0].Name = defaultContainerName 41 | } 42 | 43 | return d 44 | } 45 | -------------------------------------------------------------------------------- /pkg/adapter/awssnssource/status/clock.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package status 18 | 19 | import ( 20 | "context" 21 | 22 | "knative.dev/pkg/apis" 23 | ) 24 | 25 | type clockKey struct{} 26 | 27 | // Clock can override the timestamp returned by time.Now(). 28 | type Clock interface { 29 | Now() apis.VolatileTime 30 | } 31 | 32 | // WithClock returns a copy of the parent context in which the value 33 | // associated with the clock key is the given Clock. 34 | func WithClock(ctx context.Context, c Clock) context.Context { 35 | return context.WithValue(ctx, clockKey{}, c) 36 | } 37 | 38 | // ClockFromContext returns the Clock stored in the context. 39 | func ClockFromContext(ctx context.Context) Clock { 40 | if c, ok := ctx.Value(clockKey{}).(Clock); ok { 41 | return c 42 | } 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | type AWSCloudWatchLogsSourceExpansion interface{} 22 | 23 | type AWSCloudWatchSourceExpansion interface{} 24 | 25 | type AWSCodeCommitSourceExpansion interface{} 26 | 27 | type AWSCognitoIdentitySourceExpansion interface{} 28 | 29 | type AWSCognitoUserPoolSourceExpansion interface{} 30 | 31 | type AWSDynamoDBSourceExpansion interface{} 32 | 33 | type AWSKinesisSourceExpansion interface{} 34 | 35 | type AWSPerformanceInsightsSourceExpansion interface{} 36 | 37 | type AWSS3SourceExpansion interface{} 38 | 39 | type AWSSNSSourceExpansion interface{} 40 | 41 | type AWSSQSSourceExpansion interface{} 42 | -------------------------------------------------------------------------------- /config/samples/awssqssource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSSQSSource object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awssqssources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSSQSSource 24 | metadata: 25 | name: sample 26 | spec: 27 | arn: arn:aws:sqs:us-west-2:123456789012:triggermeshtest 28 | 29 | credentials: 30 | accessKeyID: 31 | valueFromSecret: 32 | name: awscreds 33 | key: aws_access_key_id 34 | secretAccessKey: 35 | valueFromSecret: 36 | name: awscreds 37 | key: aws_secret_access_key 38 | 39 | sink: 40 | ref: 41 | apiVersion: eventing.knative.dev/v1 42 | kind: Broker 43 | name: default 44 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awss3source/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awss3source "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awss3source" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awss3source.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSS3Sources() 39 | return context.WithValue(ctx, awss3source.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awssnssource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awssnssource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awssnssource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awssnssource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSSNSSources() 39 | return context.WithValue(ctx, awssnssource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awssqssource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awssqssource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awssqssource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awssqssource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSSQSSources() 39 | return context.WithValue(ctx, awssqssource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /config/samples/awskinesissource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSKinesisSource object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awskinesissources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSKinesisSource 24 | metadata: 25 | name: sample 26 | spec: 27 | arn: arn:aws:kinesis:us-west-2:123456789012:stream/triggermeshtest 28 | 29 | credentials: 30 | accessKeyID: 31 | valueFromSecret: 32 | name: awscreds 33 | key: aws_access_key_id 34 | secretAccessKey: 35 | valueFromSecret: 36 | name: awscreds 37 | key: aws_secret_access_key 38 | 39 | sink: 40 | ref: 41 | apiVersion: eventing.knative.dev/v1 42 | kind: Broker 43 | name: default 44 | -------------------------------------------------------------------------------- /config/samples/awsdynamodbsource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSDynamoDBSource object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awsdynamodbsources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSDynamoDBSource 24 | metadata: 25 | name: sample 26 | spec: 27 | arn: arn:aws:dynamodb:us-west-2:123456789012:table/triggermeshtest 28 | 29 | credentials: 30 | accessKeyID: 31 | valueFromSecret: 32 | name: awscreds 33 | key: aws_access_key_id 34 | secretAccessKey: 35 | valueFromSecret: 36 | name: awscreds 37 | key: aws_secret_access_key 38 | 39 | sink: 40 | ref: 41 | apiVersion: eventing.knative.dev/v1 42 | kind: Broker 43 | name: default 44 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awskinesissource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awskinesissource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awskinesissource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awskinesissource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSKinesisSources() 39 | return context.WithValue(ctx, awskinesissource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awsdynamodbsource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awsdynamodbsource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awsdynamodbsource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awsdynamodbsource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSDynamoDBSources() 39 | return context.WithValue(ctx, awsdynamodbsource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchsource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awscloudwatchsource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchsource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awscloudwatchsource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSCloudWatchSources() 39 | return context.WithValue(ctx, awscloudwatchsource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscodecommitsource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awscodecommitsource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscodecommitsource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awscodecommitsource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSCodeCommitSources() 39 | return context.WithValue(ctx, awscodecommitsource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /config/samples/awscognitouserpoolsource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSCognitoUserPoolSource object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awscognitouserpoolsources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSCognitoUserPoolSource 24 | metadata: 25 | name: sample 26 | spec: 27 | arn: arn:aws:cognito-idp:us-west-2:123456789012:userpool/us-west-2_abcdefghi 28 | 29 | credentials: 30 | accessKeyID: 31 | valueFromSecret: 32 | name: awscreds 33 | key: aws_access_key_id 34 | secretAccessKey: 35 | valueFromSecret: 36 | name: awscreds 37 | key: aws_secret_access_key 38 | 39 | sink: 40 | ref: 41 | apiVersion: eventing.knative.dev/v1 42 | kind: Broker 43 | name: default 44 | -------------------------------------------------------------------------------- /config/samples/awss3source.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSS3Source object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awss3sources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSS3Source 24 | metadata: 25 | name: sample 26 | spec: 27 | arn: arn:aws:s3:us-west-2:123456789012:triggermeshtest 28 | 29 | eventTypes: 30 | - s3:ObjectCreated:* 31 | - s3:ObjectRemoved:* 32 | 33 | credentials: 34 | accessKeyID: 35 | valueFromSecret: 36 | name: awscreds 37 | key: aws_access_key_id 38 | secretAccessKey: 39 | valueFromSecret: 40 | name: awscreds 41 | key: aws_secret_access_key 42 | 43 | sink: 44 | ref: 45 | apiVersion: eventing.knative.dev/v1 46 | kind: Broker 47 | name: default 48 | -------------------------------------------------------------------------------- /config/samples/awscognitoidentitysource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSCognitoIdentitySource object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awscognitoidentitysources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSCognitoIdentitySource 24 | metadata: 25 | name: sample 26 | spec: 27 | arn: arn:aws:cognito-identity:us-west-2:123456789012:identitypool/triggermeshtest 28 | 29 | credentials: 30 | accessKeyID: 31 | valueFromSecret: 32 | name: awscreds 33 | key: aws_access_key_id 34 | secretAccessKey: 35 | valueFromSecret: 36 | name: awscreds 37 | key: aws_secret_access_key 38 | 39 | sink: 40 | ref: 41 | apiVersion: eventing.knative.dev/v1 42 | kind: Broker 43 | name: default 44 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchlogssource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awscloudwatchlogssource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchlogssource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awscloudwatchlogssource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSCloudWatchLogsSources() 39 | return context.WithValue(ctx, awscloudwatchlogssource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /pkg/adapter/testing/controller.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package testing 18 | 19 | import ( 20 | "testing" 21 | 22 | "knative.dev/eventing/pkg/adapter/v2" 23 | rt "knative.dev/pkg/reconciler/testing" 24 | 25 | "github.com/triggermesh/aws-event-sources/pkg/testing/structs" 26 | ) 27 | 28 | // TestControllerConstructor tests that a controller constructor meets our requirements. 29 | func TestControllerConstructor(t *testing.T, ctor adapter.ControllerConstructor, a adapter.Adapter) { 30 | t.Helper() 31 | 32 | defer func() { 33 | if r := recover(); r != nil { 34 | t.Errorf("Unexpected panic: %v", r) 35 | } 36 | }() 37 | 38 | ctx, informers := rt.SetupFakeContext(t) 39 | 40 | // expected informers: Source 41 | if expect, got := 1, len(informers); got != expect { 42 | t.Errorf("Expected %d injected informers, got %d", expect, got) 43 | } 44 | 45 | ctrler := ctor(ctx, a) 46 | 47 | // catch unitialized fields in Reconciler struct 48 | structs.EnsureNoNilField(t, ctrler) 49 | } 50 | -------------------------------------------------------------------------------- /pkg/reconciler/common/event/event.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package event contains functions for generating Kubernetes API events. 18 | package event 19 | 20 | import ( 21 | "context" 22 | 23 | corev1 "k8s.io/api/core/v1" 24 | "knative.dev/pkg/controller" 25 | 26 | "github.com/triggermesh/aws-event-sources/pkg/apis/sources/v1alpha1" 27 | ) 28 | 29 | // Normal records a normal event for an API object. 30 | func Normal(ctx context.Context, reason, msgFmt string, args ...interface{}) { 31 | recordEvent(ctx, corev1.EventTypeNormal, reason, msgFmt, args...) 32 | } 33 | 34 | // Warn records a warning event for an API object. 35 | func Warn(ctx context.Context, reason, msgFmt string, args ...interface{}) { 36 | recordEvent(ctx, corev1.EventTypeWarning, reason, msgFmt, args...) 37 | } 38 | 39 | func recordEvent(ctx context.Context, typ, reason, msgFmt string, args ...interface{}) { 40 | controller.GetEventRecorder(ctx).Eventf(v1alpha1.SourceFromContext(ctx), typ, reason, msgFmt, args...) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscognitoidentitysource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awscognitoidentitysource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscognitoidentitysource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awscognitoidentitysource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSCognitoIdentitySources() 39 | return context.WithValue(ctx, awscognitoidentitysource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscognitouserpoolsource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awscognitouserpoolsource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscognitouserpoolsource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awscognitouserpoolsource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSCognitoUserPoolSources() 39 | return context.WithValue(ctx, awscognitouserpoolsource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /config/samples/awscloudwatchlogssource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSCloudWatchLogsSource object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awscloudwatchlogssources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSCloudWatchLogsSource 24 | metadata: 25 | name: sample 26 | spec: 27 | arn: 'arn:aws:logs:us-west-2:123456789012:log-group:/aws/lambda/lambdadumper:*' 28 | pollingInterval: 5m 29 | 30 | credentials: 31 | accessKeyID: 32 | valueFromSecret: 33 | name: awscreds 34 | key: aws_access_key_id 35 | secretAccessKey: 36 | valueFromSecret: 37 | name: awscreds 38 | key: aws_secret_access_key 39 | 40 | sink: 41 | ref: 42 | apiVersion: eventing.knative.dev/v1 43 | kind: Broker 44 | name: default 45 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awsperformanceinsightssource/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/fake" 25 | awsperformanceinsightssource "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awsperformanceinsightssource" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | ) 29 | 30 | var Get = awsperformanceinsightssource.Get 31 | 32 | func init() { 33 | injection.Fake.RegisterInformer(withInformer) 34 | } 35 | 36 | func withInformer(ctx context.Context) (context.Context, controller.Informer) { 37 | f := fake.Get(ctx) 38 | inf := f.Sources().V1alpha1().AWSPerformanceInsightsSources() 39 | return context.WithValue(ctx, awsperformanceinsightssource.Key{}, inf), inf.Informer() 40 | } 41 | -------------------------------------------------------------------------------- /pkg/reconciler/testing/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package testing 18 | 19 | import ( 20 | "os" 21 | "testing" 22 | 23 | corev1 "k8s.io/api/core/v1" 24 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | ) 26 | 27 | // SetEnvVar sets the value of an env var and returns a function that can be 28 | // deferred to unset that variable. 29 | func SetEnvVar(t *testing.T, name, val string) (unset func()) { 30 | t.Helper() 31 | 32 | if err := os.Setenv(name, val); err != nil { 33 | t.Errorf("Failed to set env var %s: %v", name, err) 34 | } 35 | 36 | return func() { 37 | if err := os.Unsetenv(name); err != nil { 38 | t.Logf("Failed to unset env var %q: %s", name, err) 39 | } 40 | } 41 | } 42 | 43 | // NewConfigMap returns a ConfigMap object. 44 | func NewConfigMap(name string, data map[string]string) *corev1.ConfigMap { 45 | cmap := &corev1.ConfigMap{ 46 | ObjectMeta: metav1.ObjectMeta{ 47 | Name: name, 48 | }, 49 | } 50 | if data != nil { 51 | cmap.Data = data 52 | } 53 | return cmap 54 | } 55 | -------------------------------------------------------------------------------- /config/samples/awscodecommitsource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSCodeCommitSource object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awscodecommitsources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSCodeCommitSource 24 | metadata: 25 | name: sample 26 | spec: 27 | arn: arn:aws:codecommit:us-west-2:123456789012:triggermeshtest 28 | branch: master 29 | 30 | eventTypes: 31 | - push 32 | - pull_request 33 | 34 | credentials: 35 | accessKeyID: 36 | valueFromSecret: 37 | name: awscreds 38 | key: aws_access_key_id 39 | secretAccessKey: 40 | valueFromSecret: 41 | name: awscreds 42 | key: aws_secret_access_key 43 | 44 | sink: 45 | ref: 46 | apiVersion: eventing.knative.dev/v1 47 | kind: Broker 48 | name: default 49 | -------------------------------------------------------------------------------- /pkg/reconciler/common/labels.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package common 18 | 19 | // Kubernetes recommended labels 20 | // https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/ 21 | const ( 22 | // appNameLabel is the name of the application. 23 | appNameLabel = "app.kubernetes.io/name" 24 | // appInstanceLabel is a unique name identifying the instance of an application. 25 | appInstanceLabel = "app.kubernetes.io/instance" 26 | // appComponentLabel is the component within the architecture. 27 | appComponentLabel = "app.kubernetes.io/component" 28 | // appPartOfLabel is the name of a higher level application this one is part of. 29 | appPartOfLabel = "app.kubernetes.io/part-of" 30 | // appManagedByLabel is the tool being used to manage the operation of an application. 31 | appManagedByLabel = "app.kubernetes.io/managed-by" 32 | ) 33 | 34 | // Common label values 35 | const ( 36 | partOf = "aws-event-sources" 37 | managedBy = "aws-event-sources-controller" 38 | componentAdapter = "adapter" 39 | ) 40 | -------------------------------------------------------------------------------- /schemas/com.amazon.codecommit.push.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Commit", 4 | "definitions": { 5 | "Commit": { 6 | "required": [ 7 | "AdditionalData", 8 | "Author", 9 | "CommitId", 10 | "Committer", 11 | "Message", 12 | "Parents", 13 | "TreeId" 14 | ], 15 | "properties": { 16 | "AdditionalData": { 17 | "type": "string" 18 | }, 19 | "Author": { 20 | "$schema": "http://json-schema.org/draft-04/schema#", 21 | "$ref": "#/definitions/UserInfo" 22 | }, 23 | "CommitId": { 24 | "type": "string" 25 | }, 26 | "Committer": { 27 | "$ref": "#/definitions/UserInfo" 28 | }, 29 | "Message": { 30 | "type": "string" 31 | }, 32 | "Parents": { 33 | "items": { 34 | "type": "string" 35 | }, 36 | "type": "array" 37 | }, 38 | "TreeId": { 39 | "type": "string" 40 | } 41 | }, 42 | "additionalProperties": false, 43 | "type": "object" 44 | }, 45 | "UserInfo": { 46 | "required": [ 47 | "Date", 48 | "Email", 49 | "Name" 50 | ], 51 | "properties": { 52 | "Date": { 53 | "type": "string" 54 | }, 55 | "Email": { 56 | "type": "string" 57 | }, 58 | "Name": { 59 | "type": "string" 60 | } 61 | }, 62 | "additionalProperties": false, 63 | "type": "object" 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /pkg/reconciler/awss3source/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awss3source 18 | 19 | import ( 20 | "testing" 21 | 22 | rt "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awss3source/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | rt.TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | rt.TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/reconciler/common/resource/object.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package resource 18 | 19 | import ( 20 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 | "k8s.io/apimachinery/pkg/labels" 22 | 23 | "knative.dev/pkg/kmeta" 24 | ) 25 | 26 | // ObjectOption is a functional option for building Kubernetes API objects. 27 | type ObjectOption func(interface{}) 28 | 29 | // Controller sets the given object as the controller (owner) of an API object. 30 | func Controller(obj kmeta.OwnerRefable) ObjectOption { 31 | return func(object interface{}) { 32 | meta := object.(metav1.Object) 33 | 34 | meta.SetOwnerReferences([]metav1.OwnerReference{ 35 | *kmeta.NewControllerRef(obj), 36 | }) 37 | } 38 | } 39 | 40 | // Label sets the value of an API object's label. 41 | func Label(key, val string) ObjectOption { 42 | return func(object interface{}) { 43 | meta := object.(metav1.Object) 44 | 45 | lbls := meta.GetLabels() 46 | 47 | if lbls == nil { 48 | lbls = make(labels.Set, 1) 49 | meta.SetLabels(lbls) 50 | } 51 | lbls[key] = val 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /pkg/reconciler/awssqssource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awssqssource 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awssqssource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /schemas/com.amazon.cloudwatch.metrics.metric.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/MetricDataResult", 4 | "definitions": { 5 | "MessageData": { 6 | "required": [ 7 | "Code", 8 | "Value" 9 | ], 10 | "properties": { 11 | "Code": { 12 | "type": "string" 13 | }, 14 | "Value": { 15 | "type": "string" 16 | } 17 | }, 18 | "additionalProperties": false, 19 | "type": "object" 20 | }, 21 | "MetricDataResult": { 22 | "required": [ 23 | "Id", 24 | "Label", 25 | "Messages", 26 | "StatusCode", 27 | "Timestamps", 28 | "Values" 29 | ], 30 | "properties": { 31 | "Id": { 32 | "type": "string" 33 | }, 34 | "Label": { 35 | "type": "string" 36 | }, 37 | "Messages": { 38 | "items": { 39 | "$schema": "http://json-schema.org/draft-04/schema#", 40 | "$ref": "#/definitions/MessageData" 41 | }, 42 | "type": "array" 43 | }, 44 | "StatusCode": { 45 | "type": "string" 46 | }, 47 | "Timestamps": { 48 | "items": { 49 | "type": "string", 50 | "format": "date-time" 51 | }, 52 | "type": "array" 53 | }, 54 | "Values": { 55 | "items": { 56 | "type": "number" 57 | }, 58 | "type": "array" 59 | } 60 | }, 61 | "additionalProperties": false, 62 | "type": "object" 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /pkg/reconciler/awskinesissource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awskinesissource 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awskinesissource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/reconciler/awssnssource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awssnssource 18 | 19 | import ( 20 | "testing" 21 | 22 | rt "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awssnssource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 29 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 30 | _ "knative.dev/serving/pkg/client/injection/informers/serving/v1/service/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | rt.TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | rt.TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/reconciler/awsdynamodbsource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awsdynamodbsource 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awsdynamodbsource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/reconciler/awscloudwatchsource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscloudwatchsource 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchsource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/reconciler/awscodecommitsource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscodecommitsource 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscodecommitsource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/reconciler/awscloudwatchlogssource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscloudwatchlogssource 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchlogssource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/reconciler/awscognitoidentitysource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscognitoidentitysource 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscognitoidentitysource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/reconciler/awscognitouserpoolsource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscognitouserpoolsource 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscognitouserpoolsource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /cmd/awssnssource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awssnssource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awssnssource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS SNS Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh SNS Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS SNS" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awssnssource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awssnssource"] 53 | -------------------------------------------------------------------------------- /cmd/awssqssource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awssqssource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awssqssource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS SQS Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh SQS Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS SQS" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awssqssource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awssqssource"] 53 | -------------------------------------------------------------------------------- /pkg/reconciler/awsperformanceinsightssource/controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awsperformanceinsightssource 18 | 19 | import ( 20 | "testing" 21 | 22 | . "github.com/triggermesh/aws-event-sources/pkg/reconciler/testing" 23 | 24 | // Link fake informers accessed by our controller 25 | _ "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awsperformanceinsightssource/fake" 26 | _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake" 27 | _ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake" 28 | _ "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/fake" 29 | _ "knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding/fake" 30 | _ "knative.dev/pkg/injection/clients/dynamicclient/fake" 31 | ) 32 | 33 | func TestNewController(t *testing.T) { 34 | t.Run("No failure", func(t *testing.T) { 35 | TestControllerConstructor(t, NewController) 36 | }) 37 | 38 | t.Run("Failure cases", func(t *testing.T) { 39 | TestControllerConstructorFailures(t, NewController) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/reconciler/awss3source/events.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awss3source 18 | 19 | const ( 20 | // ReasonQueueCreated indicates that a SQS queue was created for receiving S3 event notifications. 21 | ReasonQueueCreated = "QueueCreated" 22 | // ReasonQueueDeleted indicates that a SQS queue used for receiving S3 events was deleted. 23 | ReasonQueueDeleted = "QueueDeleted" 24 | // ReasonFailedQueue indicates a failure while synchronizing the SQS queue for receiving S3 event notifications. 25 | ReasonFailedQueue = "FailedQueue" 26 | 27 | // ReasonSubscribed indicates that event notifications were enabled for a S3 bucket. 28 | ReasonSubscribed = "Subscribed" 29 | // ReasonUnsubscribed indicates that event notifications were disabled for a S3 bucket. 30 | ReasonUnsubscribed = "Unsubscribed" 31 | // ReasonFailedSubscribe indicates a failure while enabling event notifications for a S3 bucket. 32 | ReasonFailedSubscribe = "FailedSubscribe" 33 | // ReasonFailedSubscribe indicates a failure while disabling event notifications for a S3 bucket. 34 | ReasonFailedUnsubscribe = "FailedUnsubscribe" 35 | ) 36 | -------------------------------------------------------------------------------- /pkg/testing/structs/structs.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package structs provides helpers to test Go structs. 18 | package structs 19 | 20 | import ( 21 | "reflect" 22 | "testing" 23 | 24 | "knative.dev/pkg/controller" 25 | ) 26 | 27 | // EnsureNoNilField fails the test if the provided Impl's reconciler contains 28 | // nil pointers or interfaces. 29 | func EnsureNoNilField(t *testing.T, impl *controller.Impl) { 30 | t.Helper() 31 | 32 | recVal := reflect.ValueOf(impl.Reconciler). 33 | Elem(). // injection/reconciler/sources/v1alpha1/.reconcilerImpl 34 | FieldByName("reconciler"). // injection/reconciler/sources/v1alpha1/.Interface 35 | Elem(). // *pkg/reconciler/.Reconciler (ptr) 36 | Elem() // pkg/reconciler/.Reconciler (val) 37 | 38 | for i := 0; i < recVal.NumField(); i++ { 39 | f := recVal.Field(i) 40 | switch f.Kind() { 41 | case reflect.Interface, reflect.Ptr, reflect.Func: 42 | if f.IsNil() { 43 | t.Errorf("struct field %q is nil", recVal.Type().Field(i).Name) 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /cmd/awssqssource/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "runtime" 21 | 22 | "knative.dev/eventing/pkg/adapter/v2" 23 | 24 | "github.com/triggermesh/aws-event-sources/pkg/adapter/awssqssource" 25 | ) 26 | 27 | func main() { 28 | setMaxProcs(runtime.NumCPU()) 29 | 30 | adapter.Main("awssqssource", awssqssource.NewEnvConfig, awssqssource.NewAdapter) 31 | } 32 | 33 | // setMaxProcs sets the number of threads that can be used by the current 34 | // process. 35 | // 36 | // Knative uses uber-go/automaxprocs to automatically determine the number of 37 | // threads (GOMAXPROCS) available to the process based on CPU quotas (e.g. 38 | // 'cpu.request <= 1' translates to 1 thread, regardless of the number of 39 | // physical cores). 40 | // This event source has a very predictable CPU profile: it spends most of its 41 | // time sending network requests without performing any computation on the 42 | // results, so we assume the defined CPU limit allows all CPU cores to be used 43 | // without starving on CPU time. 44 | func setMaxProcs(procs int) int { 45 | return runtime.GOMAXPROCS(procs) 46 | } 47 | -------------------------------------------------------------------------------- /pkg/adapter/awssnssource/adapter_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awssnssource 18 | 19 | import ( 20 | "context" 21 | "testing" 22 | "time" 23 | 24 | "github.com/stretchr/testify/assert" 25 | ) 26 | 27 | // TestStart verifies that a started adapter responds to cancelation. 28 | func TestStart(t *testing.T) { 29 | const testTimeout = time.Second * 2 30 | testCtx, testCancel := context.WithTimeout(context.Background(), testTimeout) 31 | defer testCancel() 32 | 33 | a := &adapter{} 34 | 35 | // errCh receives the error value returned by the receiver after 36 | // termination. We leave it open to avoid panicking in case the 37 | // receiver returns after the timeout. 38 | errCh := make(chan error) 39 | 40 | // ctx gets canceled to cause a voluntary interruption of the receiver 41 | ctx, cancel := context.WithCancel(testCtx) 42 | go func() { 43 | errCh <- a.Start(ctx) 44 | }() 45 | cancel() 46 | 47 | select { 48 | case <-testCtx.Done(): 49 | t.Errorf("Test timed out after %v", testTimeout) 50 | case err := <-errCh: 51 | assert.NoError(t, err, "Adapter returned an error") 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /pkg/client/generated/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package internalinterfaces 20 | 21 | import ( 22 | time "time" 23 | 24 | internalclientset "github.com/triggermesh/aws-event-sources/pkg/client/generated/clientset/internalclientset" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | cache "k8s.io/client-go/tools/cache" 28 | ) 29 | 30 | // NewInformerFunc takes internalclientset.Interface and time.Duration to return a SharedIndexInformer. 31 | type NewInformerFunc func(internalclientset.Interface, time.Duration) cache.SharedIndexInformer 32 | 33 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 34 | type SharedInformerFactory interface { 35 | Start(stopCh <-chan struct{}) 36 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 37 | } 38 | 39 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 40 | type TweakListOptionsFunc func(*v1.ListOptions) 41 | -------------------------------------------------------------------------------- /cmd/awskinesissource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awskinesissource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awskinesissource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS Kinesis Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh Kinesis Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS Kinesis" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awskinesissource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awskinesissource"] 53 | -------------------------------------------------------------------------------- /pkg/adapter/common/router/router.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package router 18 | 19 | import ( 20 | "net/http" 21 | "sync" 22 | ) 23 | 24 | // Router routes incoming HTTP requests to the adequate handler based on their 25 | // URL path. 26 | type Router struct { 27 | // map of URL path to HTTP handler 28 | handlers sync.Map 29 | } 30 | 31 | // Check that Router implements http.Handler. 32 | var _ http.Handler = (*Router)(nil) 33 | 34 | // RegisterPath registers a HTTP handler for serving requests at the given URL path. 35 | func (r *Router) RegisterPath(urlPath string, h http.Handler) { 36 | r.handlers.Store(urlPath, h) 37 | } 38 | 39 | // DeregisterPath de-registers the HTTP handler for the given URL path. 40 | func (r *Router) DeregisterPath(urlPath string) { 41 | r.handlers.Delete(urlPath) 42 | } 43 | 44 | // ServeHTTP implements http.Handler. 45 | func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { 46 | h, ok := r.handlers.Load(req.URL.Path) 47 | if !ok { 48 | http.Error(w, "No handler for path "+req.URL.Path, http.StatusNotFound) 49 | return 50 | } 51 | 52 | h.(http.Handler).ServeHTTP(w, req) 53 | } 54 | -------------------------------------------------------------------------------- /cmd/awsdynamodbsource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awsdynamodbsource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awsdynamodbsource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS CodeCommit Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh CodeCommit Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS CodeCommit" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awsdynamodbsource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awsdynamodbsource"] 53 | -------------------------------------------------------------------------------- /cmd/awscodecommitsource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awscodecommitsource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awscodecommitsource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS CodeCommit Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh CodeCommit Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS CodeCommit" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awscodecommitsource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awscodecommitsource"] 53 | -------------------------------------------------------------------------------- /cmd/awscloudwatchsource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awscloudwatchsource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awscloudwatchsource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS CloudWatch Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh CloudWatch Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS CloudWatch Metrics" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awscloudwatchsource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awscloudwatchsource"] 53 | -------------------------------------------------------------------------------- /pkg/apis/arn.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package apis 18 | 19 | import ( 20 | "encoding/json" 21 | "fmt" 22 | 23 | "github.com/aws/aws-sdk-go/aws/arn" 24 | ) 25 | 26 | // ARN extends arn.ARN with additional methods for (de-)serialization to/from 27 | // JSON, allowing it to be embedded in custom API objects. 28 | type ARN arn.ARN 29 | 30 | var ( 31 | _ fmt.Stringer = (*ARN)(nil) 32 | _ json.Marshaler = (*ARN)(nil) 33 | _ json.Unmarshaler = (*ARN)(nil) 34 | ) 35 | 36 | // String implements the fmt.Stringer interface. 37 | func (a ARN) String() string { 38 | return arn.ARN(a).String() 39 | } 40 | 41 | // UnmarshalJSON implements json.Unmarshaler. 42 | func (a *ARN) UnmarshalJSON(data []byte) error { 43 | var dataStr string 44 | if err := json.Unmarshal(data, &dataStr); err != nil { 45 | return err 46 | } 47 | 48 | arn, err := arn.Parse(dataStr) 49 | if err != nil { 50 | return fmt.Errorf("failed to parse ARN %q: %w", dataStr, err) 51 | } 52 | 53 | *a = ARN(arn) 54 | 55 | return nil 56 | } 57 | 58 | // MarshalJSON implements json.Marshaler. 59 | func (a ARN) MarshalJSON() ([]byte, error) { 60 | return []byte(`"` + a.String() + `"`), nil 61 | } 62 | -------------------------------------------------------------------------------- /cmd/awscloudwatchlogssource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awscloudwatchlogssource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awscloudwatchlogssource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS CloudWatch Log Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh CloudWatch Log Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS CloudWatch Logs" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awscloudwatchlogssource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awscloudwatchlogssource"] 53 | -------------------------------------------------------------------------------- /pkg/apis/sources/v1alpha1/common_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | corev1 "k8s.io/api/core/v1" 21 | duckv1 "knative.dev/pkg/apis/duck/v1" 22 | ) 23 | 24 | // EventSourceStatus defines the observed state of an event source. 25 | type EventSourceStatus struct { 26 | duckv1.SourceStatus `json:",inline"` 27 | duckv1.AddressStatus `json:",inline"` 28 | } 29 | 30 | // AWSSecurityCredentials represents a set of AWS security credentials. 31 | // See https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html 32 | type AWSSecurityCredentials struct { 33 | AccessKeyID ValueFromField `json:"accessKeyID"` 34 | SecretAccessKey ValueFromField `json:"secretAccessKey"` 35 | } 36 | 37 | // ValueFromField is a struct field that can have its value either defined 38 | // explicitly or sourced from another entity. 39 | type ValueFromField struct { 40 | // Optional: no more than one of the following may be specified. 41 | 42 | // Field value. 43 | // +optional 44 | Value string `json:"value,omitempty"` 45 | // Field value from a Kubernetes Secret. 46 | // +optional 47 | ValueFromSecret *corev1.SecretKeySelector `json:"valueFromSecret,omitempty"` 48 | } 49 | -------------------------------------------------------------------------------- /cmd/awscognitouserpoolsource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awscognitouserpoolsource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awscognitouserpoolsource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS Cognito User Pool Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh Cognito User Pool Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS Cognito User Pool" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awscognitouserpoolsource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awscognitouserpoolsource"] 53 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/factory/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | externalversions "github.com/triggermesh/aws-event-sources/pkg/client/generated/informers/externalversions" 25 | fake "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/client/fake" 26 | factory "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory" 27 | controller "knative.dev/pkg/controller" 28 | injection "knative.dev/pkg/injection" 29 | ) 30 | 31 | var Get = factory.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterInformerFactory(withInformerFactory) 35 | } 36 | 37 | func withInformerFactory(ctx context.Context) context.Context { 38 | c := fake.Get(ctx) 39 | opts := make([]externalversions.SharedInformerOption, 0, 1) 40 | if injection.HasNamespaceScope(ctx) { 41 | opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx))) 42 | } 43 | return context.WithValue(ctx, factory.Key{}, 44 | externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), opts...)) 45 | } 46 | -------------------------------------------------------------------------------- /cmd/awscognitoidentitysource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awscognitoidentitysource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awscognitoidentitysource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS Cognito Identity Pool Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh Cognito Identity Pool Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS Cognito Identity Pool" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awscognitoidentitysource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awscognitoidentitysource"] 53 | -------------------------------------------------------------------------------- /pkg/apis/sources/v1alpha1/conditions.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "knative.dev/pkg/apis" 21 | ) 22 | 23 | // Status conditions 24 | const ( 25 | // ConditionReady has status True when the source is ready to send events. 26 | ConditionReady = apis.ConditionReady 27 | // ConditionSinkProvided has status True when the source has been configured with a sink target. 28 | ConditionSinkProvided apis.ConditionType = "SinkProvided" 29 | // ConditionDeployed has status True when the source's adapter is up and running. 30 | ConditionDeployed apis.ConditionType = "Deployed" 31 | ) 32 | 33 | // Reasons for status conditions 34 | const ( 35 | // ReasonSinkNotFound is set on a SinkProvided condition when a sink does not exist. 36 | ReasonSinkNotFound = "SinkNotFound" 37 | // ReasonSinkEmpty is set on a SinkProvided condition when a sink URI is empty. 38 | ReasonSinkEmpty = "EmptySinkURI" 39 | 40 | // ReasonRBACNotBound is set on a Deployed condition when an adapter's 41 | // ServiceAccount cannot be bound. 42 | ReasonRBACNotBound = "RBACNotBound" 43 | // ReasonUnavailable is set on a Deployed condition when an adapter in unavailable. 44 | ReasonUnavailable = "AdapterUnavailable" 45 | ) 46 | -------------------------------------------------------------------------------- /pkg/apis/duration.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package apis 18 | 19 | import ( 20 | "encoding/json" 21 | "fmt" 22 | "time" 23 | ) 24 | 25 | // Duration extends time.Duration with additional methods for (de-)serialization to/from 26 | // JSON, allowing it to be embedded in custom API objects. 27 | type Duration time.Duration 28 | 29 | var ( 30 | _ fmt.Stringer = (*Duration)(nil) 31 | _ json.Marshaler = (*Duration)(nil) 32 | _ json.Unmarshaler = (*Duration)(nil) 33 | ) 34 | 35 | // String implements the fmt.Stringer interface. 36 | func (d Duration) String() string { 37 | return time.Duration(d).String() 38 | } 39 | 40 | // UnmarshalJSON implements json.Unmarshaler. 41 | func (d *Duration) UnmarshalJSON(data []byte) error { 42 | var dataStr string 43 | if err := json.Unmarshal(data, &dataStr); err != nil { 44 | return err 45 | } 46 | 47 | dur, err := time.ParseDuration(dataStr) 48 | if err != nil { 49 | return fmt.Errorf("failed to parse duration %q: %w", dataStr, err) 50 | } 51 | 52 | *d = Duration(dur) 53 | 54 | return nil 55 | } 56 | 57 | // MarshalJSON implements json.Marshaler. 58 | func (d Duration) MarshalJSON() ([]byte, error) { 59 | return []byte(`"` + time.Duration(d).String() + `"`), nil 60 | } 61 | -------------------------------------------------------------------------------- /cmd/awsperformanceinsightssource/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/awsperformanceinsightssource 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make awsperformanceinsightssource && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "TriggerMesh AWS Performance Insights Event Source" 38 | LABEL vendor "TriggerMesh" 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "The TriggerMesh AWS Performance Insights Source" 42 | LABEL description "This is the TriggerMesh Knative Event Source for AWS Performance Insights" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/awsperformanceinsightssource / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/awsperformanceinsightssource"] 53 | -------------------------------------------------------------------------------- /cmd/aws-event-sources-controller/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM golang:1.15-buster AS builder 16 | 17 | ENV CGO_ENABLED 0 18 | ENV GOOS linux 19 | ENV GOARCH amd64 20 | 21 | WORKDIR /go/src/aws-event-sources-controller 22 | 23 | COPY go.mod go.sum ./ 24 | RUN go mod download 25 | 26 | COPY . . 27 | RUN BIN_OUTPUT_DIR=/bin make aws-event-sources-controller && \ 28 | mkdir /kodata && \ 29 | mv .git/* /kodata/ && \ 30 | rm -rf ${GOPATH} && \ 31 | rm -rf ${HOME}/.cache 32 | 33 | FROM registry.access.redhat.com/ubi8/ubi-minimal 34 | 35 | ARG VERSION 36 | 37 | LABEL name "AWS Event Sources Controller" 38 | LABEL vendor "TriggerMesh Inc." 39 | LABEL version "$VERSION" 40 | LABEL release "1" 41 | LABEL summary "AWS Event Sources controller for Kubernetes" 42 | LABEL description "aws-event-sources is a Kubernetes controller that implements Knative event sources for AWS services" 43 | 44 | # Emulate ko builds 45 | # https://github.com/google/ko/blob/v0.5.0/README.md#including-static-assets 46 | ENV KO_DATA_PATH /kodata 47 | 48 | COPY --from=builder /kodata/ ${KO_DATA_PATH}/ 49 | COPY --from=builder /bin/aws-event-sources-controller / 50 | COPY licenses/ /licenses/ 51 | 52 | ENTRYPOINT ["/aws-event-sources-controller"] 53 | -------------------------------------------------------------------------------- /config/samples/awscloudwatchsource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSCloudWatchSource object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awscloudwatchsources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSCloudWatchSource 24 | metadata: 25 | name: sample 26 | spec: 27 | region: us-west-2 28 | pollingInterval: 2m 29 | 30 | metricQueries: 31 | - name: testquery 32 | metric: 33 | period: 60 34 | stat: p90 35 | unit: Milliseconds 36 | metric: 37 | metricName: Duration 38 | namespace: AWS/Lambda 39 | dimensions: 40 | - name: FunctionName 41 | value: lambdadumper 42 | 43 | credentials: 44 | accessKeyID: 45 | valueFromSecret: 46 | name: awscreds 47 | key: aws_access_key_id 48 | secretAccessKey: 49 | valueFromSecret: 50 | name: awscreds 51 | key: aws_secret_access_key 52 | 53 | sink: 54 | ref: 55 | apiVersion: eventing.knative.dev/v1 56 | kind: Broker 57 | name: default 58 | -------------------------------------------------------------------------------- /hack/release-notes.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | RELEASE=${1:-${GIT_TAG}} 4 | RELEASE=${RELEASE:-${CIRCLE_TAG}} 5 | 6 | if [ -z "${RELEASE}" ]; then 7 | echo "Usage:" 8 | echo "release-notes.sh VERSION" 9 | exit 1 10 | fi 11 | 12 | if ! git rev-list ${RELEASE} >/dev/null 2>&1; then 13 | echo "${RELEASE} does not exist" 14 | exit 15 | fi 16 | 17 | KREPO="aws-event-sources" 18 | BASE_URL="https://github.com/triggermesh/${KREPO}/releases/download/${RELEASE}" 19 | PREV_RELEASE=${PREV_RELEASE:-$(git describe --tags --abbrev=0 ${RELEASE}^ 2>/dev/null)} 20 | PREV_RELEASE=${PREV_RELEASE:-$(git rev-list --max-parents=0 ${RELEASE}^ 2>/dev/null)} 21 | NOTABLE_CHANGES=$(git cat-file -p ${RELEASE} | sed '/-----BEGIN PGP SIGNATURE-----/,//d' | tail -n +6) 22 | CHANGELOG=$(git log --no-merges --pretty=format:'- [%h] %s (%aN)' ${PREV_RELEASE}..${RELEASE}) 23 | if [ $? -ne 0 ]; then 24 | echo "Error creating changelog" 25 | exit 1 26 | fi 27 | 28 | COMMANDS=$(sed -n -e "s/^\(COMMANDS[[:space:]]*=[[:space:]]*\)\(.*\)$/\2/p" Makefile) 29 | PLATFORMS=$(sed -n -e "s/^\(TARGETS[[:space:]]*?=[[:space:]]*\)\(.*\)$/\2/p" Makefile) 30 | RELEASE_ASSETS_TABLE=$( 31 | echo -n "|"; for command in ${COMMANDS}; do echo -n " ${command} |"; done ; echo 32 | echo -n "|"; for command in ${COMMANDS}; do echo -n "--|"; done ; echo 33 | echo -n "|" 34 | for command in ${COMMANDS}; do 35 | echo -n " ([container](https://gcr.io/triggermesh/${command}:${RELEASE}))" 36 | for platform in ${PLATFORMS}; do 37 | echo -n " ([${platform}](${BASE_URL}/${command}-${platform%/*}-${platform#*/}))" 38 | done 39 | echo -n " |" 40 | done 41 | echo 42 | ) 43 | 44 | cat < :information_source: The sample manifest below references AWS credentials (Access Key) from a Kubernetes Secret object 22 | > called `awscreds`. This Secret can be generated with the following command: 23 | > 24 | > ```console 25 | > $ kubectl -n create secret generic awscreds \ 26 | > --from-literal=aws_access_key_id= \ 27 | > --from-literal=aws_secret_access_key= 28 | > ``` 29 | > 30 | > Alternatively, credentials can be used as literal strings instead of references to Kubernetes Secrets by replacing 31 | > `valueFrom` attributes with `value` inside API objects' manifests. 32 | 33 | Copy the sample manifest from `config/samples/awssqssource.yaml` and replace the pre-filled `spec` attributes with the 34 | values corresponding to your _Amazon SQS_ queue. Then, create that `AWSSQSSource` object in your Kubernetes cluster: 35 | 36 | ```console 37 | $ kubectl -n create -f my-awssqssource.yaml 38 | ``` 39 | 40 | [doc-accesskey]: https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys 41 | [doc-sqs]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-create-queue.html 42 | -------------------------------------------------------------------------------- /pkg/client/generated/informers/externalversions/sources/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package sources 20 | 21 | import ( 22 | internalinterfaces "github.com/triggermesh/aws-event-sources/pkg/client/generated/informers/externalversions/internalinterfaces" 23 | v1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/informers/externalversions/sources/v1alpha1" 24 | ) 25 | 26 | // Interface provides access to each of this group's versions. 27 | type Interface interface { 28 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 29 | V1alpha1() v1alpha1.Interface 30 | } 31 | 32 | type group struct { 33 | factory internalinterfaces.SharedInformerFactory 34 | namespace string 35 | tweakListOptions internalinterfaces.TweakListOptionsFunc 36 | } 37 | 38 | // New returns a new Interface. 39 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 40 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 41 | } 42 | 43 | // V1alpha1 returns a new v1alpha1.Interface. 44 | func (g *group) V1alpha1() v1alpha1.Interface { 45 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 46 | } 47 | -------------------------------------------------------------------------------- /pkg/reconciler/awskinesissource/reconciler.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awskinesissource 18 | 19 | import ( 20 | "context" 21 | 22 | "knative.dev/pkg/reconciler" 23 | 24 | "github.com/triggermesh/aws-event-sources/pkg/apis/sources/v1alpha1" 25 | reconcilerv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/reconciler/sources/v1alpha1/awskinesissource" 26 | listersv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/listers/sources/v1alpha1" 27 | "github.com/triggermesh/aws-event-sources/pkg/reconciler/common" 28 | ) 29 | 30 | // Reconciler implements controller.Reconciler for the event source type. 31 | type Reconciler struct { 32 | base common.GenericDeploymentReconciler 33 | adapterCfg *adapterConfig 34 | 35 | srcLister func(namespace string) listersv1alpha1.AWSKinesisSourceNamespaceLister 36 | } 37 | 38 | // Check that our Reconciler implements Interface 39 | var _ reconcilerv1alpha1.Interface = (*Reconciler)(nil) 40 | 41 | // ReconcileKind implements Interface.ReconcileKind. 42 | func (r *Reconciler) ReconcileKind(ctx context.Context, src *v1alpha1.AWSKinesisSource) reconciler.Event { 43 | // inject source into context for usage in reconciliation logic 44 | ctx = v1alpha1.WithSource(ctx, src) 45 | 46 | return r.base.ReconcileSource(ctx, r) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/reconciler/awsdynamodbsource/reconciler.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awsdynamodbsource 18 | 19 | import ( 20 | "context" 21 | 22 | "knative.dev/pkg/reconciler" 23 | 24 | "github.com/triggermesh/aws-event-sources/pkg/apis/sources/v1alpha1" 25 | reconcilerv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/reconciler/sources/v1alpha1/awsdynamodbsource" 26 | listersv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/listers/sources/v1alpha1" 27 | "github.com/triggermesh/aws-event-sources/pkg/reconciler/common" 28 | ) 29 | 30 | // Reconciler implements controller.Reconciler for the event source type. 31 | type Reconciler struct { 32 | base common.GenericDeploymentReconciler 33 | adapterCfg *adapterConfig 34 | 35 | srcLister func(namespace string) listersv1alpha1.AWSDynamoDBSourceNamespaceLister 36 | } 37 | 38 | // Check that our Reconciler implements Interface 39 | var _ reconcilerv1alpha1.Interface = (*Reconciler)(nil) 40 | 41 | // ReconcileKind implements Interface.ReconcileKind. 42 | func (r *Reconciler) ReconcileKind(ctx context.Context, src *v1alpha1.AWSDynamoDBSource) reconciler.Event { 43 | // inject source into context for usage in reconciliation logic 44 | ctx = v1alpha1.WithSource(ctx, src) 45 | 46 | return r.base.ReconcileSource(ctx, r) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/reconciler/awscloudwatchsource/reconciler.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscloudwatchsource 18 | 19 | import ( 20 | "context" 21 | 22 | "knative.dev/pkg/reconciler" 23 | 24 | "github.com/triggermesh/aws-event-sources/pkg/apis/sources/v1alpha1" 25 | reconcilerv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/reconciler/sources/v1alpha1/awscloudwatchsource" 26 | listersv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/listers/sources/v1alpha1" 27 | "github.com/triggermesh/aws-event-sources/pkg/reconciler/common" 28 | ) 29 | 30 | // Reconciler implements controller.Reconciler for the event source type. 31 | type Reconciler struct { 32 | base common.GenericDeploymentReconciler 33 | adapterCfg *adapterConfig 34 | 35 | srcLister func(namespace string) listersv1alpha1.AWSCloudWatchSourceNamespaceLister 36 | } 37 | 38 | // Check that our Reconciler implements Interface 39 | var _ reconcilerv1alpha1.Interface = (*Reconciler)(nil) 40 | 41 | // ReconcileKind implements Interface.ReconcileKind. 42 | func (r *Reconciler) ReconcileKind(ctx context.Context, src *v1alpha1.AWSCloudWatchSource) reconciler.Event { 43 | // inject source into context for usage in reconciliation logic 44 | ctx = v1alpha1.WithSource(ctx, src) 45 | 46 | return r.base.ReconcileSource(ctx, r) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/reconciler/awscodecommitsource/reconciler.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscodecommitsource 18 | 19 | import ( 20 | "context" 21 | 22 | "knative.dev/pkg/reconciler" 23 | 24 | "github.com/triggermesh/aws-event-sources/pkg/apis/sources/v1alpha1" 25 | reconcilerv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/reconciler/sources/v1alpha1/awscodecommitsource" 26 | listersv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/listers/sources/v1alpha1" 27 | "github.com/triggermesh/aws-event-sources/pkg/reconciler/common" 28 | ) 29 | 30 | // Reconciler implements controller.Reconciler for the event source type. 31 | type Reconciler struct { 32 | base common.GenericDeploymentReconciler 33 | adapterCfg *adapterConfig 34 | 35 | srcLister func(namespace string) listersv1alpha1.AWSCodeCommitSourceNamespaceLister 36 | } 37 | 38 | // Check that our Reconciler implements Interface 39 | var _ reconcilerv1alpha1.Interface = (*Reconciler)(nil) 40 | 41 | // ReconcileKind implements Interface.ReconcileKind. 42 | func (r *Reconciler) ReconcileKind(ctx context.Context, src *v1alpha1.AWSCodeCommitSource) reconciler.Event { 43 | // inject source into context for usage in reconciliation logic 44 | ctx = v1alpha1.WithSource(ctx, src) 45 | 46 | return r.base.ReconcileSource(ctx, r) 47 | } 48 | -------------------------------------------------------------------------------- /cmd/awskinesissource/README.md: -------------------------------------------------------------------------------- 1 | # Amazon Kinesis event source for Knative Eventing 2 | 3 | This event source consumes records from a Amazon Kinesis stream and sends them as CloudEvents to an arbitrary event 4 | sink. 5 | 6 | ## Contents 7 | 8 | 1. [Prerequisites](#prerequisites) 9 | 1. [Deployment to Kubernetes](#deployment-to-kubernetes) 10 | 11 | ## Prerequisites 12 | 13 | * Register an AWS account 14 | * Create an [Access Key][doc-accesskey] in your AWS IAM dashboard. 15 | * Create a [Kinesis stream][doc-kinesis]. 16 | 17 | ## Deployment to Kubernetes 18 | 19 | The _Amazon Kinesis event source_ can be deployed to Kubernetes as an `AWSKinesisSource` object, to a cluster where the 20 | TriggerMesh _AWS Event Sources Controller_ is running. 21 | 22 | > :information_source: The sample manifest below references AWS credentials (Access Key) from a Kubernetes Secret object 23 | > called `awscreds`. This Secret can be generated with the following command: 24 | > 25 | > ```console 26 | > $ kubectl -n create secret generic awscreds \ 27 | > --from-literal=aws_access_key_id= \ 28 | > --from-literal=aws_secret_access_key= 29 | > ``` 30 | > 31 | > Alternatively, credentials can be used as literal strings instead of references to Kubernetes Secrets by replacing 32 | > `valueFrom` attributes with `value` inside API objects' manifests. 33 | 34 | Copy the sample manifest from `config/samples/awskinesissource.yaml` and replace the pre-filled `spec` attributes with 35 | the values corresponding to your _Amazon Kinesis_ stream. Then, create that `AWSKinesisSource` object in your Kubernetes 36 | cluster: 37 | 38 | ```console 39 | $ kubectl -n create -f my-awskinesissource.yaml 40 | ``` 41 | 42 | [doc-accesskey]: https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys 43 | [doc-kinesis]: https://docs.aws.amazon.com/streams/latest/dev/amazon-kinesis-streams.html 44 | -------------------------------------------------------------------------------- /pkg/reconciler/awscloudwatchlogssource/reconciler.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscloudwatchlogssource 18 | 19 | import ( 20 | "context" 21 | 22 | "knative.dev/pkg/reconciler" 23 | 24 | "github.com/triggermesh/aws-event-sources/pkg/apis/sources/v1alpha1" 25 | reconcilerv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/reconciler/sources/v1alpha1/awscloudwatchlogssource" 26 | listersv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/listers/sources/v1alpha1" 27 | "github.com/triggermesh/aws-event-sources/pkg/reconciler/common" 28 | ) 29 | 30 | // Reconciler implements controller.Reconciler for the event source type. 31 | type Reconciler struct { 32 | base common.GenericDeploymentReconciler 33 | adapterCfg *adapterConfig 34 | 35 | srcLister func(namespace string) listersv1alpha1.AWSCloudWatchLogsSourceNamespaceLister 36 | } 37 | 38 | // Check that our Reconciler implements Interface 39 | var _ reconcilerv1alpha1.Interface = (*Reconciler)(nil) 40 | 41 | // ReconcileKind implements Interface.ReconcileKind. 42 | func (r *Reconciler) ReconcileKind(ctx context.Context, src *v1alpha1.AWSCloudWatchLogsSource) reconciler.Event { 43 | // inject source into context for usage in reconciliation logic 44 | ctx = v1alpha1.WithSource(ctx, src) 45 | 46 | return r.base.ReconcileSource(ctx, r) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/reconciler/common/resource/deployment.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package resource 18 | 19 | import ( 20 | appsv1 "k8s.io/api/apps/v1" 21 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 | ) 23 | 24 | // NewDeployment creates a Deployment object. 25 | func NewDeployment(ns, name string, opts ...ObjectOption) *appsv1.Deployment { 26 | d := &appsv1.Deployment{ 27 | ObjectMeta: metav1.ObjectMeta{ 28 | Namespace: ns, 29 | Name: name, 30 | }, 31 | } 32 | 33 | for _, opt := range opts { 34 | opt(d) 35 | } 36 | 37 | // If the Deployment was created without defining a Container 38 | // explicitly, ensure its default container's name is not empty. 39 | containers := d.Spec.Template.Spec.Containers 40 | if len(containers) == 1 && containers[0].Name == "" { 41 | containers[0].Name = defaultContainerName 42 | } 43 | 44 | return d 45 | } 46 | 47 | // Selector adds a label selector to a Deployment's spec, ensuring a 48 | // corresponding label exists in the Pod template. 49 | func Selector(key, val string) ObjectOption { 50 | return func(object interface{}) { 51 | d := object.(*appsv1.Deployment) 52 | 53 | selector := &d.Spec.Selector 54 | 55 | if *selector == nil { 56 | *selector = &metav1.LabelSelector{} 57 | } 58 | *selector = metav1.AddLabelToSelector(*selector, key, val) 59 | 60 | PodLabel(key, val)(d) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /pkg/reconciler/awscognitoidentitysource/reconciler.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscognitoidentitysource 18 | 19 | import ( 20 | "context" 21 | 22 | "knative.dev/pkg/reconciler" 23 | 24 | "github.com/triggermesh/aws-event-sources/pkg/apis/sources/v1alpha1" 25 | reconcilerv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/reconciler/sources/v1alpha1/awscognitoidentitysource" 26 | listersv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/listers/sources/v1alpha1" 27 | "github.com/triggermesh/aws-event-sources/pkg/reconciler/common" 28 | ) 29 | 30 | // Reconciler implements controller.Reconciler for the event source type. 31 | type Reconciler struct { 32 | base common.GenericDeploymentReconciler 33 | adapterCfg *adapterConfig 34 | 35 | srcLister func(namespace string) listersv1alpha1.AWSCognitoIdentitySourceNamespaceLister 36 | } 37 | 38 | // Check that our Reconciler implements Interface 39 | var _ reconcilerv1alpha1.Interface = (*Reconciler)(nil) 40 | 41 | // ReconcileKind implements Interface.ReconcileKind. 42 | func (r *Reconciler) ReconcileKind(ctx context.Context, src *v1alpha1.AWSCognitoIdentitySource) reconciler.Event { 43 | // inject source into context for usage in reconciliation logic 44 | ctx = v1alpha1.WithSource(ctx, src) 45 | 46 | return r.base.ReconcileSource(ctx, r) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/reconciler/awscognitouserpoolsource/reconciler.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awscognitouserpoolsource 18 | 19 | import ( 20 | "context" 21 | 22 | "knative.dev/pkg/reconciler" 23 | 24 | "github.com/triggermesh/aws-event-sources/pkg/apis/sources/v1alpha1" 25 | reconcilerv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/reconciler/sources/v1alpha1/awscognitouserpoolsource" 26 | listersv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/listers/sources/v1alpha1" 27 | "github.com/triggermesh/aws-event-sources/pkg/reconciler/common" 28 | ) 29 | 30 | // Reconciler implements controller.Reconciler for the event source type. 31 | type Reconciler struct { 32 | base common.GenericDeploymentReconciler 33 | adapterCfg *adapterConfig 34 | 35 | srcLister func(namespace string) listersv1alpha1.AWSCognitoUserPoolSourceNamespaceLister 36 | } 37 | 38 | // Check that our Reconciler implements Interface 39 | var _ reconcilerv1alpha1.Interface = (*Reconciler)(nil) 40 | 41 | // ReconcileKind implements Interface.ReconcileKind. 42 | func (r *Reconciler) ReconcileKind(ctx context.Context, src *v1alpha1.AWSCognitoUserPoolSource) reconciler.Event { 43 | // inject source into context for usage in reconciliation logic 44 | ctx = v1alpha1.WithSource(ctx, src) 45 | 46 | return r.base.ReconcileSource(ctx, r) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/reconciler/awsperformanceinsightssource/reconciler.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package awsperformanceinsightssource 18 | 19 | import ( 20 | "context" 21 | 22 | "knative.dev/pkg/reconciler" 23 | 24 | "github.com/triggermesh/aws-event-sources/pkg/apis/sources/v1alpha1" 25 | reconcilerv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/reconciler/sources/v1alpha1/awsperformanceinsightssource" 26 | listersv1alpha1 "github.com/triggermesh/aws-event-sources/pkg/client/generated/listers/sources/v1alpha1" 27 | "github.com/triggermesh/aws-event-sources/pkg/reconciler/common" 28 | ) 29 | 30 | // Reconciler implements controller.Reconciler for the event source type. 31 | type Reconciler struct { 32 | base common.GenericDeploymentReconciler 33 | adapterCfg *adapterConfig 34 | 35 | srcLister func(namespace string) listersv1alpha1.AWSPerformanceInsightsSourceNamespaceLister 36 | } 37 | 38 | // Check that our Reconciler implements Interface 39 | var _ reconcilerv1alpha1.Interface = (*Reconciler)(nil) 40 | 41 | // ReconcileKind implements Interface.ReconcileKind. 42 | func (r *Reconciler) ReconcileKind(ctx context.Context, src *v1alpha1.AWSPerformanceInsightsSource) reconciler.Event { 43 | // inject source into context for usage in reconciliation logic 44 | ctx = v1alpha1.WithSource(ctx, src) 45 | 46 | return r.base.ReconcileSource(ctx, r) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awss3source/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awss3source/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSS3Sources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /cmd/awscodecommitsource/README.md: -------------------------------------------------------------------------------- 1 | # AWS CodeCommit event source for Knative Eventing 2 | 3 | This event source consumes messages from a AWS CodeCommit repository and sends them as CloudEvents to an arbitrary event 4 | sink. 5 | 6 | ## Contents 7 | 8 | 1. [Prerequisites](#prerequisites) 9 | 1. [Deployment to Kubernetes](#deployment-to-kubernetes) 10 | 11 | ## Prerequisites 12 | 13 | * Register an AWS account 14 | * Create an [Access Key][doc-accesskey] in your AWS IAM dashboard. 15 | * Create a [CodeCommit repository][doc-codecommit]. 16 | 17 | ## Deployment to Kubernetes 18 | 19 | The _AWS CodeCommit event source_ can be deployed to Kubernetes as an `AWSCodeCommitSource` object, to a cluster where 20 | the TriggerMesh _AWS Event Sources Controller_ is running. 21 | 22 | > :information_source: The sample manifest below references AWS credentials (Access Key) from a Kubernetes Secret object 23 | > called `awscreds`. This Secret can be generated with the following command: 24 | > 25 | > ```console 26 | > $ kubectl -n create secret generic awscreds \ 27 | > --from-literal=aws_access_key_id= \ 28 | > --from-literal=aws_secret_access_key= 29 | > ``` 30 | > 31 | > Alternatively, credentials can be used as literal strings instead of references to Kubernetes Secrets by replacing 32 | > `valueFrom` attributes with `value` inside API objects' manifests. 33 | 34 | Copy the sample manifest from `config/samples/awscodecommitsource.yaml` and replace the pre-filled `spec` attributes 35 | with the values corresponding to your _AWS CodeCommit_ repository. Then, create that `AWSCodeCommitSource` object in 36 | your Kubernetes cluster: 37 | 38 | ```console 39 | $ kubectl -n create -f my-awscodecommitsource.yaml 40 | ``` 41 | 42 | [doc-accesskey]: https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys 43 | [doc-codecommit]: https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-create-repository.html 44 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awssnssource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awssnssource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSSNSSources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awssqssource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awssqssource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSSQSSources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awskinesissource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awskinesissource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSKinesisSources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /config/samples/awssnssource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Sample AWSSNSSource object. 16 | # 17 | # For a list and description of all available attributes, execute the following command against a cluster where this 18 | # Custom Resource Definition has been registered: 19 | # 20 | # kubectl explain awssnssources.sources.triggermesh.io 21 | 22 | apiVersion: sources.triggermesh.io/v1alpha1 23 | kind: AWSSNSSource 24 | metadata: 25 | name: sample 26 | spec: 27 | arn: arn:aws:sns:us-west-2:123456789012:triggermeshtest 28 | 29 | # For a list of supported subscription attributes, please refer to the following resources: 30 | # * https://docs.aws.amazon.com/sns/latest/api/API_SetSubscriptionAttributes.html 31 | # * https://docs.aws.amazon.com/sns/latest/dg/sns-how-it-works.html 32 | subscriptionAttributes: 33 | DeliveryPolicy: | 34 | { 35 | "healthyRetryPolicy": { 36 | "numRetries": 3, 37 | "minDelayTarget": 20, 38 | "maxDelayTarget": 20 39 | } 40 | } 41 | 42 | credentials: 43 | accessKeyID: 44 | valueFromSecret: 45 | name: awscreds 46 | key: aws_access_key_id 47 | secretAccessKey: 48 | valueFromSecret: 49 | name: awscreds 50 | key: aws_secret_access_key 51 | 52 | sink: 53 | ref: 54 | apiVersion: eventing.knative.dev/v1 55 | kind: Broker 56 | name: default 57 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awsdynamodbsource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awsdynamodbsource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSDynamoDBSources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchsource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchsource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSCloudWatchSources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscodecommitsource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscodecommitsource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSCodeCommitSources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /pkg/reconciler/common/events.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package common 18 | 19 | // Reasons for API Events 20 | const ( 21 | // ReasonRBACCreate indicates that an RBAC object was successfully created. 22 | ReasonRBACCreate = "CreateRBAC" 23 | // ReasonRBACUpdate indicates that an RBAC object was successfully updated. 24 | ReasonRBACUpdate = "UpdateRBAC" 25 | // ReasonFailedRBACCreate indicates that the creation of an RBAC object failed. 26 | ReasonFailedRBACCreate = "FailedRBACCreate" 27 | // ReasonFailedRBACUpdate indicates that the update of an RBAC object failed. 28 | ReasonFailedRBACUpdate = "FailedRBACUpdate" 29 | 30 | // ReasonAdapterCreate indicates that an adapter object was successfully created. 31 | ReasonAdapterCreate = "CreateAdapter" 32 | // ReasonAdapterUpdate indicates that an adapter object was successfully updated. 33 | ReasonAdapterUpdate = "UpdateAdapter" 34 | // ReasonFailedAdapterCreate indicates that the creation of an adapter object failed. 35 | ReasonFailedAdapterCreate = "FailedAdapterCreate" 36 | // ReasonFailedAdapterUpdate indicates that the update of an adapter object failed. 37 | ReasonFailedAdapterUpdate = "FailedAdapterUpdate" 38 | 39 | // ReasonBadSinkURI indicates that the URI of a sink can't be determined. 40 | ReasonBadSinkURI = "BadSinkURI" 41 | 42 | // ReasonInvalidSpec indicates that spec of a reconciled object is invalid. 43 | ReasonInvalidSpec = "InvalidSpec" 44 | ) 45 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchlogssource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscloudwatchlogssource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSCloudWatchLogsSources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscognitoidentitysource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscognitoidentitysource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSCognitoIdentitySources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awscognitouserpoolsource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awscognitouserpoolsource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSCognitoUserPoolSources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /pkg/client/generated/injection/informers/sources/v1alpha1/awsperformanceinsightssource/filtered/fake/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020-2021 TriggerMesh Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by injection-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | context "context" 23 | 24 | factoryfiltered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/factory/filtered" 25 | filtered "github.com/triggermesh/aws-event-sources/pkg/client/generated/injection/informers/sources/v1alpha1/awsperformanceinsightssource/filtered" 26 | controller "knative.dev/pkg/controller" 27 | injection "knative.dev/pkg/injection" 28 | logging "knative.dev/pkg/logging" 29 | ) 30 | 31 | var Get = filtered.Get 32 | 33 | func init() { 34 | injection.Fake.RegisterFilteredInformers(withInformer) 35 | } 36 | 37 | func withInformer(ctx context.Context) (context.Context, []controller.Informer) { 38 | untyped := ctx.Value(factoryfiltered.LabelKey{}) 39 | if untyped == nil { 40 | logging.FromContext(ctx).Panic( 41 | "Unable to fetch labelkey from context.") 42 | } 43 | labelSelectors := untyped.([]string) 44 | infs := []controller.Informer{} 45 | for _, selector := range labelSelectors { 46 | f := factoryfiltered.Get(ctx, selector) 47 | inf := f.Sources().V1alpha1().AWSPerformanceInsightsSources() 48 | ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) 49 | infs = append(infs, inf.Informer()) 50 | } 51 | return ctx, infs 52 | } 53 | -------------------------------------------------------------------------------- /cmd/awscognitouserpoolsource/README.md: -------------------------------------------------------------------------------- 1 | # Amazon Cognito User Pool event source for Knative Eventing 2 | 3 | This event source consumes notifications from a Amazon Cognito User Pool and sends them as CloudEvents to an arbitrary 4 | event sink. 5 | 6 | ## Contents 7 | 8 | 1. [Prerequisites](#prerequisites) 9 | 1. [Deployment to Kubernetes](#deployment-to-kubernetes) 10 | 11 | ## Prerequisites 12 | 13 | * Register an AWS account 14 | * Create an [Access Key][doc-accesskey] in your AWS IAM dashboard. 15 | * Create a [Cognito User Pool][doc-cognito-user-pool]. 16 | 17 | ## Deployment to Kubernetes 18 | 19 | The _Amazon Cognito User Pool event source_ can be deployed to Kubernetes as an `AWSCognitoUserPoolSource` object, to a 20 | cluster where the TriggerMesh _AWS Event Sources Controller_ is running. 21 | 22 | > :information_source: The sample manifest below references AWS credentials (Access Key) from a Kubernetes Secret object 23 | > called `awscreds`. This Secret can be generated with the following command: 24 | > 25 | > ```console 26 | > $ kubectl -n create secret generic awscreds \ 27 | > --from-literal=aws_access_key_id= \ 28 | > --from-literal=aws_secret_access_key= 29 | > ``` 30 | > 31 | > Alternatively, credentials can be used as literal strings instead of references to Kubernetes Secrets by replacing 32 | > `valueFrom` attributes with `value` inside API objects' manifests. 33 | 34 | Copy the sample manifest from `config/samples/awscognitouserpoolsource.yaml` and replace the pre-filled `spec` 35 | attributes with the values corresponding to your _Amazon Cognito_ User Pool. Then, create that 36 | `AWSCognitoUserPoolSource` object in your Kubernetes cluster: 37 | 38 | ```console 39 | $ kubectl -n create -f my-awscognitouserpoolsource.yaml 40 | ``` 41 | 42 | [doc-accesskey]: https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys 43 | [doc-cognito-user-pool]: https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-create-user-pool.html 44 | -------------------------------------------------------------------------------- /config/202-clusterrolebindings.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020-2021 TriggerMesh Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | apiVersion: rbac.authorization.k8s.io/v1 16 | kind: ClusterRoleBinding 17 | metadata: 18 | name: aws-event-sources-controller 19 | subjects: 20 | - kind: ServiceAccount 21 | name: aws-event-sources-controller 22 | namespace: triggermesh 23 | roleRef: 24 | apiGroup: rbac.authorization.k8s.io 25 | kind: ClusterRole 26 | name: aws-event-sources-controller 27 | 28 | --- 29 | 30 | # Permissions not required by controllers directly, but granted to 31 | # receive-adapters via RoleBindings. 32 | # 33 | # Without them, the following error is thrown: 34 | # "attempting to grant RBAC permissions not currently held" 35 | # 36 | 37 | apiVersion: rbac.authorization.k8s.io/v1 38 | kind: ClusterRoleBinding 39 | metadata: 40 | name: awssnssource-adapter 41 | subjects: 42 | - kind: ServiceAccount 43 | name: aws-event-sources-controller 44 | namespace: triggermesh 45 | roleRef: 46 | apiGroup: rbac.authorization.k8s.io 47 | kind: ClusterRole 48 | name: awssnssource-adapter 49 | 50 | --- 51 | 52 | # Resolve sink URIs 53 | apiVersion: rbac.authorization.k8s.io/v1 54 | kind: ClusterRoleBinding 55 | metadata: 56 | name: aws-event-sources-controller-addressable-resolver 57 | subjects: 58 | - kind: ServiceAccount 59 | name: aws-event-sources-controller 60 | namespace: triggermesh 61 | roleRef: 62 | apiGroup: rbac.authorization.k8s.io 63 | kind: ClusterRole 64 | name: addressable-resolver 65 | -------------------------------------------------------------------------------- /cmd/awscognitoidentitysource/README.md: -------------------------------------------------------------------------------- 1 | # Amazon Cognito Identity event source for Knative Eventing 2 | 3 | This event source consumes notifications from a Amazon Cognito Identity Pool and sends them as CloudEvents to an 4 | arbitrary event sink. 5 | 6 | ## Contents 7 | 8 | 1. [Prerequisites](#prerequisites) 9 | 1. [Deployment to Kubernetes](#deployment-to-kubernetes) 10 | 11 | ## Prerequisites 12 | 13 | * Register an AWS account 14 | * Create an [Access Key][doc-accesskey] in your AWS IAM dashboard. 15 | * Create a [Cognito identity pool][doc-cognito-identity-pool]. 16 | 17 | ## Deployment to Kubernetes 18 | 19 | The _Amazon Cognito Identity event source_ can be deployed to Kubernetes as an `AWSCognitoIdentitySource` object, to a 20 | cluster where the TriggerMesh _AWS Event Sources Controller_ is running. 21 | 22 | > :information_source: The sample manifest below references AWS credentials (Access Key) from a Kubernetes Secret object 23 | > called `awscreds`. This Secret can be generated with the following command: 24 | > 25 | > ```console 26 | > $ kubectl -n create secret generic awscreds \ 27 | > --from-literal=aws_access_key_id= \ 28 | > --from-literal=aws_secret_access_key= 29 | > ``` 30 | > 31 | > Alternatively, credentials can be used as literal strings instead of references to Kubernetes Secrets by replacing 32 | > `valueFrom` attributes with `value` inside API objects' manifests. 33 | 34 | Copy the sample manifest from `config/samples/awscognitoidentitysource.yaml` and replace the pre-filled `spec` 35 | attributes with the values corresponding to your _Amazon Cognito_ Identity Pool. Then, create that 36 | `AWSCognitoIdentitySource` object in your Kubernetes cluster: 37 | 38 | ```console 39 | $ kubectl -n create -f my-awscognitoidentitysource.yaml 40 | ``` 41 | 42 | [doc-accesskey]: https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys 43 | [doc-cognito-identity-pool]: https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-create-identity-pool.html 44 | --------------------------------------------------------------------------------