├── custom-connector-sdk
├── src
│ ├── test
│ │ └── resources
│ │ │ ├── UnknownRequest.json
│ │ │ ├── DescribeConnectorConfigurationRequest.json
│ │ │ ├── ValidateConnectorRuntimeSettingsRequest.json
│ │ │ ├── ValidateCredentialsRequest.json
│ │ │ ├── DescribeEntityRequest.json
│ │ │ ├── ListEntitiesRequest.json
│ │ │ ├── RetrieveDataRequest.json
│ │ │ ├── QueryDataRequest.json
│ │ │ └── WriteDataRequest.json
│ └── main
│ │ └── java
│ │ └── com
│ │ └── amazonaws
│ │ └── appflow
│ │ └── custom
│ │ └── connector
│ │ ├── model
│ │ ├── connectorconfiguration
│ │ │ ├── TriggerType.java
│ │ │ ├── auth
│ │ │ │ ├── OAuth2CustomPropType.java
│ │ │ │ ├── OAuth2GrantType.java
│ │ │ │ ├── OAuth2MethodType.java
│ │ │ │ ├── OAuth2ContentType.java
│ │ │ │ ├── CustomAuthConfig.java
│ │ │ │ ├── AuthParameter.java
│ │ │ │ ├── OAuth2CustomParameter.java
│ │ │ │ └── AuthenticationConfig.java
│ │ │ ├── TriggerFrequency.java
│ │ │ ├── DataTransferType.java
│ │ │ ├── ConnectorModes.java
│ │ │ ├── ConnectorOperator.java
│ │ │ └── DescribeConnectorConfigurationRequest.java
│ │ ├── write
│ │ │ ├── WriteOperationType.java
│ │ │ ├── WriteRecordResult.java
│ │ │ ├── WriteDataResponse.java
│ │ │ └── WriteDataRequest.java
│ │ ├── settings
│ │ │ ├── ConnectorRuntimeSettingDataType.java
│ │ │ ├── ConnectorRuntimeSettingScope.java
│ │ │ ├── ValidateConnectorRuntimeSettingsResponse.java
│ │ │ ├── ValidateConnectorRuntimeSettingsRequest.java
│ │ │ └── ConnectorRuntimeSetting.java
│ │ ├── metadata
│ │ │ ├── FieldDataType.java
│ │ │ ├── RangeConstraint.java
│ │ │ ├── EntityDefinition.java
│ │ │ ├── ReadOperationProperty.java
│ │ │ ├── DescribeEntityRequest.java
│ │ │ ├── DescribeEntityResponse.java
│ │ │ ├── FieldConstraints.java
│ │ │ ├── ListEntitiesResponse.java
│ │ │ ├── Entity.java
│ │ │ ├── ListEntitiesRequest.java
│ │ │ └── WriteOperationProperty.java
│ │ ├── credentials
│ │ │ ├── AuthenticationType.java
│ │ │ ├── BasicAuthCredentials.java
│ │ │ ├── ApiKeyCredentials.java
│ │ │ ├── OAuth2Credentials.java
│ │ │ ├── ValidateCredentialsResponse.java
│ │ │ ├── CustomAuthCredentials.java
│ │ │ ├── Credentials.java
│ │ │ └── ValidateCredentialsRequest.java
│ │ ├── ErrorDetails.java
│ │ ├── ConnectorRequestStyle.java
│ │ ├── CacheControl.java
│ │ ├── retreive
│ │ │ ├── RetrieveDataResponse.java
│ │ │ └── RetrieveDataRequest.java
│ │ ├── query
│ │ │ ├── QueryDataResponse.java
│ │ │ └── QueryDataRequest.java
│ │ ├── ErrorCode.java
│ │ ├── ConnectorContext.java
│ │ └── ConnectorRequest.java
│ │ ├── util
│ │ ├── DataFormatValidationException.java
│ │ └── CustomObjectMapper.java
│ │ ├── Constants.java
│ │ └── handlers
│ │ ├── MetadataHandler.java
│ │ ├── RecordHandler.java
│ │ └── ConfigurationHandler.java
└── pom.xml
├── custom-connector-example
├── salesforce-example-test-files
│ ├── salesforce-insert-file.csv
│ ├── test-file-3.json
│ ├── describe-connector-entity-validation-file.json
│ ├── list-entities-validation-file.json
│ └── test-file-2.json
├── Dockerfile
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── log4j2.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── amazonaws
│ │ │ └── appflow
│ │ │ └── custom
│ │ │ └── connector
│ │ │ └── example
│ │ │ ├── SalesforceResponse.java
│ │ │ ├── configuration
│ │ │ ├── ConnectorSettingKey.java
│ │ │ └── SupportedSalesforceVersion.java
│ │ │ ├── handler
│ │ │ └── SalesforceLambdaHandler.java
│ │ │ ├── query
│ │ │ └── QueryObject.java
│ │ │ └── parser
│ │ │ ├── AbstractParser.java
│ │ │ └── RecordResponseParser.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── amazonaws
│ │ └── appflow
│ │ └── custom
│ │ └── connector
│ │ └── example
│ │ └── integ
│ │ └── SalesforceTestDataProvider.java
├── testng.xml
└── template.yml
├── images
├── appflow-console-home.png
├── appflow-console-create-flow.png
├── appflow-console-connector-label.png
├── appflow-console-connectors-page.png
├── appflow-console-lambda-function.png
├── appflow-console-test-connector.png
├── appflow-console-connection-details.png
├── appflow-console-create-connection.png
├── appflow-console-registered-connector.png
├── appflow-console-custom-connectors-dropdown.png
└── appflow-console-custom-connectors-view-details.png
├── CODE_OF_CONDUCT.md
├── checkstyle-suppressions.xml
├── custom-connector-integ-test
└── src
│ ├── base-test-config.json
│ └── main
│ └── java
│ └── com
│ └── amazonaws
│ └── appflow
│ └── custom
│ └── connector
│ └── integ
│ ├── providers
│ ├── DataProvider.java
│ ├── AuthenticationType.java
│ ├── TestCredentials.java
│ └── ServiceProvider.java
│ ├── util
│ ├── PollingConfiguration.java
│ └── S3Helper.java
│ └── data
│ ├── TestBucketConfiguration.java
│ ├── CustomConnectorConfiguration.java
│ ├── ListConnectorEntitiesTestConfiguration.java
│ ├── DescribeConnectorEntityTestConfiguration.java
│ ├── OnDemandToS3TestConfiguration.java
│ ├── CustomConnectorProfileConfiguration.java
│ ├── OnDemandFromS3TestConfiguration.java
│ └── TestConfiguration.java
├── custom-connector-queryfilter
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── amazonaws
│ │ └── appflow
│ │ └── custom
│ │ └── connector
│ │ └── queryfilter
│ │ ├── antlr
│ │ ├── CustomConnectorQueryFilterLexer.tokens
│ │ └── CustomConnectorQueryFilterParser.tokens
│ │ ├── InvalidFilterExpressionException.java
│ │ ├── SyntaxErrorReporter.java
│ │ └── CustomConnectorParseTreeBuilder.java
│ └── configuration
│ └── grammar
│ ├── CustomConnectorQueryFilterLexer.g4
│ └── CustomConnectorQueryFilterParser.g4
├── .github
└── workflows
│ └── maven_build.yml
├── custom-connector-tests
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── amazonaws
│ │ │ └── appflow
│ │ │ └── custom
│ │ │ └── connector
│ │ │ └── tests
│ │ │ ├── exceptions
│ │ │ └── ValidationException.java
│ │ │ ├── model
│ │ │ ├── QueryRecordConfiguration.java
│ │ │ ├── RetrieveRecordConfiguration.java
│ │ │ ├── WriteRecordConfiguration.java
│ │ │ └── TestConfig.java
│ │ │ ├── resources
│ │ │ ├── TestLogger.java
│ │ │ └── TestContext.java
│ │ │ ├── invokers
│ │ │ └── ConnectorTestInvoker.java
│ │ │ └── validation
│ │ │ └── UrlValidator.java
│ │ └── configuration
│ │ └── TestConfig.json
└── pom.xml
├── License and Notice.txt
├── ChangeLog.md
└── custom-connector-tools
├── logFetcher.sh
└── deploy.sh
/custom-connector-sdk/src/test/resources/UnknownRequest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "UnknownRequest"
3 | }
4 |
--------------------------------------------------------------------------------
/custom-connector-example/salesforce-example-test-files/salesforce-insert-file.csv:
--------------------------------------------------------------------------------
1 | Name,Description
2 | aaron,first account!
--------------------------------------------------------------------------------
/images/appflow-console-home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-home.png
--------------------------------------------------------------------------------
/images/appflow-console-create-flow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-create-flow.png
--------------------------------------------------------------------------------
/images/appflow-console-connector-label.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-connector-label.png
--------------------------------------------------------------------------------
/images/appflow-console-connectors-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-connectors-page.png
--------------------------------------------------------------------------------
/images/appflow-console-lambda-function.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-lambda-function.png
--------------------------------------------------------------------------------
/images/appflow-console-test-connector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-test-connector.png
--------------------------------------------------------------------------------
/images/appflow-console-connection-details.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-connection-details.png
--------------------------------------------------------------------------------
/images/appflow-console-create-connection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-create-connection.png
--------------------------------------------------------------------------------
/custom-connector-sdk/src/test/resources/DescribeConnectorConfigurationRequest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "DescribeConnectorConfigurationRequest",
3 | "locale": "en-US"
4 | }
5 |
--------------------------------------------------------------------------------
/images/appflow-console-registered-connector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-registered-connector.png
--------------------------------------------------------------------------------
/images/appflow-console-custom-connectors-dropdown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-custom-connectors-dropdown.png
--------------------------------------------------------------------------------
/images/appflow-console-custom-connectors-view-details.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/awslabs/aws-appflow-custom-connector-java/HEAD/images/appflow-console-custom-connectors-view-details.png
--------------------------------------------------------------------------------
/custom-connector-sdk/src/test/resources/ValidateConnectorRuntimeSettingsRequest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "ValidateConnectorRuntimeSettingsRequest",
3 | "scope": "CONNECTOR_PROFILE",
4 | "connectorRuntimeSettings": {
5 | "instanceUrl": "https://www.example.com"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | ## Code of Conduct
2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4 | opensource-codeofconduct@amazon.com with any additional questions or comments.
--------------------------------------------------------------------------------
/custom-connector-example/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM public.ecr.aws/lambda/java:11
2 |
3 | # Copy function code and runtime dependencies from Maven layout
4 | COPY target/classes ${LAMBDA_TASK_ROOT}
5 | COPY target/dependency/* ${LAMBDA_TASK_ROOT}/lib/
6 |
7 | # Set the CMD to your handler
8 | CMD [ "com.amazonaws.appflow.custom.connector.example.handler.SalesforceLambdaHandler::handleRequest" ]
--------------------------------------------------------------------------------
/checkstyle-suppressions.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/test/resources/ValidateCredentialsRequest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "ValidateCredentialsRequest",
3 | "connectorRuntimeSettings": {
4 | "instanceUrl": "https://www.example.com"
5 | },
6 | "credentials": {
7 | "basicAuthCredentials": {
8 | "userName": "testUser",
9 | "password": "testPassword"
10 | },
11 | "apiKeyCredentials": null,
12 | "oAuth2Credentials": null,
13 | "customAuthCredentials": null
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/base-test-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourcePrefix": "string",
3 | "customConnectorConfigurations": [],
4 | "customConnectorProfileConfigurations": [],
5 | "testBucketConfiguration":
6 | {
7 | "bucketName":"string",
8 | "bucketPrefix":"string"
9 | },
10 | "listConnectorEntitiesTestConfigurations": [],
11 | "describeConnectorEntityTestConfigurations":[],
12 | "onDemandFromS3TestConfigurations": [],
13 | "onDemandToS3TestConfigurations": []
14 | }
--------------------------------------------------------------------------------
/custom-connector-example/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | %d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1} - %m%n
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/custom-connector-example/testng.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/test/resources/DescribeEntityRequest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "DescribeEntityRequest",
3 | "entityIdentifier": "testId",
4 | "connectorContext": {
5 | "connectorRuntimeSettings": {
6 | "instanceUrl": "https://www.example.com"
7 | },
8 | "credentials": {
9 | "basicAuthCredentials": {
10 | "userName": "testUser",
11 | "password": "testPassword"
12 | },
13 | "apiKeyCredentials": null,
14 | "oAuth2Credentials": null,
15 | "customAuthCredentials": null
16 | },
17 | "apiVersion": "V1.0",
18 | "entityDefinition": null
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/custom-connector-queryfilter/src/main/java/com/amazonaws/appflow/custom/connector/queryfilter/antlr/CustomConnectorQueryFilterLexer.tokens:
--------------------------------------------------------------------------------
1 | AND=1
2 | OR=2
3 | NOT=3
4 | TRUE=4
5 | FALSE=5
6 | GT=6
7 | GE=7
8 | LT=8
9 | LE=9
10 | EQ=10
11 | NE=11
12 | LIKE=12
13 | BETWEEN=13
14 | LPAREN=14
15 | RPAREN=15
16 | NULL=16
17 | IN=17
18 | LIMIT=18
19 | COMMA=19
20 | IDENTIFIER=20
21 | POS_INTEGER=21
22 | DECIMAL=22
23 | SINGLE_STRING=23
24 | DOUBLE_STRING=24
25 | EMPTY_SINGLE_STRING=25
26 | EMPTY_DOUBLE_STRING=26
27 | WS=27
28 | DATE=28
29 | DATETIME=29
30 | '>'=6
31 | '>='=7
32 | '<'=8
33 | '<='=9
34 | '='=10
35 | '!='=11
36 | '('=14
37 | ')'=15
38 | 'null'=16
39 | ','=19
40 |
--------------------------------------------------------------------------------
/custom-connector-queryfilter/src/main/java/com/amazonaws/appflow/custom/connector/queryfilter/antlr/CustomConnectorQueryFilterParser.tokens:
--------------------------------------------------------------------------------
1 | AND=1
2 | OR=2
3 | NOT=3
4 | TRUE=4
5 | FALSE=5
6 | GT=6
7 | GE=7
8 | LT=8
9 | LE=9
10 | EQ=10
11 | NE=11
12 | LIKE=12
13 | BETWEEN=13
14 | LPAREN=14
15 | RPAREN=15
16 | NULL=16
17 | IN=17
18 | LIMIT=18
19 | COMMA=19
20 | IDENTIFIER=20
21 | POS_INTEGER=21
22 | DECIMAL=22
23 | SINGLE_STRING=23
24 | DOUBLE_STRING=24
25 | EMPTY_SINGLE_STRING=25
26 | EMPTY_DOUBLE_STRING=26
27 | WS=27
28 | DATE=28
29 | DATETIME=29
30 | '>'=6
31 | '>='=7
32 | '<'=8
33 | '<='=9
34 | '='=10
35 | '!='=11
36 | '('=14
37 | ')'=15
38 | 'null'=16
39 | ','=19
40 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/test/resources/ListEntitiesRequest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "ListEntitiesRequest",
3 | "entitiesPath": "testPath",
4 | "maxResult": 1000,
5 | "nextToken": null,
6 | "connectorContext": {
7 | "connectorRuntimeSettings": {
8 | "instanceUrl": "https://www.example.com"
9 | },
10 | "credentials": {
11 | "basicAuthCredentials": {
12 | "userName": "testUser",
13 | "password": "testPassword"
14 | },
15 | "apiKeyCredentials": null,
16 | "oAuth2Credentials": null,
17 | "customAuthCredentials": null
18 | },
19 | "apiVersion": "V1.0",
20 | "entityDefinition": null
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/test/resources/RetrieveDataRequest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "RetrieveDataRequest",
3 | "entityIdentifier": "testIdentifier",
4 | "selectedFieldNames": null,
5 | "idFieldName": null,
6 | "ids": null,
7 | "connectorContext": {
8 | "connectorRuntimeSettings": {
9 | "instanceUrl": "https://www.example.com"
10 | },
11 | "credentials": {
12 | "basicAuthCredentials": {
13 | "userName": "testUser",
14 | "password": "testPassword"
15 | },
16 | "apiKeyCredentials": null,
17 | "oAuth2Credentials": null,
18 | "customAuthCredentials": null
19 | },
20 | "apiVersion": "V1.0",
21 | "entityDefinition": null
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/test/resources/QueryDataRequest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "QueryDataRequest",
3 | "entityIdentifier": "testIdentifier",
4 | "selectedFieldNames": null,
5 | "filterExpression": null,
6 | "nextToken": null,
7 | "connectorContext": {
8 | "connectorRuntimeSettings": {
9 | "instanceUrl": "https://www.example.com"
10 | },
11 | "credentials": {
12 | "basicAuthCredentials": {
13 | "userName": "testUser",
14 | "password": "testPassword"
15 | },
16 | "apiKeyCredentials": null,
17 | "oAuth2Credentials": null,
18 | "customAuthCredentials": null
19 | },
20 | "apiVersion": "V1.0",
21 | "entityDefinition": null
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/test/resources/WriteDataRequest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "WriteDataRequest",
3 | "entityIdentifier": "testIdentifier",
4 | "operation": "INSERT",
5 | "idFieldNames": null,
6 | "records": null,
7 | "allOrNone": null,
8 | "connectorContext": {
9 | "connectorRuntimeSettings": {
10 | "instanceUrl": "https://www.example.com"
11 | },
12 | "credentials": {
13 | "basicAuthCredentials": {
14 | "userName": "testUser",
15 | "password": "testPassword"
16 | },
17 | "apiKeyCredentials": null,
18 | "oAuth2Credentials": null,
19 | "customAuthCredentials": null
20 | },
21 | "apiVersion": "V1.0",
22 | "entityDefinition": null
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/.github/workflows/maven_build.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3 |
4 | name: BuildSDK
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | pull_request:
10 | branches: [ main ]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v3
19 | - name: Set up JDK 11
20 | uses: actions/setup-java@v3
21 | with:
22 | java-version: '11'
23 | distribution: 'temurin'
24 | cache: maven
25 | - name: Build src with Maven
26 | run: mvn compile -Dcheckstyle.skip
27 | - name: Build tst with Maven
28 | run: mvn test-compile -Dcheckstyle.skip
29 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/connectorconfiguration/TriggerType.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * Amazon AppFlow Custom Connector SDK
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.model.connectorconfiguration;
21 |
22 | /**
23 | * Enum for trigger type.
24 | */
25 | public enum TriggerType {
26 | SCHEDULED, ONDEMAND
27 | }
28 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/connectorconfiguration/auth/OAuth2CustomPropType.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-sdk
4 | * %%
5 | * Copyright (C) 2021 - 2022 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.model.connectorconfiguration.auth;
21 |
22 | public enum OAuth2CustomPropType {
23 |
24 | TOKEN_URL,
25 |
26 | AUTH_URL;
27 | }
28 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/connectorconfiguration/auth/OAuth2GrantType.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * Amazon AppFlow Custom Connector SDK
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.model.connectorconfiguration.auth;
21 |
22 | public enum OAuth2GrantType {
23 |
24 | CLIENT_CREDENTIALS,
25 |
26 | AUTHORIZATION_CODE;
27 | }
28 |
--------------------------------------------------------------------------------
/custom-connector-tests/src/main/java/com/amazonaws/appflow/custom/connector/tests/exceptions/ValidationException.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * custom-connector-tests
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.tests.exceptions;
21 |
22 | public class ValidationException extends RuntimeException {
23 | public ValidationException(final String message) {
24 | super(message);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/write/WriteOperationType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.write;
26 |
27 | /**
28 | * Enum for Write operation type.
29 | */
30 | public enum WriteOperationType {
31 | INSERT,
32 | UPDATE,
33 | UPSERT,
34 | DELETE
35 | }
36 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/main/java/com/amazonaws/appflow/custom/connector/integ/providers/DataProvider.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.integ.providers;
21 |
22 | /**
23 | * Interface that can be implemented as part of the destination flow test case in order to create the sample data
24 | * used in during flow execution.
25 | */
26 | public interface DataProvider {
27 |
28 | String GenerateData();
29 | }
30 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/main/java/com/amazonaws/appflow/custom/connector/integ/util/PollingConfiguration.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.integ.util;
21 |
22 | import org.immutables.value.Value;
23 |
24 | @Value.Immutable
25 | public interface PollingConfiguration {
26 | int maxPollTimeS();
27 |
28 | int timeBetweenPollsS();
29 |
30 | String executionId();
31 |
32 | String flowName();
33 | }
34 |
--------------------------------------------------------------------------------
/custom-connector-tests/src/main/java/com/amazonaws/appflow/custom/connector/tests/model/QueryRecordConfiguration.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * custom-connector-tests
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.tests.model;
21 |
22 | import lombok.Getter;
23 | import lombok.Setter;
24 |
25 | import java.util.List;
26 |
27 | @Getter
28 | @Setter
29 | public class QueryRecordConfiguration {
30 | String entityIdentifier;
31 | List selectedFieldNames;
32 | String filterExpression;
33 | }
34 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/connectorconfiguration/TriggerFrequency.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.connectorconfiguration;
26 |
27 | /**
28 | * Enum for Flow trigger frequency.
29 | */
30 | public enum TriggerFrequency {
31 | BYMINUTE,
32 | HOURLY,
33 | DAILY,
34 | WEEKLY,
35 | MONTHLY,
36 | ONCE
37 | }
38 |
--------------------------------------------------------------------------------
/custom-connector-tests/src/main/java/com/amazonaws/appflow/custom/connector/tests/model/RetrieveRecordConfiguration.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * custom-connector-tests
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.tests.model;
21 |
22 | import lombok.Getter;
23 | import lombok.Setter;
24 |
25 | import java.util.List;
26 |
27 | @Getter
28 | @Setter
29 | public class RetrieveRecordConfiguration {
30 | String entityIdentifier;
31 | List selectedFieldNames;
32 | String idFieldName;
33 | List ids;
34 | }
35 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/settings/ConnectorRuntimeSettingDataType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.settings;
26 |
27 | /**
28 | * Enum for connector runtime setting data type.
29 | */
30 | public enum ConnectorRuntimeSettingDataType {
31 | String,
32 | Date,
33 | DateTime,
34 | Long,
35 | Integer,
36 | Boolean,
37 | Url
38 | }
39 |
--------------------------------------------------------------------------------
/custom-connector-example/src/test/java/com/amazonaws/appflow/custom/connector/example/integ/SalesforceTestDataProvider.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.example.integ;
21 |
22 | import com.amazonaws.appflow.custom.connector.integ.providers.DataProvider;
23 |
24 | public class SalesforceTestDataProvider implements DataProvider {
25 |
26 | @Override
27 | public String GenerateData() {
28 | return "Name,Description\naaron,\"first account!\"";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/custom-connector-example/template.yml:
--------------------------------------------------------------------------------
1 | AWSTemplateFormatVersion: '2010-09-09'
2 | Transform: 'AWS::Serverless-2016-10-31'
3 | Description: Template to deploy the lambda connector in your account.
4 | Resources:
5 | Function:
6 | Type: 'AWS::Serverless::Function'
7 | Properties:
8 | Handler: "com.amazonaws.appflow.custom.connector.example.handler.SalesforceLambdaHandler::handleRequest"
9 | CodeUri: "./target/custom-connector-example-1.0.7.jar"
10 | Description: "Example for writing and deploying your AppFlow connector"
11 | Runtime: java8
12 | Timeout: 30
13 | MemorySize: 256
14 | Policies:
15 | Version: '2012-10-17'
16 | Statement:
17 | Effect: Allow
18 | Action: 'secretsmanager:GetSecretValue'
19 | Resource: !Sub 'arn:aws:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:appflow!${AWS::AccountId}--*'
20 | PolicyPermission:
21 | Type: 'AWS::Lambda::Permission'
22 | Properties:
23 | FunctionName: !GetAtt Function.Arn
24 | Action: lambda:InvokeFunction
25 | Principal: 'appflow.amazonaws.com'
26 | SourceAccount: !Ref 'AWS::AccountId'
27 | SourceArn: !Sub 'arn:aws:appflow:${AWS::Region}:${AWS::AccountId}:*'
28 |
--------------------------------------------------------------------------------
/custom-connector-queryfilter/src/main/java/com/amazonaws/appflow/custom/connector/queryfilter/InvalidFilterExpressionException.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * Amazon AppFlow Custom Connector SDK
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.queryfilter;
21 |
22 | /**
23 | * This exception is thrown when invalid filter expression as an input to the query expression parser
24 | */
25 | public class InvalidFilterExpressionException extends RuntimeException {
26 |
27 | public InvalidFilterExpressionException(final String msg) {
28 | super(msg, null);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/custom-connector-example/src/main/java/com/amazonaws/appflow/custom/connector/example/SalesforceResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.example;
26 |
27 | import org.immutables.value.Value;
28 |
29 | import javax.annotation.Nullable;
30 |
31 | /**
32 | * Class contains Salesforce response.
33 | */
34 | @Value.Immutable
35 | public interface SalesforceResponse {
36 | int statusCode();
37 |
38 | @Nullable
39 | String response();
40 |
41 | String errorReason();
42 | }
43 |
--------------------------------------------------------------------------------
/custom-connector-tests/src/main/java/com/amazonaws/appflow/custom/connector/tests/resources/TestLogger.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * custom-connector-tests
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.tests.resources;
21 |
22 | import com.amazonaws.services.lambda.runtime.LambdaLogger;
23 |
24 | public class TestLogger implements LambdaLogger {
25 | @Override
26 | public void log(final String message) {
27 | //Intentionally blank for tests
28 | }
29 |
30 | @Override
31 | public void log(final byte[] message) {
32 | //Intentionally blank for tests
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/connectorconfiguration/auth/OAuth2MethodType.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-sdk
4 | * %%
5 | * Copyright (C) 2021 - 2022 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.model.connectorconfiguration.auth;
21 |
22 | /**
23 | * OAuth2 Http method to use for the token request. AppFlow uses this when making login requests.
24 | * Default: POST
25 | */
26 | public enum OAuth2MethodType {
27 |
28 | /**
29 | * POST method type
30 | */
31 | HTTP_POST,
32 |
33 | /**
34 | * GET method type
35 | */
36 | HTTP_GET
37 | }
38 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/metadata/FieldDataType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.metadata;
26 |
27 | /**
28 | * Data Type of a field
29 | */
30 | public enum FieldDataType {
31 | String,
32 | Integer,
33 | Float,
34 | Double,
35 | Long,
36 | Short,
37 | BigInteger,
38 | BigDecimal,
39 | ByteArray,
40 | Boolean,
41 | Date,
42 | DateTime,
43 | Struct,
44 | Map,
45 | List
46 | }
47 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/main/java/com/amazonaws/appflow/custom/connector/integ/providers/AuthenticationType.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.integ.providers;
21 |
22 | /**
23 | * Authentication types supported by the SDK interface.
24 | */
25 | public enum AuthenticationType {
26 | OAUTH2("OAuth2"),
27 | BASIC("Basic"),
28 | API_KEY("ApiKey"),
29 | CUSTOM("Custom"),
30 | NO_AUTH("NoAuth");
31 |
32 | private final String type;
33 |
34 | AuthenticationType(final String type) {
35 | this.type = type;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/License and Notice.txt:
--------------------------------------------------------------------------------
1 | Amazon AppFlow Custom Connector Software Developer Kit License Agreement
2 | Copyright 2022 Amazon Web Services, Inc. or its affiliates. All Rights Reserved.
3 |
4 | By installing or using this software development kit ("Software"), you agree to
5 | the AWS Customer Agreement (https://aws.amazon.com/agreement) or other agreement
6 | with Amazon Web Services, Inc. ("AWS") governing your use of services provided by
7 | AWS, including the AWS Service Terms (https://aws.amazon.com/service-terms).
8 | The Software is AWS Content, and you may install and use the Software solely for
9 | the purpose of use with Amazon AppFlow in accordance with the Documentation.
10 |
11 | Certain components of the Software contain third party software programs which
12 | are governed by separate licenses, including but not limited to open source
13 | software licenses, identified in the included "THIRD PARTY ATTRIBUTIONS" file.
14 | Your rights and obligations with respect to these components are defined by the
15 | applicable software license, and nothing in this agreement will restrict, limit,
16 | or otherwise affect your rights or obligations under such software licenses.
17 |
18 |
19 | To learn more about the Amazon AppFlow Custom Connector Software Developer Kit see:
20 | https://docs.aws.amazon.com/appflow/
21 |
--------------------------------------------------------------------------------
/custom-connector-tests/src/main/java/com/amazonaws/appflow/custom/connector/tests/model/WriteRecordConfiguration.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * custom-connector-tests
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.tests.model;
21 |
22 | import com.amazonaws.appflow.custom.connector.model.write.WriteOperationType;
23 | import lombok.Getter;
24 | import lombok.Setter;
25 |
26 | import java.util.List;
27 |
28 | @Getter
29 | @Setter
30 | public class WriteRecordConfiguration {
31 | String entityIdentifier;
32 | WriteOperationType operation;
33 | List idFieldNames;
34 | List records;
35 | boolean allOrNone;
36 | }
37 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/credentials/AuthenticationType.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * Amazon AppFlow Custom Connector SDK
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.model.credentials;
21 |
22 | /**
23 | * Enum of Authentication Types.
24 | */
25 | public enum AuthenticationType {
26 | /**
27 | * Basic Authentication.
28 | */
29 | BasicAuth,
30 |
31 | /**
32 | * OAuth2 Authentication.
33 | */
34 | OAuth2,
35 |
36 | /**
37 | * ApiKey Authentication.
38 | */
39 | ApiKey,
40 |
41 | /**
42 | * Custom Authentication.
43 | */
44 | CustomAuth
45 | }
46 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/connectorconfiguration/auth/OAuth2ContentType.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-sdk
4 | * %%
5 | * Copyright (C) 2021 - 2022 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.model.connectorconfiguration.auth;
21 |
22 | /**
23 | * OAuth2 Content type to use in the token request header. AppFlow uses this when making login requests.
24 | * Default: URL_ENCODED
25 | */
26 | public enum OAuth2ContentType {
27 |
28 | /**
29 | * Content Type is: "application/x-www-form-urlencoded"
30 | */
31 | URL_ENCODED,
32 |
33 | /**
34 | * Content Type is: "application/json"
35 | */
36 | APPLICATION_JSON
37 | }
38 |
--------------------------------------------------------------------------------
/custom-connector-example/src/main/java/com/amazonaws/appflow/custom/connector/example/configuration/ConnectorSettingKey.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Example Custom Connector.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.example.configuration;
26 |
27 | /**
28 | * This class consists constants for Salesforce Connector setting keys.
29 | */
30 | public final class ConnectorSettingKey {
31 | private ConnectorSettingKey() {
32 | }
33 |
34 | public static final String INSTANCE_URL = "instanceUrl";
35 | public static final String API_VERSION = "api_version";
36 | public static final String IS_SANDBOX_ACCOUNT = "IsSandboxAccount";
37 | }
38 |
--------------------------------------------------------------------------------
/custom-connector-example/src/main/java/com/amazonaws/appflow/custom/connector/example/handler/SalesforceLambdaHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Example Custom Connector.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.example.handler;
26 |
27 | import com.amazonaws.appflow.custom.connector.lambda.handler.BaseLambdaConnectorHandler;
28 |
29 | /**
30 | * Lambda entry point for Salesforce.
31 | */
32 | public class SalesforceLambdaHandler extends BaseLambdaConnectorHandler {
33 |
34 | public SalesforceLambdaHandler() {
35 | super(new SalesforceMetadataHandler(), new SalesforceRecordHandler(), new SalesforceConfigurationHandler());
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/connectorconfiguration/DataTransferType.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-sdk
4 | * %%
5 | * Copyright (C) 2021 - 2023 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.model.connectorconfiguration;
21 |
22 | /**
23 | * Enum class representing the types of data transfers.
24 | */
25 | public enum DataTransferType {
26 | /**
27 | * Represents data transfer in the form of records. This type is used when data transfer involves structured records.
28 | */
29 | RECORD,
30 | /**
31 | * Represents data transfer in the form of files. This type is used when data transfer involves files or binary data.
32 | */
33 | FILE
34 | }
35 |
--------------------------------------------------------------------------------
/custom-connector-example/src/main/java/com/amazonaws/appflow/custom/connector/example/configuration/SupportedSalesforceVersion.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Example Custom Connector.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.example.configuration;
26 |
27 | /**
28 | * Enum of supported salesforce versions.
29 | */
30 | public enum SupportedSalesforceVersion {
31 | V51("v51.0");
32 |
33 | private final String versionNumber;
34 |
35 | SupportedSalesforceVersion(final String versionNumber) {
36 | this.versionNumber = versionNumber;
37 | }
38 |
39 | public String getVersionNumber() {
40 | return this.versionNumber;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/connectorconfiguration/ConnectorModes.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.connectorconfiguration;
26 |
27 | /**
28 | * Enumerates the supported connector Modes. Used by Connectors to declare the modes of operation a custom connector
29 | * supports.
30 | */
31 | public enum ConnectorModes {
32 | /**
33 | * Connector contains implementation for retrieveData and queryData.
34 | */
35 | SOURCE,
36 | /**
37 | * Connector contains implementation for writeData.
38 | */
39 | DESTINATION
40 | }
41 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/util/DataFormatValidationException.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-sdk
4 | * %%
5 | * Copyright (C) 2021 - 2023 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.util;
21 |
22 | /**
23 | * Exception that is thrown when the Data does not match the SDK format.
24 | */
25 | public class DataFormatValidationException extends Exception {
26 |
27 | public DataFormatValidationException() {
28 | super();
29 | }
30 |
31 | public DataFormatValidationException(final String message) {
32 | super(message);
33 | }
34 |
35 | public DataFormatValidationException(final String message, final Exception e) {
36 | super(message, e);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/main/java/com/amazonaws/appflow/custom/connector/integ/data/TestBucketConfiguration.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.integ.data;
21 |
22 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
23 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
24 | import org.immutables.value.Value;
25 |
26 | /**
27 | * Refer to sample-test-config.json
28 | */
29 | @Value.Immutable
30 | @JsonDeserialize(as = ImmutableTestBucketConfiguration.class)
31 | @JsonSerialize(as = ImmutableTestBucketConfiguration.class)
32 | public interface TestBucketConfiguration {
33 |
34 | String bucketName();
35 |
36 | String bucketPrefix();
37 | }
38 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/main/java/com/amazonaws/appflow/custom/connector/integ/data/CustomConnectorConfiguration.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.integ.data;
21 |
22 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
23 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
24 | import org.immutables.value.Value;
25 |
26 | import java.util.Optional;
27 |
28 | /**
29 | * Refer to sample-test-config.json
30 | */
31 | @Value.Immutable
32 | @JsonDeserialize(as = ImmutableCustomConnectorConfiguration.class)
33 | @JsonSerialize(as = ImmutableCustomConnectorConfiguration.class)
34 | public interface CustomConnectorConfiguration {
35 |
36 | String lambdaArn();
37 |
38 | String name();
39 |
40 | Optional validationFileName();
41 | }
42 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/credentials/BasicAuthCredentials.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.credentials;
26 |
27 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
28 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29 | import org.immutables.value.Value;
30 |
31 | /**
32 | * Credentials for Basic authentication.
33 | */
34 | @Value.Immutable
35 | @JsonSerialize(as = ImmutableBasicAuthCredentials.class)
36 | @JsonDeserialize(as = ImmutableBasicAuthCredentials.class)
37 | public interface BasicAuthCredentials {
38 | /**
39 | * Username.
40 | */
41 | String userName();
42 |
43 | /**
44 | * Password.
45 | */
46 | String password();
47 | }
48 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/credentials/ApiKeyCredentials.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.credentials;
26 |
27 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
28 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29 | import org.immutables.value.Value;
30 |
31 | import javax.annotation.Nullable;
32 |
33 | /**
34 | * Credentials for ApiKey authentication.
35 | */
36 | @Value.Immutable
37 | @JsonSerialize(as = ImmutableApiKeyCredentials.class)
38 | @JsonDeserialize(as = ImmutableApiKeyCredentials.class)
39 | public interface ApiKeyCredentials {
40 | /**
41 | * API key.
42 | */
43 | String apiKey();
44 |
45 | /**
46 | * Secret key.
47 | */
48 | @Nullable
49 | String secretKey();
50 | }
51 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/metadata/RangeConstraint.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.metadata;
26 |
27 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
28 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29 | import org.immutables.value.Value;
30 |
31 | import java.math.BigDecimal;
32 |
33 | /**
34 | * Represents the range for a field.
35 | */
36 | @Value.Immutable
37 | @JsonSerialize(as = ImmutableRangeConstraint.class)
38 | @JsonDeserialize(as = ImmutableRangeConstraint.class)
39 | public interface RangeConstraint {
40 | /**
41 | * Minimum value of the range.
42 | */
43 | BigDecimal minRange();
44 |
45 | /**
46 | * Maximum value of the range.
47 | */
48 | BigDecimal maxRange();
49 | }
50 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/main/java/com/amazonaws/appflow/custom/connector/integ/providers/TestCredentials.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.integ.providers;
21 |
22 | import com.amazonaws.appflow.custom.connector.model.credentials.Credentials;
23 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
24 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
25 | import org.immutables.value.Value;
26 |
27 | import java.util.Optional;
28 |
29 | /**
30 | * Contains the test credentials required to create the connector profile.
31 | */
32 | @Value.Immutable
33 | @JsonDeserialize(as = ImmutableTestCredentials.class)
34 | @JsonSerialize(as = ImmutableTestCredentials.class)
35 | public interface TestCredentials {
36 |
37 | Optional credentials();
38 |
39 | Optional clientId();
40 |
41 | Optional clientSecret();
42 | }
43 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/credentials/OAuth2Credentials.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.credentials;
26 |
27 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
28 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29 | import org.immutables.value.Value;
30 |
31 | import javax.annotation.Nullable;
32 |
33 | /**
34 | * Credentials for OAuth2 authentication.
35 | */
36 | @Value.Immutable
37 | @JsonSerialize(as = ImmutableOAuth2Credentials.class)
38 | @JsonDeserialize(as = ImmutableOAuth2Credentials.class)
39 | public interface OAuth2Credentials {
40 | /**
41 | * Access Token.
42 | */
43 | String accessToken();
44 |
45 | /**
46 | * Refresh Token.
47 | */
48 | @Nullable
49 | String refreshToken();
50 | }
51 |
--------------------------------------------------------------------------------
/custom-connector-example/salesforce-example-test-files/test-file-3.json:
--------------------------------------------------------------------------------
1 | {
2 | "customConnectorConfigurations": [
3 | {
4 | "name": "connector1",
5 | "lambdaArn": "arn:aws:lambda:us-west-2:*********:function:custom-connector-function-xomoZvWcPYLp",
6 | "validationFileName": "describe-connector-validation-file.json"
7 | }
8 | ],
9 | "customConnectorProfileConfigurations": [
10 | {
11 | "connectorName": "connector1",
12 | "name": "profile1",
13 | "profileProperties": {
14 | "api_version": "v51.0",
15 | "instanceUrl": "https://*********.my.salesforce.com"
16 | },
17 | "defaultApiVersion": "v51.0",
18 | "authenticationType": "OAUTH2",
19 | "oAuth2Properties": {
20 | "oAuth2GrantType": "CLIENT_CREDENTIALS",
21 | "tokenUrl": "https://login.salesforce.com/services/oauth2/token",
22 | "refreshUrl":"https://login.salesforce.com/services/oauth2/token"
23 | },
24 | "secretsManagerArn": "arn:aws:secretsmanager:us-west-2:*********:secret:custom-connector-qrSqOc"
25 | }
26 | ],
27 | "testBucketConfiguration": {
28 | "bucketName": "cvs-beta",
29 | "bucketPrefix": ""
30 | },
31 | "listConnectorEntitiesTestConfigurations": [
32 | {
33 | "validationFileName": "list-entities-validation-file.json"
34 | }
35 | ],
36 | "describeConnectorEntityTestConfigurations": [
37 | {
38 | "validationFileName": "describe-connector-entity-validation-file.json",
39 | "entityName" : "Account"
40 | }
41 | ],
42 | "onDemandFromS3TestConfigurations": [
43 | ],
44 | "onDemandToS3TestConfigurations": [
45 | ]
46 | }
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/Constants.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * Amazon AppFlow Custom Connector SDK
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector;
21 |
22 | public final class Constants {
23 | private Constants(){
24 | }
25 |
26 | public static final Long MAX_RESULT_SIZE = 1000L;
27 | public static final String AUTHENTICATION_TYPE = "authenticationType";
28 |
29 | //BasicAuthCredentials Constants
30 | public static final String USERNAME = "username";
31 | public static final String PASSWORD = "password";
32 |
33 | //ApiKeyCredentials Constants
34 | public static final String API_KEY = "apiKey";
35 | public static final String SECRET_KEY = "apiSecretKey";
36 |
37 | //OAuth2Credentials Constants
38 | public static final String ACCESS_TOKEN = "accessToken";
39 |
40 | //CustomAuthCredentials Constant
41 | public static final String CUSTOM_AUTHENTICATION_TYPE = "customAuthenticationType";
42 | }
43 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/main/java/com/amazonaws/appflow/custom/connector/integ/data/ListConnectorEntitiesTestConfiguration.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.integ.data;
21 |
22 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
23 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
24 | import org.immutables.value.Value;
25 |
26 | import java.util.Optional;
27 |
28 | /**
29 | * Refer to sample-test-config.json
30 | */
31 | @Value.Immutable
32 | @JsonDeserialize(as = ImmutableListConnectorEntitiesTestConfiguration.class)
33 | @JsonSerialize(as = ImmutableListConnectorEntitiesTestConfiguration.class)
34 | public interface ListConnectorEntitiesTestConfiguration {
35 | Optional entitiesPath();
36 |
37 | Optional validationFileName();
38 |
39 | Optional profileName();
40 |
41 | Optional testName();
42 |
43 | Optional apiVersion();
44 | }
45 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/main/java/com/amazonaws/appflow/custom/connector/integ/data/DescribeConnectorEntityTestConfiguration.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.integ.data;
21 |
22 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
23 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
24 | import org.immutables.value.Value;
25 |
26 | import java.util.Optional;
27 |
28 | /**
29 | * Refer to sample-test-config.json
30 | */
31 | @Value.Immutable
32 | @JsonDeserialize(as = ImmutableDescribeConnectorEntityTestConfiguration.class)
33 | @JsonSerialize(as = ImmutableDescribeConnectorEntityTestConfiguration.class)
34 | public interface DescribeConnectorEntityTestConfiguration {
35 |
36 | String entityName();
37 |
38 | Optional validationFileName();
39 |
40 | Optional profileName();
41 |
42 | Optional testName();
43 |
44 | Optional apiVersion();
45 | }
46 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/connectorconfiguration/auth/CustomAuthConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.connectorconfiguration.auth;
26 |
27 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
28 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29 | import org.immutables.value.Value;
30 |
31 | import java.util.List;
32 |
33 | /**
34 | * Represents the Custom authentication configuration.
35 | */
36 | @Value.Immutable
37 | @JsonSerialize(as = ImmutableCustomAuthConfig.class)
38 | @JsonDeserialize(as = ImmutableCustomAuthConfig.class)
39 | public interface CustomAuthConfig {
40 | /**
41 | * AuthenticationType string value defined by Connector.
42 | */
43 | String authenticationType();
44 |
45 | /**
46 | * List of Auth Parameters.
47 | */
48 | List authParameters();
49 | }
50 |
--------------------------------------------------------------------------------
/custom-connector-example/salesforce-example-test-files/describe-connector-entity-validation-file.json:
--------------------------------------------------------------------------------
1 | {
2 | "connectorEntityFields": [
3 | {
4 | "identifier": "Id",
5 | "label": "Account ID",
6 | "isPrimaryKey": false,
7 | "defaultValue": null,
8 | "isDeprecated": false,
9 | "supportedFieldTypeDetails": {
10 | "v1": {
11 | "fieldType": "String",
12 | "filterOperators": [
13 | "CONTAINS",
14 | "EQUAL_TO",
15 | "NOT_EQUAL_TO"
16 | ],
17 | "supportedValues": [
18 | ],
19 | "valueRegexPattern": null,
20 | "supportedDateFormat": null,
21 | "fieldValueRange": null,
22 | "fieldLengthRange": null
23 | }
24 | },
25 | "description": "Account ID",
26 | "sourceProperties": {
27 | "isRetrievable": true,
28 | "isQueryable": true,
29 | "isTimestampFieldForIncrementalQueries": false,
30 | "queryable": true,
31 | "retrievable": true,
32 | "timestampFieldForIncrementalQueries": false
33 | },
34 | "destinationProperties": {
35 | "isCreatable": false,
36 | "isNullable": false,
37 | "isUpsertable": false,
38 | "isUpdatable": false,
39 | "isDefaultedOnCreate": true,
40 | "supportedWriteOperations": [
41 | "UPSERT",
42 | "UPDATE"
43 | ],
44 | "defaultedOnCreate": true,
45 | "updatable": false,
46 | "nullable": false,
47 | "creatable": false,
48 | "upsertable": false
49 | },
50 | "customProperties": null,
51 | "primaryKey": false,
52 | "deprecated": false
53 | }
54 | ]
55 | }
--------------------------------------------------------------------------------
/custom-connector-tests/src/main/java/com/amazonaws/appflow/custom/connector/tests/model/TestConfig.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * custom-connector-tests
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.tests.model;
21 |
22 | import com.amazonaws.appflow.custom.connector.model.credentials.Credentials;
23 | import lombok.Getter;
24 | import lombok.NoArgsConstructor;
25 | import lombok.Setter;
26 |
27 | import java.util.List;
28 | import java.util.Map;
29 |
30 | @NoArgsConstructor
31 | @Getter
32 | @Setter
33 | public class TestConfig {
34 | RuntimeSettings runtimeSettings;
35 | Credentials credentials;
36 | String testEntityIdentifier;
37 | List retrieveRecordConfigurations;
38 | List writeRecordConfigurations;
39 | List queryRecordConfigurations;
40 |
41 | @Getter
42 | @Setter
43 | public static class RuntimeSettings {
44 | Map connectorProfile;
45 | Map source;
46 | Map destination;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/custom-connector-example/salesforce-example-test-files/list-entities-validation-file.json:
--------------------------------------------------------------------------------
1 | {
2 | "connectorEntityMap": {
3 | "Objects": [
4 | {
5 | "name": "AIApplication",
6 | "label": "AI Application",
7 | "hasNestedEntities": false
8 | },
9 | {
10 | "name": "AIApplicationConfig",
11 | "label": "AI Application config",
12 | "hasNestedEntities": false
13 | },
14 | {
15 | "name": "AIInsightAction",
16 | "label": "AI Insight Action",
17 | "hasNestedEntities": false
18 | },
19 | {
20 | "name": "AIInsightFeedback",
21 | "label": "AI Insight Feedback",
22 | "hasNestedEntities": false
23 | },
24 | {
25 | "name": "AIInsightReason",
26 | "label": "AI Insight Reason",
27 | "hasNestedEntities": false
28 | },
29 | {
30 | "name": "AIInsightValue",
31 | "label": "AI Insight Value",
32 | "hasNestedEntities": false
33 | },
34 | {
35 | "name": "AIPredictionEvent",
36 | "label": "AI Prediction Event",
37 | "hasNestedEntities": false
38 | },
39 | {
40 | "name": "AIRecordInsight",
41 | "label": "AI Record Insight",
42 | "hasNestedEntities": false
43 | },
44 | {
45 | "name": "AcceptedEventRelation",
46 | "label": "Accepted Event Relation",
47 | "hasNestedEntities": false
48 | },
49 | {
50 | "name": "Account",
51 | "label": "Account",
52 | "hasNestedEntities": false
53 | },
54 | {
55 | "name": "AccountChangeEvent",
56 | "label": "Account Change Event",
57 | "hasNestedEntities": false
58 | }
59 | ]
60 | }
61 | }
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/ErrorDetails.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model;
26 |
27 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
28 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29 | import org.immutables.value.Value;
30 |
31 | import javax.annotation.Nullable;
32 |
33 | /**
34 | * Represents the error details.
35 | */
36 | @Value.Immutable
37 | @JsonSerialize(as = ImmutableErrorDetails.class)
38 | @JsonDeserialize(as = ImmutableErrorDetails.class)
39 | public interface ErrorDetails {
40 | /**
41 | * Error Code.
42 | */
43 | ErrorCode errorCode();
44 |
45 | /**
46 | * Specifies the time delay in seconds after which operation can be retried.
47 | */
48 | @Nullable
49 | Integer retryAfterSeconds();
50 |
51 | /**
52 | * Detailed error message corresponding to the error code.
53 | */
54 | String errorMessage();
55 | }
56 |
--------------------------------------------------------------------------------
/custom-connector-example/src/main/java/com/amazonaws/appflow/custom/connector/example/query/QueryObject.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Example Custom Connector.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.example.query;
26 |
27 | import com.amazonaws.appflow.custom.connector.model.metadata.EntityDefinition;
28 | import org.immutables.value.Value;
29 |
30 | import javax.annotation.Nullable;
31 | import java.util.List;
32 |
33 | /**
34 | * Class contains all the information to build query. It might be deleted or method implementations might be changed
35 | * after adding Antlr parser code.
36 | */
37 | @Value.Immutable
38 | public interface QueryObject {
39 |
40 | String sObject();
41 |
42 | @Nullable
43 | List selectedFieldNames();
44 |
45 | @Nullable
46 | String filterExpression();
47 |
48 | @Nullable
49 | String idFieldName();
50 |
51 | @Nullable
52 | List fields();
53 |
54 | @Nullable
55 | String dataType();
56 |
57 | @Nullable
58 | EntityDefinition entityDefinition();
59 | }
60 |
--------------------------------------------------------------------------------
/ChangeLog.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 |
7 | ## [Unreleased]
8 | ## [1.0.9] - 2023-02-28
9 | ### Added
10 | - Added support for `LIMIT` in the query filter expression.
11 | - Added a JSON validator to validate that objects match the SDK format.
12 | - Added `Url` type in the ConnectorRuntimeSettingDataType.
13 | - Added `DataTransferType` ENUM and added supportedDataTransferTypes in DescribeConnectorConfigurationResponse
14 |
15 | ## [1.0.8] - 2022-12-21
16 | ### Added
17 | - Added support for subfields delimited by periods.
18 |
19 | ## [1.0.7] - 2022-10-21
20 | ### Added
21 | - Added support for Entity specific custom properties.
22 |
23 | ## [1.0.6] - 2022-08-16
24 | ### Added
25 | - Basic auth support for OAuth2. We need to add Base64 encoded Basic Auth header while making OAuth2 request in OAuth2 retrieve token scheme.
26 | - Removed ConnectorContext from validate creds request
27 | - Made api version nullable
28 | - Removed api version from connector runtime settings
29 | - Allowed hypen to be present in field names while generating the filter query
30 |
31 | ## [1.0.5] - 2022-05-27
32 | ### Added
33 | - Added OAuth2 enhancements like connector can define the EntityType and MethodType to get the token.
34 | - Added flag to support entity can be used as destination or not.
35 |
36 | ## [1.0.2] - 2022-03-04
37 | ### Added
38 | - Added ErrorCode for ResourceNotFound like AWS SecretManagerARN etc.
39 |
40 | ## [1.0.1] - 2022-03-01
41 | ### Added
42 | - Added ErrorCode for partial write failures.
43 |
44 | ### Changed
45 | - Updated documentation for `allOrNone` field in WriteDataRequest.
46 | - Updated documentation for `isSuccess` field in WriteDataResponse.
--------------------------------------------------------------------------------
/custom-connector-tests/src/main/java/com/amazonaws/appflow/custom/connector/tests/invokers/ConnectorTestInvoker.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * custom-connector-tests
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.tests.invokers;
21 |
22 | /**
23 | * This interface defines the functionality that is required for testing custom connector implementation.
24 | * The tests must verify behavior of all three handlers along with some implementation specific validations.
25 | */
26 | public interface ConnectorTestInvoker {
27 |
28 | /**
29 | * Tests for the ConfigurationHandler. This includes verifying behaviour of ValidateCredentials,
30 | * ValidateConnectorRuntimeSetting and DescribeConnectorConfiguration.
31 | */
32 | void invokeConfigurationHandlerTests();
33 |
34 | /**
35 | * Tests for the MetadataHandler. This includes verifying behaviour of ListEntities and DescribeEntity.
36 | */
37 | void invokeMetadataHandlerTests();
38 |
39 | /**
40 | * Tests for the RecordHandler. This includes verifying behaviour of RetrieveData, WriteData and QueryData.
41 | */
42 | void invokeRecordHandlerTests();
43 | }
44 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/credentials/ValidateCredentialsResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.credentials;
26 |
27 | import com.amazonaws.appflow.custom.connector.model.ErrorDetails;
28 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
29 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
30 | import org.immutables.value.Value;
31 |
32 | import javax.annotation.Nullable;
33 |
34 | /**
35 | * Represents the output of a ValidateCredentials> operation.
36 | */
37 | @Value.Immutable
38 | @JsonSerialize(as = ImmutableValidateCredentialsResponse.class)
39 | @JsonDeserialize(as = ImmutableValidateCredentialsResponse.class)
40 | public interface ValidateCredentialsResponse {
41 | /**
42 | * Specifies if the operation is successful or not.
43 | */
44 | boolean isSuccess();
45 |
46 | /**
47 | * Error details if the Operation is unsuccessful.
48 | */
49 | @Nullable
50 | ErrorDetails errorDetails();
51 | }
52 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/write/WriteRecordResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.write;
26 |
27 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
28 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29 | import org.immutables.value.Value;
30 |
31 | import javax.annotation.Nullable;
32 |
33 | /**
34 | * Contains write result whether it is successful or not at record level.
35 | */
36 | @Value.Immutable
37 | @JsonSerialize(as = ImmutableWriteRecordResult.class)
38 | @JsonDeserialize(as = ImmutableWriteRecordResult.class)
39 | public interface WriteRecordResult {
40 | /**
41 | * Specifies if the record is written successfully or not.
42 | */
43 | boolean isSuccess();
44 |
45 | /**
46 | * Unique identifier for the record.
47 | */
48 | String recordId();
49 |
50 | /**
51 | * Error message if the record is not written to the destination successfully.
52 | */
53 | @Nullable
54 | String errorMessage();
55 | }
56 |
--------------------------------------------------------------------------------
/custom-connector-tests/src/main/configuration/TestConfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "runtimeSettings": {
3 | "connectorProfile": {
4 | "instanceUrl": "https://amazon-1de-dev-ed.my.salesforce.com",
5 | "credentialsArn": "CredentialsArn",
6 | "api_version": "v51.0"
7 | }
8 | },
9 | "credentials": {
10 | "secretArn": ""
11 | "authenticationType":""
12 | }
13 | },
14 | "testEntityIdentifier": "Account",
15 | "retrieveRecordConfigurations": [
16 | {
17 | "entityIdentifier": "Account",
18 | "selectedFieldNames": [
19 | "Name",
20 | "AccountNumber"
21 | ],
22 | "idFieldName": "AccountNumber",
23 | "ids": [
24 | "12345"
25 | ]
26 | }
27 | ],
28 | "writeRecordConfigurations": [
29 | {
30 | "entityIdentifier": "Account",
31 | "operation": "INSERT",
32 | "idFieldNames": [],
33 | "records": [
34 | "{\"Name\": \"TestAccount\"}"
35 | ],
36 | "allOrNone": false
37 | },
38 | {
39 | "entityIdentifier": "Account",
40 | "operation": "UPDATE",
41 | "idFieldNames": ["Id"],
42 | "records": [
43 | "{\"Name\": \"UpdateOperationTest\", \"Id\": \"0015e00000USsUgAAL\"}"
44 | ],
45 | "allOrNone": false
46 | },
47 | {
48 | "entityIdentifier": "Account",
49 | "operation": "UPSERT",
50 | "idFieldNames": ["ExternalId__c"],
51 | "records": [
52 | "{\"Name\": \"UpsertOperationTestAccount\", \"ExternalId__c\": \"Identifier123\"}"
53 | ],
54 | "allOrNone": false
55 | }
56 | ],
57 | "queryRecordConfigurations": [
58 | {
59 | "entityIdentifier": "Account",
60 | "selectedFieldNames": [
61 | "Name",
62 | "AccountNumber"
63 | ],
64 | "filterExpression": "Name contains \"Test\""
65 | }
66 | ]
67 | }
68 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/ConnectorRequestStyle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model;
26 |
27 | import com.fasterxml.jackson.annotation.JsonTypeInfo;
28 | import com.fasterxml.jackson.annotation.JsonTypeName;
29 | import org.immutables.value.Value;
30 |
31 | import java.lang.annotation.ElementType;
32 | import java.lang.annotation.Retention;
33 | import java.lang.annotation.RetentionPolicy;
34 | import java.lang.annotation.Target;
35 |
36 | /**
37 | * Annotation to customize code generated for immutable values.
38 | */
39 | @Target(ElementType.TYPE)
40 | @Retention(RetentionPolicy.CLASS)
41 | @Value.Style (
42 | visibility = Value.Style.ImplementationVisibility.PUBLIC, // Generated class will be always public
43 | isInitialized = "wasInitialized", // Converting immutable internal method to avoid mapper deserialization issue
44 | create = "new",
45 | passAnnotations = {JsonTypeInfo.class, JsonTypeName.class},
46 | jdkOnly = true
47 | )
48 | public @interface ConnectorRequestStyle {
49 | }
50 |
--------------------------------------------------------------------------------
/custom-connector-example/salesforce-example-test-files/test-file-2.json:
--------------------------------------------------------------------------------
1 | {
2 | "customConnectorConfigurations":[
3 | {
4 | "name":"connector1",
5 | "lambdaArn":"arn:aws:lambda:us-west-2:*********:function:custom-connector-function-xomoZvWcPYLp"
6 | }
7 | ],
8 | "customConnectorProfileConfigurations":[
9 | {
10 | "connectorName":"connector1",
11 | "name":"profile1",
12 | "profileProperties":{
13 | "api_version":"v51.0",
14 | "instanceUrl":"https://*********.my.salesforce.com"
15 | },
16 | "defaultApiVersion": "v51.0",
17 | "authenticationType":"OAUTH2",
18 | "oAuth2Properties":{
19 | "oAuth2GrantType":"CLIENT_CREDENTIALS",
20 | "tokenUrl":"https://login.salesforce.com/services/oauth2/token",
21 | "refreshUrl":"https://login.salesforce.com/services/oauth2/token"
22 | },
23 | "secretsManagerArn":"arn:aws:secretsmanager:us-west-2:*********:secret:custom-connector-qrSqOc"
24 | }
25 | ],
26 | "testBucketConfiguration":
27 | {
28 | "bucketName":"cvs-beta",
29 | "bucketPrefix":""
30 | },
31 | "listConnectorEntitiesTestConfigurations":[
32 |
33 | ],
34 | "describeConnectorEntityTestConfigurations":[
35 |
36 | ],
37 | "onDemandFromS3TestConfigurations":[
38 | {
39 | "flowName": "flow4",
40 | "entityName":"Account",
41 | "writeOperationType": "INSERT",
42 | "dataGeneratorClassName":"com.amazonaws.appflow.custom.connector.example.integ.SalesforceTestDataProvider",
43 | "destinationRuntimeSettings": {}
44 | },
45 | {
46 | "flowName": "flow2",
47 | "entityName":"Account",
48 | "writeOperationType": "INSERT",
49 | "sourceDataFile":"salesforce-insert-file.csv",
50 | "destinationRuntimeSettings": {}
51 | }
52 | ],
53 | "onDemandToS3TestConfigurations":[
54 |
55 | ]
56 | }
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/CacheControl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model;
26 |
27 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
28 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29 | import org.immutables.value.Value;
30 |
31 | import javax.annotation.Nullable;
32 | import java.util.concurrent.TimeUnit;
33 |
34 | /**
35 | * Represents the caching policy for metadata for the supported entities.
36 | */
37 | @Value.Immutable
38 | @JsonSerialize(as = ImmutableCacheControl.class)
39 | @JsonDeserialize(as = ImmutableCacheControl.class)
40 | public interface CacheControl {
41 |
42 | /**
43 | * Time to keep the metadata in cache.
44 | *
45 | * Return a large number when entity metadata is not dynamic and can
46 | * be cached for long time. The minimum allowed value is 600 seconds.
47 | */
48 | long timeToLive();
49 |
50 | /**
51 | * TimeUnit for the timeToLive.
52 | */
53 | @Nullable
54 | TimeUnit timeToLiveUnit();
55 | }
56 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/settings/ConnectorRuntimeSettingScope.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.settings;
26 |
27 | /**
28 | * Defines the scope for a given connector runtime setting. All connector runtime settings will be aggregated and will
29 | * be sent along with every function invocation on the connector.
30 | */
31 | public enum ConnectorRuntimeSettingScope {
32 | /**
33 | * Settings to be populated during connector profile creation
34 | */
35 | CONNECTOR_PROFILE,
36 |
37 | /**
38 | * Setting to be populated during a flow creation if the connector is chosen as a source connector.
39 | */
40 | SOURCE,
41 |
42 | /**
43 | * Setting to be populated during a flow creation if the connector is chosen as a destination connector.
44 | */
45 | DESTINATION,
46 |
47 | /**
48 | * Setting to be populated during a flow creation if the connector is chosen either as a source or a destination
49 | * connector.
50 | */
51 | SOURCE_AND_DESTINATION
52 | }
53 |
--------------------------------------------------------------------------------
/custom-connector-sdk/src/main/java/com/amazonaws/appflow/custom/connector/model/metadata/EntityDefinition.java:
--------------------------------------------------------------------------------
1 | /*
2 | * -
3 | * * #%L
4 | * * Amazon AppFlow Custom Connector SDK.
5 | * *
6 | * %%
7 | * Copyright (C) 2021 Amazon Web Services
8 | * *
9 | * %%
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
14 | * http://www.apache.org/licenses/LICENSE-2.0
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | * #L%
22 | *
23 | */
24 |
25 | package com.amazonaws.appflow.custom.connector.model.metadata;
26 |
27 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
28 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29 | import org.immutables.value.Value;
30 |
31 | import javax.annotation.Nullable;
32 | import java.util.List;
33 | import java.util.Map;
34 |
35 | /**
36 | * Data model of the Entity.
37 | */
38 | @Value.Immutable
39 | @JsonSerialize(as = ImmutableEntityDefinition.class)
40 | @JsonDeserialize(as = ImmutableEntityDefinition.class)
41 | public interface EntityDefinition {
42 | /**
43 | * Contains its name, description, label or if it has child properties or not.
44 | */
45 | Entity entity();
46 |
47 | /**
48 | * List of data models of the fields an Entity has.
49 | */
50 | List fields();
51 |
52 | /**
53 | * Custom properties defined for an Entity.
54 | */
55 | @Nullable
56 | Map customProperties();
57 | }
58 |
--------------------------------------------------------------------------------
/custom-connector-integ-test/src/main/java/com/amazonaws/appflow/custom/connector/integ/data/OnDemandToS3TestConfiguration.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * aws-custom-connector-integ-test
4 | * %%
5 | * Copyright (C) 2021 Amazon Web Services
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.amazonaws.appflow.custom.connector.integ.data;
21 |
22 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
23 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
24 | import org.immutables.value.Value;
25 |
26 | import java.util.List;
27 | import java.util.Map;
28 | import java.util.Optional;
29 |
30 | /**
31 | * Refer to sample-test-config.json
32 | */
33 | @Value.Immutable
34 | @JsonDeserialize(as = ImmutableOnDemandToS3TestConfiguration.class)
35 | @JsonSerialize(as = ImmutableOnDemandToS3TestConfiguration.class)
36 | public interface OnDemandToS3TestConfiguration {
37 | Optional testName();
38 |
39 | Optional apiVersion();
40 |
41 | Optional profileName();
42 |
43 | String flowName();
44 |
45 | String entityName();
46 |
47 | Optional query();
48 |
49 | Optional flowTimeout();
50 |
51 | List entityFields();
52 |
53 | Optional outputSize();
54 |
55 | Optional