├── .coveragerc
├── .gitallowed
├── .github
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── maven-release.yaml
│ ├── pr-ci.yaml
│ └── pypi-release.yaml
├── .gitignore
├── .pre-commit-config.yaml
├── .pylintrc
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── MANIFEST.in
├── NOTICE
├── README.md
├── e2e_test.sh
├── licenseHeader
├── lombok.config
├── pom.xml
├── python
└── rpdk
│ └── java
│ ├── __init__.py
│ ├── codegen.py
│ ├── data
│ ├── build-image-src
│ │ ├── Dockerfile-java11
│ │ └── Dockerfile-java17
│ ├── java.gitignore
│ ├── jsonSchemas.xml
│ └── log4j2.xml
│ ├── resolver.py
│ ├── templates
│ ├── generate
│ │ ├── BaseConfiguration.java
│ │ ├── BaseHandler.java
│ │ ├── HandlerWrapper.java
│ │ ├── POJO.java
│ │ ├── ResourceModel.java
│ │ └── hook
│ │ │ ├── BaseHookConfiguration.java
│ │ │ ├── BaseHookHandler.java
│ │ │ ├── HookHandlerWrapper.java
│ │ │ ├── HookInputModel.java
│ │ │ ├── ResourceHookTarget.java
│ │ │ └── ResourceHookTargetModel.java
│ └── init
│ │ ├── default
│ │ ├── StubHandler.java
│ │ ├── StubHandlerTest.java
│ │ ├── StubHookHandler.java
│ │ ├── StubHookHandlerTest.java
│ │ ├── StubListHandler.java
│ │ └── StubListHandlerTest.java
│ │ ├── guided_aws
│ │ ├── AbstractTestBase.java
│ │ ├── BaseHandlerStd.java
│ │ ├── BaseHookHandlerStd.java
│ │ ├── ClientBuilder.java
│ │ ├── HookTranslator.java
│ │ ├── ResourceModel.java
│ │ ├── StubCreateHandler.java
│ │ ├── StubDeleteHandler.java
│ │ ├── StubHandlerTest.java
│ │ ├── StubListHandler.java
│ │ ├── StubListHandlerTest.java
│ │ ├── StubPreCreateHookHandler.java
│ │ ├── StubPreCreateHookHandlerTest.java
│ │ ├── StubPreDeleteHookHandler.java
│ │ ├── StubPreDeleteHookHandlerTest.java
│ │ ├── StubPreUpdateHookHandler.java
│ │ ├── StubPreUpdateHookHandlerTest.java
│ │ ├── StubReadHandler.java
│ │ ├── StubUpdateHandler.java
│ │ ├── TagHelper.java
│ │ └── Translator.java
│ │ └── shared
│ │ ├── CallbackContext.java
│ │ ├── README_HOOK.md
│ │ ├── README_RESOURCE.md
│ │ ├── StubConfiguration.java
│ │ ├── StubHookConfiguration.java
│ │ ├── lombok.config
│ │ └── pom.xml
│ └── utils.py
├── setup.cfg
├── setup.py
├── src
├── main
│ ├── java
│ │ └── software
│ │ │ └── amazon
│ │ │ └── cloudformation
│ │ │ ├── AbstractWrapper.java
│ │ │ ├── Action.java
│ │ │ ├── ExecutableWrapper.java
│ │ │ ├── HookAbstractWrapper.java
│ │ │ ├── HookExecutableWrapper.java
│ │ │ ├── HookInvocationPoint.java
│ │ │ ├── HookLambdaWrapper.java
│ │ │ ├── LambdaWrapper.java
│ │ │ ├── Response.java
│ │ │ ├── encryption
│ │ │ ├── Cipher.java
│ │ │ └── KMSCipher.java
│ │ │ ├── exceptions
│ │ │ ├── BaseHandlerException.java
│ │ │ ├── CfnAccessDeniedException.java
│ │ │ ├── CfnAlreadyExistsException.java
│ │ │ ├── CfnGeneralServiceException.java
│ │ │ ├── CfnHandlerInternalFailureException.java
│ │ │ ├── CfnInternalFailureException.java
│ │ │ ├── CfnInvalidCredentialsException.java
│ │ │ ├── CfnInvalidRequestException.java
│ │ │ ├── CfnInvalidTypeConfigurationException.java
│ │ │ ├── CfnNetworkFailureException.java
│ │ │ ├── CfnNonCompliantException.java
│ │ │ ├── CfnNotFoundException.java
│ │ │ ├── CfnNotStabilizedException.java
│ │ │ ├── CfnNotUpdatableException.java
│ │ │ ├── CfnResourceConflictException.java
│ │ │ ├── CfnServiceInternalErrorException.java
│ │ │ ├── CfnServiceLimitExceededException.java
│ │ │ ├── CfnThrottlingException.java
│ │ │ ├── CfnUnauthorizedTaggingOperationException.java
│ │ │ ├── CfnUnknownException.java
│ │ │ ├── CfnUnsupportedTargetException.java
│ │ │ ├── EncryptionException.java
│ │ │ ├── FileScrubberException.java
│ │ │ ├── ResourceAlreadyExistsException.java
│ │ │ ├── ResourceNotFoundException.java
│ │ │ ├── TerminalException.java
│ │ │ └── UnsupportedTargetException.java
│ │ │ ├── injection
│ │ │ ├── AmazonWebServicesProvider.java
│ │ │ ├── CloudFormationProvider.java
│ │ │ ├── CloudWatchEventsProvider.java
│ │ │ ├── CloudWatchLogsProvider.java
│ │ │ ├── CloudWatchProvider.java
│ │ │ ├── CredentialsProvider.java
│ │ │ └── SessionCredentialsProvider.java
│ │ │ ├── loggers
│ │ │ ├── CloudWatchLogHelper.java
│ │ │ ├── CloudWatchLogPublisher.java
│ │ │ ├── JavaLogPublisher.java
│ │ │ ├── LambdaLogPublisher.java
│ │ │ ├── LogFilter.java
│ │ │ └── LogPublisher.java
│ │ │ ├── metrics
│ │ │ ├── HookMetricsPublisherImpl.java
│ │ │ ├── Metric.java
│ │ │ ├── MetricsPublisher.java
│ │ │ └── MetricsPublisherImpl.java
│ │ │ ├── proxy
│ │ │ ├── AmazonWebServicesClientProxy.java
│ │ │ ├── CallChain.java
│ │ │ ├── CallGraphNameGenerator.java
│ │ │ ├── CallbackAdapter.java
│ │ │ ├── CloudFormationCallbackAdapter.java
│ │ │ ├── Credentials.java
│ │ │ ├── Delay.java
│ │ │ ├── DelayFactory.java
│ │ │ ├── ExceptionMessages.java
│ │ │ ├── HandlerErrorCode.java
│ │ │ ├── HandlerRequest.java
│ │ │ ├── HandlerResponse.java
│ │ │ ├── Logger.java
│ │ │ ├── LoggerProxy.java
│ │ │ ├── MetricsPublisherProxy.java
│ │ │ ├── OperationStatus.java
│ │ │ ├── ProgressEvent.java
│ │ │ ├── ProxyClient.java
│ │ │ ├── RequestContext.java
│ │ │ ├── RequestData.java
│ │ │ ├── ResourceHandlerRequest.java
│ │ │ ├── ResourceHandlerTestPayload.java
│ │ │ ├── StabilizationData.java
│ │ │ ├── StabilizationMode.java
│ │ │ ├── StdCallbackContext.java
│ │ │ ├── WaitStrategy.java
│ │ │ ├── aws
│ │ │ │ ├── AWSServiceSerdeModule.java
│ │ │ │ ├── SdkPojoDeserializer.java
│ │ │ │ └── SdkPojoSerializer.java
│ │ │ ├── delay
│ │ │ │ ├── AbstractDelay.java
│ │ │ │ ├── BaseBuilder.java
│ │ │ │ ├── Blended.java
│ │ │ │ ├── Builder.java
│ │ │ │ ├── CappedExponential.java
│ │ │ │ ├── Constant.java
│ │ │ │ ├── DelayBasedBuilder.java
│ │ │ │ ├── Exponential.java
│ │ │ │ ├── MinDelayAbstractBase.java
│ │ │ │ ├── MinDelayBasedBuilder.java
│ │ │ │ ├── MultipleOf.java
│ │ │ │ └── ShiftByMultipleOf.java
│ │ │ ├── hook
│ │ │ │ ├── HookContext.java
│ │ │ │ ├── HookHandlerRequest.java
│ │ │ │ ├── HookHandlerTestPayload.java
│ │ │ │ ├── HookInvocationRequest.java
│ │ │ │ ├── HookProgressEvent.java
│ │ │ │ ├── HookRequestContext.java
│ │ │ │ ├── HookRequestData.java
│ │ │ │ ├── HookStatus.java
│ │ │ │ └── targetmodel
│ │ │ │ │ ├── ChangedResource.java
│ │ │ │ │ ├── GenericHookTargetModel.java
│ │ │ │ │ ├── HookTarget.java
│ │ │ │ │ ├── HookTargetModel.java
│ │ │ │ │ ├── HookTargetType.java
│ │ │ │ │ ├── ResourceHookTarget.java
│ │ │ │ │ ├── ResourceHookTargetModel.java
│ │ │ │ │ └── StackHookTargetModel.java
│ │ │ └── package-info.java
│ │ │ ├── resource
│ │ │ ├── IdentifierUtils.java
│ │ │ ├── Serializer.java
│ │ │ └── TypeConverter.java
│ │ │ └── scheduler
│ │ │ ├── CloudWatchScheduler.java
│ │ │ └── CronHelper.java
│ └── resources
│ │ └── com
│ │ └── amazonaws
│ │ └── cloudformation
│ │ ├── checkstyle-suppressions.xml
│ │ ├── checkstyle.xml
│ │ ├── eclipse-java-formatter.xml
│ │ ├── intellij-codestyle.xml
│ │ ├── intellij-copyright-profile.xml
│ │ ├── log4j2.xml
│ │ ├── package.properties
│ │ └── spotbugs-suppressions.xml
└── test
│ ├── java
│ └── software
│ │ └── amazon
│ │ └── cloudformation
│ │ ├── ExecutableWrapperOverride.java
│ │ ├── ExecutableWrapperTest.java
│ │ ├── HookExecutableWrapperOverride.java
│ │ ├── HookExecutableWrapperTest.java
│ │ ├── HookLambdaWrapperOverride.java
│ │ ├── HookLambdaWrapperTest.java
│ │ ├── HookWrapperOverride.java
│ │ ├── HookWrapperTest.java
│ │ ├── LambdaWrapperOverride.java
│ │ ├── LambdaWrapperTest.java
│ │ ├── TestConfigurationModel.java
│ │ ├── TestContext.java
│ │ ├── TestModel.java
│ │ ├── WrapperOverride.java
│ │ ├── WrapperTest.java
│ │ ├── data
│ │ ├── create.request-with-stringified-resource.json
│ │ ├── create.request-without-caller-credentials.json
│ │ ├── create.request-without-logging-credentials.json
│ │ ├── create.request.json
│ │ ├── create.request.with-extraneous-model-fields.json
│ │ ├── create.request.with-extraneous-model-object.json
│ │ ├── create.request.with-extraneous-request-fields.json
│ │ ├── create.request.with-invalid-model-types.json
│ │ ├── create.request.with-new-credentials.json
│ │ ├── create.with-callback-context.request.json
│ │ ├── create.with-request-context.request.json
│ │ ├── create.without-callback-context.request.json
│ │ ├── delete.request.json
│ │ ├── delete.with-callback-context.request.json
│ │ ├── delete.with-request-context.request.json
│ │ ├── empty.request.json
│ │ ├── empty.resource.request.json
│ │ ├── hook
│ │ │ ├── empty.request.json
│ │ │ ├── preCreate.request-with-invalid-actionInvocationPoint.json
│ │ │ ├── preCreate.request-with-stringified.json
│ │ │ ├── preCreate.request-with-unencrypted-credentials.json
│ │ │ ├── preCreate.request-without-caller-credentials.json
│ │ │ ├── preCreate.request-without-encryption-key-arn.json
│ │ │ ├── preCreate.request-without-encryption-key-role.json
│ │ │ ├── preCreate.request-without-logging-credentials.json
│ │ │ ├── preCreate.request-without-target-model.json
│ │ │ ├── preCreate.request.json
│ │ │ ├── preCreate.request.with-new-credentials.json
│ │ │ ├── preCreate.request.with-resource-properties-and-extraneous-fields.json
│ │ │ ├── preCreate.request.with-resource-properties.json
│ │ │ ├── preCreate.request.with-stack-level-hook.json
│ │ │ ├── preCreate.with-request-context.request.json
│ │ │ ├── preDelete.request.json
│ │ │ ├── preDelete.with-request-context.request.json
│ │ │ ├── preUpdate.request.json
│ │ │ ├── preUpdate.with-request-context.request.json
│ │ │ └── test-target-schema.json
│ │ ├── list.request.json
│ │ ├── malformed.request.json
│ │ ├── no-response-endpoint.request.json
│ │ ├── read.request.json
│ │ ├── update.request.json
│ │ ├── update.with-callback-context.request.json
│ │ ├── update.with-request-context.request.json
│ │ └── update.without-callback-context.request.json
│ │ ├── encryption
│ │ └── KMSCipherTest.java
│ │ ├── exceptions
│ │ ├── CfnAccessDeniedExceptionTests.java
│ │ ├── CfnAlreadyExistsExceptionTests.java
│ │ ├── CfnGeneralServiceExceptionTests.java
│ │ ├── CfnHandlerInternalFailureExceptionTests.java
│ │ ├── CfnInternalFailureExceptionTests.java
│ │ ├── CfnInvalidCredentialsExceptionTests.java
│ │ ├── CfnInvalidRequestExceptionTests.java
│ │ ├── CfnInvalidTypeConfigurationExceptionTests.java
│ │ ├── CfnNetworkFailureExceptionTests.java
│ │ ├── CfnNonCompliantExceptionTests.java
│ │ ├── CfnNotFoundExceptionTests.java
│ │ ├── CfnNotStabilizedExceptionTests.java
│ │ ├── CfnNotUpdatableExceptionTests.java
│ │ ├── CfnServiceInternalErrorExceptionTests.java
│ │ ├── CfnServiceLimitExceededExceptionTests.java
│ │ ├── CfnThrottlingExceptionTests.java
│ │ ├── CfnUnauthorizedTaggingOperationExceptionTest.java
│ │ ├── CfnUnknownExceptionTests.java
│ │ └── CfnUnsupportedTargetExceptionTests.java
│ │ ├── loggers
│ │ ├── CloudWatchLogHelperTest.java
│ │ └── CloudWatchLogPublisherTest.java
│ │ ├── metrics
│ │ ├── HookMetricsPublisherImplTest.java
│ │ └── MetricsPublisherImplTest.java
│ │ ├── proxy
│ │ ├── AmazonWebServicesClientProxyTest.java
│ │ ├── CloudFormationCallbackAdapterTest.java
│ │ ├── DelayTest.java
│ │ ├── End2EndCallChainTest.java
│ │ ├── HookProgressEventTest.java
│ │ ├── ProgressEventTest.java
│ │ ├── StdCallackContextTest.java
│ │ ├── aws
│ │ │ └── AWSServiceSerdeTest.java
│ │ ├── handler
│ │ │ ├── CreateHandler.java
│ │ │ ├── Model.java
│ │ │ ├── ReadHandler.java
│ │ │ ├── ServiceHandlerWrapper.java
│ │ │ ├── TypeConfigurationModel.java
│ │ │ └── hook
│ │ │ │ ├── HookModel.java
│ │ │ │ ├── HookServiceHandlerWrapper.java
│ │ │ │ └── PreCreateHandler.java
│ │ ├── hook
│ │ │ └── targetmodel
│ │ │ │ ├── GenericTestResource.java
│ │ │ │ ├── GenericTestResourceHookTargetModel.java
│ │ │ │ ├── HookTargetModelTest.java
│ │ │ │ ├── TestResource.java
│ │ │ │ └── TestResourceHookTargetModel.java
│ │ └── service
│ │ │ ├── AccessDenied.java
│ │ │ ├── BadRequestException.java
│ │ │ ├── CreateRequest.java
│ │ │ ├── CreateResponse.java
│ │ │ ├── DescribeRequest.java
│ │ │ ├── DescribeResponse.java
│ │ │ ├── ExistsException.java
│ │ │ ├── NotFoundException.java
│ │ │ ├── Repository.java
│ │ │ ├── ServiceClient.java
│ │ │ └── ThrottleException.java
│ │ ├── resource
│ │ ├── IdentifierUtilsTest.java
│ │ ├── SerializerTest.java
│ │ └── TypeConverterTest.java
│ │ └── scheduler
│ │ ├── CloudWatchSchedulerTest.java
│ │ ├── CronHelperTest.java
│ │ ├── PutRuleRequestMatcher.java
│ │ ├── PutTargetsRequestMatcher.java
│ │ ├── TargetMatcher.java
│ │ └── TargetsListMatcher.java
│ └── resources
│ ├── mockito-extensions
│ └── org.mockito.plugins.MockMaker
│ └── software
│ └── amazon
│ └── cloudformation
│ ├── proxy
│ ├── handler
│ │ ├── hook
│ │ │ └── hookModel.json
│ │ └── model.json
│ └── hook
│ │ └── targetmodel
│ │ └── test-target-schema.json
│ └── wrapper-override.json
└── tests
├── __init__.py
├── data
├── area_definition.json
├── hook-schema-with-typeconfiguration.json
├── hook-schema-without-typeconfiguration.json
├── schema-with-typeconfiguration.json
└── schema-without-typeconfiguration.json
├── flattened_schema.py
├── test_codegen.py
├── test_resolver.py
└── test_utils.py
/.coveragerc:
--------------------------------------------------------------------------------
1 | [run]
2 | branch = True
3 |
4 | [report]
5 | fail_under = 100
6 |
--------------------------------------------------------------------------------
/.gitallowed:
--------------------------------------------------------------------------------
1 | # test secrets allowed for commit
2 | 123456789012
3 | GY6P5DGSX9Q4X7SYOW3T
4 | 1646136434112354328L
5 | 32IEHAHFIAG538KYASAI
6 | GT530IJDHALYZQSZZ8XG
7 | IASAYK835GAIFHAHEI23
8 | 0O2hop/5vllVHjbA8u52hK8rLcroZpnL5NPGOi66
9 | 66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0
10 | UeJEwC/dqcYEn2viFd5TjKjR5TaMOfdeHrlLXxQL
11 | HDI0745692Y45IUTYR78
12 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | *Issue #, if available:*
2 |
3 | *Description of changes:*
4 |
5 |
6 | By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
7 |
--------------------------------------------------------------------------------
/.github/workflows/maven-release.yaml:
--------------------------------------------------------------------------------
1 | # This workflow will put the project in our staging repo
2 | name: Releasing Project to maven
3 |
4 | on:
5 | release:
6 | types: [ published ]
7 |
8 | jobs:
9 | build:
10 | if: endsWith(github.ref, '-lib')
11 | env:
12 | AWS_DEFAULT_REGION: us-east-1
13 | AWS_REGION: us-east-1
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v2
17 | - name: Set up Java & publishing credentials
18 | uses: actions/setup-java@v1
19 | with:
20 | java-version: 17
21 | server-id: sonatype-nexus-staging # Value of the distributionManagement/repository/id field of the pom.xml
22 | server-username: SONATYPE_USERNAME # env variable for username in deploy
23 | server-password: SONATYPE_PASSWORD # env variable for token in deploy
24 | gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
25 | gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
26 | - name: Deploy to sonatype staging repo
27 | run: mvn deploy -Ppublishing
28 | env:
29 | SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
30 | SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
31 | MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
32 |
--------------------------------------------------------------------------------
/.github/workflows/pr-ci.yaml:
--------------------------------------------------------------------------------
1 | # This workflow will install dependencies, run tests for both plugin and library components
2 | name: CloudFormation CLI Java Plugin Pull Request CI
3 |
4 | on:
5 | push:
6 | branches: [ master ]
7 | pull_request:
8 | branches: [ master ]
9 |
10 | jobs:
11 | build:
12 | env:
13 | AWS_DEFAULT_REGION: us-east-1
14 | AWS_REGION: us-east-1
15 | strategy:
16 | matrix:
17 | python: ["3.9", "3.10", "3.11"]
18 | java: [17]
19 | runs-on: ubuntu-latest
20 | steps:
21 | - uses: actions/checkout@v2
22 | - name: Set up Python ${{ matrix.python }}
23 | uses: actions/setup-python@v2
24 | with:
25 | python-version: ${{ matrix.python }}
26 | - name: Set up Java ${{ matrix.java }}
27 | uses: actions/setup-java@v1
28 | with:
29 | java-version: ${{ matrix.java }}
30 | - name: Install python dependencies
31 | run: |
32 | pip install --upgrade 'attrs==19.2.0' wheel -r https://raw.githubusercontent.com/aws-cloudformation/cloudformation-cli/master/requirements.txt
33 | - name: Install cloudformation-cli-java-plugin
34 | run: |
35 | pip install .
36 | - name: Run pre-commit, twine checks for cloudformation-cli-java-plugin
37 | run: |
38 | pre-commit run --all-files
39 | python setup.py sdist bdist_wheel
40 | twine check ./dist/*
41 | - name: Verify java package
42 | run:
43 | mvn verify
44 | - name: Install java package
45 | run:
46 | mvn install
47 | - name: Integration standard e2e
48 | run:
49 | ./e2e_test.sh 1
50 | - name: Integration guided e2e
51 | run:
52 | ./e2e_test.sh 2
53 |
--------------------------------------------------------------------------------
/.github/workflows/pypi-release.yaml:
--------------------------------------------------------------------------------
1 | # This workflow will release project to PyPI
2 | name: CloudFormation CLI Java Plugin Release
3 |
4 | on:
5 | release:
6 | types: [ published ]
7 |
8 | jobs:
9 | build:
10 | if: endsWith(github.ref, '-plugin')
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v2
14 | - name: Set up Python 3.8
15 | uses: actions/setup-python@v2
16 | with:
17 | python-version: 3.8
18 | - name: Install dependencies
19 | run: |
20 | pip install --upgrade wheel twine
21 | - name: Package project
22 | run: |
23 | python setup.py sdist bdist_wheel
24 | - name: Publish distribution 📦 to PyPI (If triggered from release)
25 | uses: pypa/gh-action-pypi-publish@master
26 | with:
27 | password: ${{ secrets.PYPI_API_KEY_CLOUDFORMATION_CLI_JAVA_PLUGIN }}
28 |
--------------------------------------------------------------------------------
/.pylintrc:
--------------------------------------------------------------------------------
1 | [MASTER]
2 |
3 | ignore=CVS
4 | jobs=1
5 | persistent=yes
6 |
7 | [MESSAGES CONTROL]
8 |
9 | disable=
10 | missing-docstring, # not everything needs a docstring
11 | fixme, # work in progress
12 | bad-continuation, # clashes with black
13 | too-few-public-methods, # triggers when inheriting
14 | ungrouped-imports, # clashes with isort
15 | [BASIC]
16 |
17 | good-names=e,ex,f,fp,i,j,k,n,_
18 |
19 | [FORMAT]
20 |
21 | indent-string=' '
22 | max-line-length=88
23 |
--------------------------------------------------------------------------------
/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.
5 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include README.md
2 | include LICENSE
3 |
4 | graft python/rpdk/java
5 |
6 | # last rule wins, put excludes last
7 | global-exclude __pycache__ *.py[co] .DS_Store
8 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | CloudFormation CLI Java Plugin
2 | Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 |
--------------------------------------------------------------------------------
/e2e_test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | DIR=$(mktemp -d)
3 | cd "$DIR"
4 | ls -la
5 |
6 | printf "\n\n$1" | cfn init -t AWS::Foo::Bar -a RESOURCE -vv
7 | ls -la
8 | mvn verify
9 |
--------------------------------------------------------------------------------
/licenseHeader:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 |
--------------------------------------------------------------------------------
/lombok.config:
--------------------------------------------------------------------------------
1 | lombok.addLombokGeneratedAnnotation = true
2 |
--------------------------------------------------------------------------------
/python/rpdk/java/__init__.py:
--------------------------------------------------------------------------------
1 | import logging
2 |
3 | __version__ = "2.2.3"
4 |
5 | logging.getLogger(__name__).addHandler(logging.NullHandler())
6 |
--------------------------------------------------------------------------------
/python/rpdk/java/data/build-image-src/Dockerfile-java11:
--------------------------------------------------------------------------------
1 | FROM openjdk:11-alpine
2 | ARG executable_name
3 | ADD ${executable_name} handler.jar
4 | ENTRYPOINT ["java", "-Xmx512M", "-cp", "handler.jar"]
5 |
--------------------------------------------------------------------------------
/python/rpdk/java/data/build-image-src/Dockerfile-java17:
--------------------------------------------------------------------------------
1 | FROM openjdk:17-alpine
2 | ARG executable_name
3 | ADD ${executable_name} handler.jar
4 | ENTRYPOINT ["java", "-Xmx512M", "-cp", "handler.jar"]
5 |
--------------------------------------------------------------------------------
/python/rpdk/java/data/java.gitignore:
--------------------------------------------------------------------------------
1 | # macOS
2 | .DS_Store
3 | ._*
4 |
5 | # Maven outputs
6 | .classpath
7 |
8 | # IntelliJ
9 | *.iml
10 | .idea
11 | out.java
12 | out/
13 | .settings
14 | .project
15 |
16 | # auto-generated files
17 | target/
18 |
19 | # our logs
20 | rpdk.log*
21 |
22 | # contains credentials
23 | sam-tests/
24 |
--------------------------------------------------------------------------------
/python/rpdk/java/data/jsonSchemas.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/python/rpdk/java/data/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/generate/BaseConfiguration.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Modifications will be overwritten.
2 | package {{ package_name }};
3 |
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 |
7 | import java.util.Map;
8 | import org.json.JSONObject;
9 | import org.json.JSONTokener;
10 |
11 | @Data
12 | @AllArgsConstructor
13 | public abstract class BaseConfiguration {
14 |
15 | protected final String schemaFilename;
16 |
17 | public JSONObject resourceSchemaJSONObject() {
18 | return new JSONObject(new JSONTokener(this.getClass().getClassLoader().getResourceAsStream(schemaFilename)));
19 | }
20 |
21 | /**
22 | * Providers should override this method if their resource has a 'Tags' property to define resource-level tags
23 | * @return
24 | */
25 | public Map resourceDefinedTags(final {{ pojo_name }} resourceModel) {
26 | return null;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/generate/BaseHandler.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Modifications will be overwritten.
2 | package {{ package_name }};
3 |
4 | import software.amazon.cloudformation.proxy.AmazonWebServicesClientProxy;
5 | import software.amazon.cloudformation.proxy.Logger;
6 | import software.amazon.cloudformation.proxy.ProgressEvent;
7 | import software.amazon.cloudformation.proxy.ResourceHandlerRequest;
8 |
9 | public abstract class BaseHandler {
10 |
11 | public abstract ProgressEvent<{{ pojo_name }}, CallbackT> handleRequest(
12 | final AmazonWebServicesClientProxy proxy,
13 | final ResourceHandlerRequest<{{ pojo_name }}> request,
14 | final CallbackT callbackContext,
15 | final Logger logger{{ ',\n final ConfigurationT typeConfiguration' if contains_type_configuration }});
16 | }
17 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/generate/POJO.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Modifications will be overwritten.
2 | package {{ package_name }};
3 |
4 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
5 | import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
6 | import com.fasterxml.jackson.annotation.JsonIgnore;
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 | import java.util.Map;
9 | import java.util.List;
10 | import java.util.Set;
11 | import lombok.AllArgsConstructor;{{ '\nimport lombok.NoArgsConstructor;' if no_args_constructor_required }}
12 | import lombok.Builder;
13 | import lombok.Data;
14 |
15 | @Data
16 | @Builder
17 | @AllArgsConstructor{{ '\n@NoArgsConstructor' if no_args_constructor_required }}
18 | @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
19 | public class {{ model_name|uppercase_first_letter }} {
20 | {% for name, type in properties.items() %}
21 | @JsonProperty("{{ name }}")
22 | private {{ type|translate_type }} {{ name|lowercase_first_letter|safe_reserved }};
23 |
24 | {% endfor %}
25 | }
26 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/generate/hook/BaseHookHandler.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Modifications will be overwritten.
2 | package {{ package_name }};
3 |
4 | import software.amazon.cloudformation.proxy.Logger;
5 | import software.amazon.cloudformation.proxy.AmazonWebServicesClientProxy;
6 | import software.amazon.cloudformation.proxy.ProgressEvent;
7 | import software.amazon.cloudformation.proxy.hook.HookHandlerRequest;
8 | import software.amazon.cloudformation.proxy.hook.targetmodel.HookTargetModel;
9 |
10 | public abstract class BaseHookHandler {
11 |
12 | public abstract ProgressEvent handleRequest(
13 | final AmazonWebServicesClientProxy proxy,
14 | final HookHandlerRequest request,
15 | final CallbackT callbackContext,
16 | final Logger logger,
17 | final ConfigurationT typeConfiguration);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/generate/hook/HookInputModel.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Modifications will be overwritten.
2 | package {{ package_name }};
3 |
4 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
5 | import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
6 | import com.fasterxml.jackson.annotation.JsonIgnore;
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 | import java.util.Map;
9 | import java.util.List;
10 | import java.util.ArrayList;
11 | import java.util.Set;
12 | import lombok.AllArgsConstructor;
13 | import lombok.RequiredArgsConstructor;
14 | import lombok.Builder;
15 | import lombok.Data;
16 | import lombok.NoArgsConstructor;
17 | import org.json.JSONObject;
18 |
19 |
20 | @Data
21 | @Builder
22 | {% if properties.items()|length > 0 %}
23 | @AllArgsConstructor
24 | {% endif %}
25 | @NoArgsConstructor
26 | @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
27 | public class {{ model_name|uppercase_first_letter }} {
28 | @JsonIgnore
29 | public static final String TYPE_NAME = "{{ type_name }}";
30 |
31 | {% for name, type in properties.items() %}
32 | @JsonProperty("{{ name }}")
33 | private {{ type|translate_type }} {{ name|lowercase_first_letter|safe_reserved }};
34 | {% endfor %}
35 | }
36 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/default/StubHandler.java:
--------------------------------------------------------------------------------
1 | package {{ package_name }};
2 |
3 | import software.amazon.cloudformation.proxy.AmazonWebServicesClientProxy;
4 | import software.amazon.cloudformation.proxy.Logger;
5 | import software.amazon.cloudformation.proxy.ProgressEvent;
6 | import software.amazon.cloudformation.proxy.OperationStatus;
7 | import software.amazon.cloudformation.proxy.ResourceHandlerRequest;
8 |
9 | public class {{ operation }}Handler extends BaseHandler {
10 |
11 | @Override
12 | public ProgressEvent<{{ pojo_name }}, CallbackContext> handleRequest(
13 | final AmazonWebServicesClientProxy proxy,
14 | final ResourceHandlerRequest<{{ pojo_name }}> request,
15 | final CallbackContext callbackContext,
16 | final Logger logger) {
17 |
18 | final ResourceModel model = request.getDesiredResourceState();
19 |
20 | // TODO : put your code here
21 |
22 | return ProgressEvent.<{{ pojo_name }}, CallbackContext>builder()
23 | .resourceModel(model)
24 | .status(OperationStatus.SUCCESS)
25 | .build();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/default/StubListHandler.java:
--------------------------------------------------------------------------------
1 | package {{ package_name }};
2 |
3 | import software.amazon.cloudformation.proxy.AmazonWebServicesClientProxy;
4 | import software.amazon.cloudformation.proxy.Logger;
5 | import software.amazon.cloudformation.proxy.ProgressEvent;
6 | import software.amazon.cloudformation.proxy.OperationStatus;
7 | import software.amazon.cloudformation.proxy.ResourceHandlerRequest;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | public class {{ operation }}Handler extends BaseHandler {
13 |
14 | @Override
15 | public ProgressEvent<{{ pojo_name }}, CallbackContext> handleRequest(
16 | final AmazonWebServicesClientProxy proxy,
17 | final ResourceHandlerRequest<{{ pojo_name }}> request,
18 | final CallbackContext callbackContext,
19 | final Logger logger) {
20 |
21 | final List models = new ArrayList<>();
22 |
23 | // TODO : put your code here
24 |
25 | return ProgressEvent.<{{ pojo_name }}, CallbackContext>builder()
26 | .resourceModels(models)
27 | .status(OperationStatus.SUCCESS)
28 | .build();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/guided_aws/BaseHandlerStd.java:
--------------------------------------------------------------------------------
1 | package {{ package_name }};
2 |
3 | import software.amazon.awssdk.core.SdkClient;
4 | import software.amazon.cloudformation.proxy.AmazonWebServicesClientProxy;
5 | import software.amazon.cloudformation.proxy.Logger;
6 | import software.amazon.cloudformation.proxy.ProgressEvent;
7 | import software.amazon.cloudformation.proxy.ProxyClient;
8 | import software.amazon.cloudformation.proxy.ResourceHandlerRequest;
9 |
10 | // Placeholder for the functionality that could be shared across Create/Read/Update/Delete/List Handlers
11 |
12 | public abstract class BaseHandlerStd extends BaseHandler {
13 | @Override
14 | public final ProgressEvent handleRequest(
15 | final AmazonWebServicesClientProxy proxy,
16 | final ResourceHandlerRequest request,
17 | final CallbackContext callbackContext,
18 | final Logger logger) {
19 | return handleRequest(
20 | proxy,
21 | request,
22 | callbackContext != null ? callbackContext : new CallbackContext(),
23 | proxy.newProxy(ClientBuilder::getClient),
24 | logger
25 | );
26 | }
27 |
28 | protected abstract ProgressEvent handleRequest(
29 | final AmazonWebServicesClientProxy proxy,
30 | final ResourceHandlerRequest request,
31 | final CallbackContext callbackContext,
32 | final ProxyClient proxyClient,
33 | final Logger logger);
34 | }
35 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/guided_aws/ClientBuilder.java:
--------------------------------------------------------------------------------
1 | package {{ package_name }};
2 |
3 | import software.amazon.awssdk.core.SdkClient;
4 | // TODO: replace all usage of SdkClient with your service client type, e.g; YourServiceClient
5 | // import software.amazon.awssdk.services.yourservice.YourServiceClient;
6 | // import software.amazon.cloudformation.LambdaWrapper;
7 |
8 | public class ClientBuilder {
9 | /*
10 | TODO: uncomment the following, replacing YourServiceClient with your service client name
11 | It is recommended to use static HTTP client so less memory is consumed
12 | e.g. https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs/blob/master/aws-logs-loggroup/src/main/java/software/amazon/logs/loggroup/ClientBuilder.java#L9
13 |
14 | public static YourServiceClient getClient() {
15 | return YourServiceClient.builder()
16 | .httpClient(LambdaWrapper.HTTP_CLIENT)
17 | .build();
18 | }
19 | */
20 |
21 | // TODO: remove this implementation once you have uncommented the above
22 | public static SdkClient getClient() {
23 | return null;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/guided_aws/HookTranslator.java:
--------------------------------------------------------------------------------
1 | package {{ package_name }};
2 |
3 | import software.amazon.awssdk.awscore.AwsRequest;
4 | import software.amazon.cloudformation.proxy.hook.targetmodel.HookTargetModel;
5 |
6 | /**
7 | * This class is a centralized placeholder for
8 | * - api request construction
9 | * - object translation to/from aws sdk
10 | */
11 |
12 | public class Translator {
13 |
14 | /**
15 | * Request built from target model
16 | * @param targetModel target model
17 | * @return awsRequest the aws service request
18 | */
19 | static AwsRequest translateToRequest(final HookTargetModel targetModel) {
20 | final AwsRequest awsRequest = null;
21 | // TODO: construct a request
22 | // e.g. https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs/blob/2077c92299aeb9a68ae8f4418b5e932b12a8b186/aws-logs-loggroup/src/main/java/com/aws/logs/loggroup/Translator.java#L39-L43
23 |
24 | return awsRequest;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/shared/CallbackContext.java:
--------------------------------------------------------------------------------
1 | package {{ package_name }};
2 |
3 | import software.amazon.cloudformation.proxy.StdCallbackContext;
4 |
5 | @lombok.Getter
6 | @lombok.Setter
7 | @lombok.ToString
8 | @lombok.EqualsAndHashCode(callSuper = true)
9 | public class CallbackContext extends StdCallbackContext {
10 | }
11 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/shared/README_HOOK.md:
--------------------------------------------------------------------------------
1 | # {{ type_name }}
2 |
3 | Congratulations on starting development! Next steps:
4 |
5 | 1. Write the JSON schema describing your hook, `{{ schema_path.name }}`
6 | 1. Implement your hook handlers.
7 |
8 | The RPDK will automatically generate the correct hook input model from the schema whenever the project is built via Maven. You can also do this manually with the following command: `{{ executable }} generate`.
9 |
10 | > Please don't modify files under `target/generated-sources/rpdk`, as they will be automatically overwritten.
11 |
12 | The code uses [Lombok](https://projectlombok.org/), and [you may have to install IDE integrations](https://projectlombok.org/) to enable auto-complete for Lombok-annotated classes.
13 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/shared/README_RESOURCE.md:
--------------------------------------------------------------------------------
1 | # {{ type_name }}
2 |
3 | Congratulations on starting development! Next steps:
4 |
5 | 1. Write the JSON schema describing your resource, `{{ schema_path.name }}`
6 | 1. Implement your resource handlers.
7 |
8 | The RPDK will automatically generate the correct resource model from the schema whenever the project is built via Maven. You can also do this manually with the following command: `{{ executable }} generate`.
9 |
10 | > Please don't modify files under `target/generated-sources/rpdk`, as they will be automatically overwritten.
11 |
12 | The code uses [Lombok](https://projectlombok.org/), and [you may have to install IDE integrations](https://projectlombok.org/setup/overview) to enable auto-complete for Lombok-annotated classes.
13 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/shared/StubConfiguration.java:
--------------------------------------------------------------------------------
1 | package {{ package_name }};
2 |
3 | class Configuration extends BaseConfiguration {
4 |
5 | public Configuration() {
6 | super("{{ schema_file_name }}");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/shared/StubHookConfiguration.java:
--------------------------------------------------------------------------------
1 | package {{ package_name }};
2 |
3 | class Configuration extends BaseHookConfiguration {
4 |
5 | public Configuration() {
6 | super("{{ schema_file_name }}");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/python/rpdk/java/templates/init/shared/lombok.config:
--------------------------------------------------------------------------------
1 | lombok.addLombokGeneratedAnnotation = true
2 |
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 | [metadata]
2 | license_file = LICENSE
3 | description-file = README.md
4 |
5 | [flake8]
6 | exclude =
7 | .git,
8 | __pycache__,
9 | build,
10 | dist,
11 | *.pyc,
12 | *.egg-info,
13 | .cache,
14 | .eggs,
15 | .tox
16 | max-complexity = 10
17 | max-line-length = 80
18 | select = C,E,F,W,B,B950
19 | # C812, C815, W503 clash with black
20 | ignore = E501,C812,C815,W503
21 |
22 | [isort]
23 | line_length = 88
24 | indent = ' '
25 | multi_line_output = 3
26 | default_section = FIRSTPARTY
27 | skip = env
28 | include_trailing_comma = true
29 | combine_as_imports = True
30 | force_grid_wrap = 0
31 | known_first_party = rpdk
32 | known_third_party = boto3,botocore,jinja2,jsonschema,werkzeug,yaml,requests
33 |
34 | [tool:pytest]
35 | # can't do anything about 3rd party modules, so don't spam us
36 | filterwarnings =
37 | ignore::DeprecationWarning:botocore
38 | ignore::DeprecationWarning:werkzeug
39 | ignore::DeprecationWarning:yaml
40 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/Action.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation;
16 |
17 | public enum Action {
18 | CREATE,
19 | READ,
20 | UPDATE,
21 | DELETE,
22 | LIST
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/HookInvocationPoint.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation;
16 |
17 | public enum HookInvocationPoint {
18 | CREATE_PRE_PROVISION("PreCreate"),
19 | UPDATE_PRE_PROVISION("PreUpdate"),
20 | DELETE_PRE_PROVISION("PreDelete");
21 |
22 | private final String shortName;
23 |
24 | HookInvocationPoint(String shortName) {
25 | this.shortName = shortName;
26 | }
27 |
28 | public String getShortName() {
29 | return this.shortName;
30 | }
31 |
32 | public static HookInvocationPoint fromShortName(String shortName) {
33 | for (HookInvocationPoint e : HookInvocationPoint.values()) {
34 | if (e.shortName.equalsIgnoreCase(shortName)) {
35 | return e;
36 | }
37 | }
38 | throw new IllegalArgumentException("No HookInvocationPoint with short name " + shortName + " found.");
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/encryption/Cipher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.encryption;
16 |
17 | import software.amazon.cloudformation.proxy.Credentials;
18 |
19 | public interface Cipher {
20 |
21 | Credentials decryptCredentials(String encryptedCredentials);
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/BaseHandlerException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import lombok.Getter;
18 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
19 |
20 | @Getter
21 | public abstract class BaseHandlerException extends RuntimeException {
22 |
23 | private static final long serialVersionUID = -1646136434112354328L;
24 |
25 | private HandlerErrorCode errorCode;
26 |
27 | protected BaseHandlerException(final Throwable cause,
28 | final HandlerErrorCode errorCode) {
29 | super(cause.getMessage(), cause);
30 | this.errorCode = errorCode;
31 | }
32 |
33 | protected BaseHandlerException(final String message,
34 | final Throwable cause,
35 | final HandlerErrorCode errorCode) {
36 | super(message, cause);
37 | this.errorCode = errorCode;
38 | }
39 |
40 | protected BaseHandlerException(final String message,
41 | final HandlerErrorCode errorCode) {
42 | super(message);
43 | this.errorCode = errorCode;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnAccessDeniedException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnAccessDeniedException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.AccessDenied;
23 |
24 | public CfnAccessDeniedException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnAccessDeniedException(final String operation) {
29 | this(operation, null);
30 | }
31 |
32 | public CfnAccessDeniedException(final String operation,
33 | final Throwable cause) {
34 | super(String.format(ERROR_CODE.getMessage(), operation), cause, ERROR_CODE);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnAlreadyExistsException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnAlreadyExistsException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.AlreadyExists;
23 |
24 | public CfnAlreadyExistsException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnAlreadyExistsException(final String resourceTypeName,
29 | final String resourceIdentifier) {
30 | this(resourceTypeName, resourceIdentifier, null);
31 | }
32 |
33 | public CfnAlreadyExistsException(final String resourceTypeName,
34 | final String resourceIdentifier,
35 | final Throwable cause) {
36 | super(String.format(ERROR_CODE.getMessage(), resourceTypeName, resourceIdentifier), cause, ERROR_CODE);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnGeneralServiceException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnGeneralServiceException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.GeneralServiceException;
23 |
24 | public CfnGeneralServiceException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnGeneralServiceException(final String operation) {
29 | this(operation, null);
30 | }
31 |
32 | public CfnGeneralServiceException(final String operation,
33 | final Throwable cause) {
34 | super(String.format(ERROR_CODE.getMessage(), operation), cause, ERROR_CODE);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnHandlerInternalFailureException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnHandlerInternalFailureException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.HandlerInternalFailure;
23 |
24 | public CfnHandlerInternalFailureException() {
25 | this(null);
26 | }
27 |
28 | public CfnHandlerInternalFailureException(final Throwable cause) {
29 | super(ERROR_CODE.getMessage(), cause, ERROR_CODE);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnInternalFailureException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnInternalFailureException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.InternalFailure;
23 |
24 | public CfnInternalFailureException() {
25 | this(null);
26 | }
27 |
28 | public CfnInternalFailureException(final Throwable cause) {
29 | super(ERROR_CODE.getMessage(), cause, ERROR_CODE);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnInvalidCredentialsException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnInvalidCredentialsException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.InvalidCredentials;
23 |
24 | public CfnInvalidCredentialsException() {
25 | super(ERROR_CODE.getMessage(), ERROR_CODE);
26 | }
27 |
28 | public CfnInvalidCredentialsException(final Throwable cause) {
29 | super(cause, ERROR_CODE);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnInvalidRequestException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnInvalidRequestException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.InvalidRequest;
23 |
24 | public CfnInvalidRequestException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnInvalidRequestException(final String requestBody) {
29 | this(requestBody, null);
30 | }
31 |
32 | public CfnInvalidRequestException(final String requestBody,
33 | final Throwable cause) {
34 | super(String.format(ERROR_CODE.getMessage(), requestBody), cause, ERROR_CODE);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnInvalidTypeConfigurationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnInvalidTypeConfigurationException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 |
23 | public CfnInvalidTypeConfigurationException(String resourceTypeName,
24 | String message) {
25 | super(String.format(HandlerErrorCode.InvalidTypeConfiguration.getMessage(), resourceTypeName, message), null,
26 | HandlerErrorCode.InvalidTypeConfiguration);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnNetworkFailureException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnNetworkFailureException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.NetworkFailure;
23 |
24 | public CfnNetworkFailureException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnNetworkFailureException(final String operation) {
29 | this(operation, null);
30 | }
31 |
32 | public CfnNetworkFailureException(final String operation,
33 | final Throwable cause) {
34 | super(String.format(ERROR_CODE.getMessage(), operation), cause, ERROR_CODE);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnNonCompliantException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnNonCompliantException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.NonCompliant;
23 |
24 | public CfnNonCompliantException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnNonCompliantException(final String hookTypeName,
29 | final String reason) {
30 | this(hookTypeName, reason, null);
31 | }
32 |
33 | public CfnNonCompliantException(final String hookTypeName,
34 | final String reason,
35 | final Throwable cause) {
36 | super(String.format(ERROR_CODE.getMessage(), hookTypeName, reason), cause, ERROR_CODE);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnNotFoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnNotFoundException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.NotFound;
23 |
24 | public CfnNotFoundException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnNotFoundException(final String resourceTypeName,
29 | final String resourceIdentifier) {
30 | this(resourceTypeName, resourceIdentifier, null);
31 | }
32 |
33 | public CfnNotFoundException(final String resourceTypeName,
34 | final String resourceIdentifier,
35 | final Throwable cause) {
36 | super(String.format(ERROR_CODE.getMessage(), resourceTypeName, resourceIdentifier), cause, ERROR_CODE);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnNotStabilizedException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnNotStabilizedException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.NotStabilized;
23 |
24 | public CfnNotStabilizedException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnNotStabilizedException(final String resourceTypeName,
29 | final String resourceIdentifier) {
30 | this(resourceTypeName, resourceIdentifier, null);
31 | }
32 |
33 | public CfnNotStabilizedException(final String resourceTypeName,
34 | final String resourceIdentifier,
35 | final Throwable cause) {
36 | super(String.format(ERROR_CODE.getMessage(), resourceTypeName, resourceIdentifier), cause, ERROR_CODE);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnNotUpdatableException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnNotUpdatableException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.NotUpdatable;
23 |
24 | public CfnNotUpdatableException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnNotUpdatableException(final String resourceTypeName,
29 | final String resourceIdentifier) {
30 | this(resourceTypeName, resourceIdentifier, null);
31 | }
32 |
33 | public CfnNotUpdatableException(final String resourceTypeName,
34 | final String resourceIdentifier,
35 | final Throwable cause) {
36 | super(String.format(ERROR_CODE.getMessage(), resourceTypeName, resourceIdentifier), cause, ERROR_CODE);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnServiceInternalErrorException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnServiceInternalErrorException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.ServiceInternalError;
23 |
24 | public CfnServiceInternalErrorException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnServiceInternalErrorException(final String operation) {
29 | this(operation, null);
30 | }
31 |
32 | public CfnServiceInternalErrorException(final String operation,
33 | final Throwable cause) {
34 | super(String.format(ERROR_CODE.getMessage(), operation), cause, ERROR_CODE);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnServiceLimitExceededException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnServiceLimitExceededException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.ServiceLimitExceeded;
23 |
24 | public CfnServiceLimitExceededException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnServiceLimitExceededException(final String resourceTypeName,
29 | final String reason) {
30 | this(resourceTypeName, reason, null);
31 | }
32 |
33 | public CfnServiceLimitExceededException(final String resourceTypeName,
34 | final String reason,
35 | final Throwable cause) {
36 | super(String.format(ERROR_CODE.getMessage(), resourceTypeName, reason), cause, ERROR_CODE);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnThrottlingException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnThrottlingException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.Throttling;
23 |
24 | public CfnThrottlingException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnThrottlingException(final String operation) {
29 | this(operation, null);
30 | }
31 |
32 | public CfnThrottlingException(final String operation,
33 | final Throwable cause) {
34 | super(String.format(ERROR_CODE.getMessage(), operation), cause, ERROR_CODE);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnUnauthorizedTaggingOperationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnUnauthorizedTaggingOperationException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.UnauthorizedTaggingOperation;
23 |
24 | public CfnUnauthorizedTaggingOperationException() {
25 | this(null);
26 | }
27 |
28 | public CfnUnauthorizedTaggingOperationException(final Throwable cause) {
29 | super(ERROR_CODE.getMessage(), cause, ERROR_CODE);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnUnknownException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnUnknownException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.Unknown;
23 |
24 | public CfnUnknownException() {
25 | this(null);
26 | }
27 |
28 | public CfnUnknownException(final Throwable cause) {
29 | super(ERROR_CODE.getMessage(), cause, ERROR_CODE);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/CfnUnsupportedTargetException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | import software.amazon.cloudformation.proxy.HandlerErrorCode;
18 |
19 | public class CfnUnsupportedTargetException extends BaseHandlerException {
20 |
21 | private static final long serialVersionUID = -1646136434112354328L;
22 | private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.UnsupportedTarget;
23 |
24 | public CfnUnsupportedTargetException(final Throwable cause) {
25 | super(cause, ERROR_CODE);
26 | }
27 |
28 | public CfnUnsupportedTargetException(final String hookTypeName,
29 | final String targetTypeName) {
30 | this(hookTypeName, targetTypeName, null);
31 | }
32 |
33 | public CfnUnsupportedTargetException(final String hookTypeName,
34 | final String targetTypeName,
35 | final Throwable cause) {
36 | super(String.format(ERROR_CODE.getMessage(), hookTypeName, targetTypeName), cause, ERROR_CODE);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/EncryptionException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | public class EncryptionException extends RuntimeException {
18 | private static final long serialVersionUID = -5820555650294338667L;
19 |
20 | public EncryptionException(String message,
21 | Throwable cause) {
22 | super(message, cause);
23 | }
24 |
25 | public EncryptionException(String message) {
26 | super(message);
27 | }
28 |
29 | protected EncryptionException(Throwable cause) {
30 | super(cause);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/FileScrubberException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | public class FileScrubberException extends RuntimeException {
18 |
19 | private static final long serialVersionUID = -1646136434112354328L;
20 |
21 | public FileScrubberException(final Throwable cause) {
22 | super(null, cause);
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/ResourceNotFoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | /**
18 | * Uses for this exception class should delegate instead to
19 | * CfnNotFoundException. Many APIs use exception classes titled
20 | * ResourceNotFoundException, and if handler authors use this class, they'll
21 | * often need to use the fully qualified exception name.
22 | */
23 | public class ResourceNotFoundException extends CfnNotFoundException {
24 |
25 | private static final long serialVersionUID = -1646136434112354328L;
26 |
27 | public ResourceNotFoundException(final Throwable cause) {
28 | super(cause);
29 | }
30 |
31 | public ResourceNotFoundException(final String resourceTypeName,
32 | final String resourceIdentifier) {
33 | this(resourceTypeName, resourceIdentifier, null);
34 | }
35 |
36 | public ResourceNotFoundException(final String resourceTypeName,
37 | final String resourceIdentifier,
38 | final Throwable cause) {
39 | super(resourceTypeName, resourceIdentifier, cause);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/TerminalException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | public class TerminalException extends RuntimeException {
18 |
19 | private static final long serialVersionUID = -1646136434112354328L;
20 |
21 | public TerminalException(final Throwable cause) {
22 | super(null, cause);
23 | }
24 |
25 | public TerminalException(final String customerFacingErrorMessage) {
26 | super(customerFacingErrorMessage);
27 | }
28 |
29 | public TerminalException(final String customerFacingErrorMessage,
30 | final Throwable cause) {
31 | super(customerFacingErrorMessage, cause);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/exceptions/UnsupportedTargetException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.exceptions;
16 |
17 | /**
18 | * Uses for this exception class should delegate instead to
19 | * CfnUnsupportedTargetException as it maps to UnsupportedTarget error code.
20 | * This deprecated exception maps to an InvalidRequest error code. Keeping the
21 | * same for backwards-compatibility
22 | */
23 | public class UnsupportedTargetException extends CfnInvalidRequestException {
24 |
25 | private static final long serialVersionUID = -1646136434112354328L;
26 | private static final String ERROR_MESSAGE = "Unsupported target: [%s]";
27 |
28 | public UnsupportedTargetException(final Throwable cause) {
29 | super(cause);
30 | }
31 |
32 | public UnsupportedTargetException(final String targetTypeName) {
33 | this(targetTypeName, null);
34 | }
35 |
36 | public UnsupportedTargetException(final String targetTypeName,
37 | final Throwable cause) {
38 | super(String.format(ERROR_MESSAGE, targetTypeName), cause);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/injection/CloudFormationProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.injection;
16 |
17 | import java.net.URI;
18 | import software.amazon.awssdk.http.SdkHttpClient;
19 | import software.amazon.awssdk.services.cloudformation.CloudFormationClient;
20 |
21 | public class CloudFormationProvider extends AmazonWebServicesProvider {
22 |
23 | private URI callbackEndpoint;
24 |
25 | public CloudFormationProvider(final CredentialsProvider credentialsProvider,
26 | final SdkHttpClient httpClient) {
27 | super(credentialsProvider, httpClient);
28 | }
29 |
30 | public void setCallbackEndpoint(final URI callbackEndpoint) {
31 | this.callbackEndpoint = callbackEndpoint;
32 | }
33 |
34 | public CloudFormationClient get() {
35 | return CloudFormationClient.builder().credentialsProvider(this.getCredentialsProvider()).httpClient(httpClient)
36 | .endpointOverride(this.callbackEndpoint).build();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/injection/CloudWatchEventsProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.injection;
16 |
17 | import software.amazon.awssdk.http.SdkHttpClient;
18 | import software.amazon.awssdk.services.cloudwatchevents.CloudWatchEventsClient;
19 |
20 | public class CloudWatchEventsProvider extends AmazonWebServicesProvider {
21 |
22 | public CloudWatchEventsProvider(final CredentialsProvider credentialsProvider,
23 | final SdkHttpClient httpClient) {
24 | super(credentialsProvider, httpClient);
25 | }
26 |
27 | public CloudWatchEventsClient get() {
28 | return defaultClient(CloudWatchEventsClient.builder()).build();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/injection/CloudWatchLogsProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.injection;
16 |
17 | import software.amazon.awssdk.http.SdkHttpClient;
18 | import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsClient;
19 |
20 | public class CloudWatchLogsProvider extends AmazonWebServicesProvider {
21 |
22 | public CloudWatchLogsProvider(final CredentialsProvider credentialsProvider,
23 | final SdkHttpClient httpClient) {
24 | super(credentialsProvider, httpClient);
25 | }
26 |
27 | public CloudWatchLogsClient get() {
28 | return defaultClient(CloudWatchLogsClient.builder()).build();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/injection/CloudWatchProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.injection;
16 |
17 | import software.amazon.awssdk.http.SdkHttpClient;
18 | import software.amazon.awssdk.services.cloudwatch.CloudWatchClient;
19 |
20 | public class CloudWatchProvider extends AmazonWebServicesProvider {
21 |
22 | public CloudWatchProvider(final CredentialsProvider credentialsProvider,
23 | final SdkHttpClient httpClient) {
24 | super(credentialsProvider, httpClient);
25 | }
26 |
27 | public CloudWatchClient get() {
28 | return defaultClient(CloudWatchClient.builder()).build();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/injection/CredentialsProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.injection;
16 |
17 | import software.amazon.awssdk.auth.credentials.AwsSessionCredentials;
18 | import software.amazon.cloudformation.proxy.Credentials;
19 |
20 | public interface CredentialsProvider {
21 |
22 | /**
23 | * @return the current set of credentials for initialising AWS SDK Clients
24 | */
25 | AwsSessionCredentials get();
26 |
27 | /**
28 | * Inject a new set of credentials (passed through from caller)
29 | *
30 | * @param credentials, incoming credentials for the call that is being made
31 | */
32 | void setCredentials(Credentials credentials);
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/injection/SessionCredentialsProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.injection;
16 |
17 | import software.amazon.awssdk.auth.credentials.AwsSessionCredentials;
18 | import software.amazon.cloudformation.proxy.Credentials;
19 |
20 | public class SessionCredentialsProvider implements CredentialsProvider {
21 |
22 | private AwsSessionCredentials awsSessionCredentials;
23 |
24 | public AwsSessionCredentials get() {
25 | return this.awsSessionCredentials;
26 | }
27 |
28 | public void setCredentials(final Credentials credentials) {
29 | this.awsSessionCredentials = AwsSessionCredentials.create(credentials.getAccessKeyId(), credentials.getSecretAccessKey(),
30 | credentials.getSessionToken());
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/loggers/JavaLogPublisher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.loggers;
16 |
17 | import org.slf4j.Logger;
18 |
19 | public class JavaLogPublisher extends LogPublisher {
20 |
21 | private final Logger logger;
22 |
23 | public JavaLogPublisher(final Logger logger,
24 | final LogFilter... logFilters) {
25 | super(logFilters);
26 | this.logger = logger;
27 | }
28 |
29 | @Override
30 | protected void publishMessage(String message) {
31 | this.logger.debug(String.format("%s%n", message));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/loggers/LambdaLogPublisher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.loggers;
16 |
17 | import com.amazonaws.services.lambda.runtime.LambdaLogger;
18 |
19 | public class LambdaLogPublisher extends LogPublisher {
20 |
21 | private final LambdaLogger logger;
22 |
23 | public LambdaLogPublisher(final LambdaLogger logger,
24 | final LogFilter... logFilters) {
25 | super(logFilters);
26 | this.logger = logger;
27 | }
28 |
29 | @Override
30 | protected void publishMessage(String message) {
31 | this.logger.log(String.format("%s%n", message));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/loggers/LogFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.loggers;
16 |
17 | public interface LogFilter {
18 |
19 | String applyFilter(String rawInput);
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/loggers/LogPublisher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.loggers;
16 |
17 | import java.util.Arrays;
18 | import java.util.List;
19 |
20 | public abstract class LogPublisher {
21 | private List logFilterList;
22 |
23 | public LogPublisher(final LogFilter... filters) {
24 | logFilterList = Arrays.asList(filters);
25 | }
26 |
27 | protected abstract void publishMessage(String message);
28 |
29 | /**
30 | * Redact or scrub loggers in someway to help prevent leaking of certain
31 | * information.
32 | */
33 | private String filterMessage(final String message) {
34 | String toReturn = message;
35 | for (LogFilter filter : logFilterList) {
36 | toReturn = filter.applyFilter(toReturn);
37 | }
38 | return toReturn;
39 | }
40 |
41 | public final void publishLogEvent(final String message) {
42 | publishMessage(filterMessage(message));
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/CallGraphNameGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import java.util.function.Function;
18 |
19 | @FunctionalInterface
20 | public interface CallGraphNameGenerator {
21 | String callGraph(String incoming, ModelT model, Function reqMaker, ClientT client, CallbackT context);
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/Credentials.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Data;
19 | import lombok.NoArgsConstructor;
20 |
21 | @Data
22 | @NoArgsConstructor
23 | @AllArgsConstructor
24 | public class Credentials {
25 | private String accessKeyId;
26 | private String secretAccessKey;
27 | private String sessionToken;
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/DelayFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import java.time.Duration;
18 | import software.amazon.cloudformation.proxy.delay.Constant;
19 |
20 | @FunctionalInterface
21 | public interface DelayFactory {
22 | DelayFactory CONSTANT_DEFAULT_DELAY_FACTORY = (apiCall, incoming) -> incoming != null
23 | ? incoming
24 | : Constant.of().delay(Duration.ofSeconds(5)).timeout(Duration.ofMinutes(20)).build();
25 |
26 | Delay getDelay(String apiCall, Delay provided);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/HandlerRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import java.util.Map;
18 | import lombok.Data;
19 | import lombok.NoArgsConstructor;
20 | import software.amazon.cloudformation.Action;
21 |
22 | /**
23 | * This interface describes the request object for the provisioning request
24 | */
25 | @Data
26 | @NoArgsConstructor
27 | public class HandlerRequest {
28 | private Action action;
29 | private String awsAccountId;
30 | private String bearerToken;
31 | private String nextToken;
32 | private Integer maxResults;
33 | private String region;
34 | private String resourceType;
35 | private String resourceTypeVersion;
36 | private RequestData requestData;
37 | private String stackId;
38 | private CallbackT callbackContext;
39 | private Boolean snapshotRequested;
40 | private Boolean rollback;
41 | private Boolean driftable;
42 | private Map features;
43 | private Map updatePolicy;
44 | private Map creationPolicy;
45 | private RequestContext requestContext;
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/HandlerResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Builder;
19 | import lombok.Data;
20 | import lombok.NoArgsConstructor;
21 |
22 | /**
23 | * This interface describes the response object for the provisioning request
24 | *
25 | * @param Type of resource model being provisioned
26 | */
27 | @Data
28 | @AllArgsConstructor
29 | @NoArgsConstructor
30 | @Builder
31 | public class HandlerResponse {
32 | private String bearerToken;
33 | private String errorCode;
34 | private String message;
35 | private String nextToken;
36 | private OperationStatus operationStatus;
37 | private ResourceT resourceModel;
38 | private StabilizationData stabilizationData;
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/Logger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | public interface Logger {
18 |
19 | /**
20 | * Log a message to the default provider on this runtime.
21 | *
22 | * @param message the message to emit to log
23 | */
24 | void log(String message);
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/LoggerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 | import software.amazon.cloudformation.loggers.LogPublisher;
20 |
21 | public class LoggerProxy implements Logger {
22 |
23 | private final List logPublishers = new ArrayList<>();
24 |
25 | public void addLogPublisher(final LogPublisher logPublisher) {
26 | logPublishers.add(logPublisher);
27 | }
28 |
29 | @Override
30 | public void log(final String message) {
31 | logPublishers.stream().forEach(logPublisher -> logPublisher.publishLogEvent(message));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/OperationStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | public enum OperationStatus {
18 | PENDING,
19 | IN_PROGRESS,
20 | SUCCESS,
21 | CHANGE_SET_SUCCESS_SKIP_STACK_HOOK,
22 | FAILED
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/RequestContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import lombok.Data;
18 | import lombok.NoArgsConstructor;
19 |
20 | @Data
21 | @NoArgsConstructor
22 | public class RequestContext {
23 | /**
24 | * The number of times the handler has been invoked (including current)
25 | */
26 | private int invocation;
27 |
28 | /**
29 | * Custom context object to enable handlers to process re-invocation
30 | */
31 | private CallbackT callbackContext;
32 |
33 | /**
34 | * If the request was the result of a CloudWatchEvents re-invoke trigger the
35 | * CloudWatchEvents Rule name is stored to allow cleanup
36 | */
37 | private String cloudWatchEventsRuleName;
38 |
39 | /**
40 | * If the request was the result of a CloudWatchEvents re-invoke trigger the
41 | * CloudWatchEvents Trigger Id is stored to allow cleanup
42 | */
43 | private String cloudWatchEventsTargetId;
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/RequestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import java.util.Map;
18 | import lombok.Data;
19 | import lombok.NoArgsConstructor;
20 |
21 | @Data
22 | @NoArgsConstructor
23 | public class RequestData {
24 | private Credentials callerCredentials;
25 | private Credentials providerCredentials;
26 | private String providerLogGroupName;
27 | private String logicalResourceId;
28 | private ResourceT resourceProperties;
29 | private ResourceT previousResourceProperties;
30 | private ConfigurationT typeConfiguration;
31 | private Map systemTags;
32 | private Map previousSystemTags;
33 | private Map stackTags;
34 | private Map previousStackTags;
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/ResourceHandlerTestPayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Builder;
19 | import lombok.Data;
20 | import lombok.NoArgsConstructor;
21 | import software.amazon.cloudformation.Action;
22 |
23 | /**
24 | * This POJO is for the test entrypoint that bypasses the wrapper for direct
25 | * testing.
26 | *
27 | * @param Type of resource model being provisioned
28 | * @param Type of callback data to be passed on re-invocation
29 | */
30 | @Data
31 | @AllArgsConstructor
32 | @NoArgsConstructor
33 | @Builder(toBuilder = true)
34 | public class ResourceHandlerTestPayload {
35 | private Credentials credentials;
36 | private Action action;
37 | private ResourceHandlerRequest request;
38 | private CallbackT callbackContext;
39 | private ConfigurationT typeConfiguration;
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/StabilizationData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | import lombok.Data;
18 | import lombok.NoArgsConstructor;
19 |
20 | @Data
21 | @NoArgsConstructor
22 | public class StabilizationData {
23 | private Double delayBase;
24 | private Integer initialDelay;
25 | private Integer maxDelay;
26 | private StabilizationMode stabilizationMode;
27 | private Integer stabilizationTime;
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/StabilizationMode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy;
16 |
17 | public enum StabilizationMode {
18 | Constant,
19 | Exponential
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/delay/AbstractDelay.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.delay;
16 |
17 | import com.google.common.base.Preconditions;
18 | import java.time.Duration;
19 | import software.amazon.cloudformation.proxy.Delay;
20 |
21 | /**
22 | * Base delay class that hosts the maximum timeout for {@link Delay} after which
23 | * we return the duration to be {@link Duration#ZERO} to indicate timeout has
24 | * been reached.
25 | */
26 | abstract class AbstractDelay implements Delay {
27 | final Duration timeout;
28 |
29 | AbstractDelay(Duration timeout) {
30 | Preconditions.checkArgument(timeout != null && timeout.toMillis() > 0, "timeout must be > 0");
31 | this.timeout = timeout;
32 | }
33 |
34 | protected Duration enforceBounds(Duration boundsCheck, Duration delayTime) {
35 | if (boundsCheck.compareTo(timeout) > 0) {
36 | return Duration.ZERO;
37 | }
38 | return delayTime;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/delay/BaseBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.delay;
16 |
17 | import java.time.Duration;
18 | import software.amazon.cloudformation.proxy.Delay;
19 |
20 | /**
21 | * Base builder implementation to capture the maximum bound timout specified by
22 | * {@link Duration}
23 | */
24 | abstract class BaseBuilder> implements Builder {
25 | protected Duration timeout;
26 |
27 | BaseBuilder() {
28 | }
29 |
30 | @SuppressWarnings("unchecked")
31 | public T timeout(Duration timeout) {
32 | this.timeout = timeout;
33 | return (T) this;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/delay/Builder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.delay;
16 |
17 | import software.amazon.cloudformation.proxy.Delay;
18 |
19 | /**
20 | * Build the final {@link software.amazon.cloudformation.proxy.Delay} based
21 | * timeout and other specifications.
22 | *
23 | * @param , the delay object that is finally built. Can never be null
24 | */
25 | public interface Builder {
26 | R build();
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/delay/DelayBasedBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.delay;
16 |
17 | import java.time.Duration;
18 | import software.amazon.cloudformation.proxy.Delay;
19 |
20 | /**
21 | * Builder pattern for {@link software.amazon.cloudformation.proxy.Delay}s that
22 | * are based on some constant multiple or shift of delay
23 | *
24 | * @param the final delay object that needs to be built.
25 | * @param the derived builder object.
26 | */
27 | abstract class DelayBasedBuilder> extends BaseBuilder {
28 | protected Duration delay;
29 |
30 | @SuppressWarnings("unchecked")
31 | public T delay(Duration delay) {
32 | this.delay = delay;
33 | return (T) this;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/delay/MinDelayAbstractBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.delay;
16 |
17 | import com.google.common.base.Preconditions;
18 | import java.time.Duration;
19 |
20 | /**
21 | * Base class for all [min, timeout) range based
22 | * {@link software.amazon.cloudformation.proxy.Delay}s
23 | *
24 | * @see Exponential
25 | */
26 | abstract class MinDelayAbstractBase extends AbstractDelay {
27 | final Duration minDelay;
28 |
29 | MinDelayAbstractBase(Duration timeout,
30 | Duration minDelay) {
31 | super(timeout);
32 | Preconditions.checkArgument(minDelay != null && minDelay.toMillis() >= 0, "minDelay must be > 0");
33 | Preconditions.checkArgument(minDelay.compareTo(timeout) < 0, "minDelay < timeout");
34 | this.minDelay = minDelay;
35 | }
36 |
37 | @Override
38 | protected Duration enforceBounds(Duration boundsCheck, Duration delayTime) {
39 | if (boundsCheck.compareTo(minDelay) < 0) {
40 | return minDelay;
41 | }
42 | return super.enforceBounds(boundsCheck, delayTime);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/delay/MinDelayBasedBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.delay;
16 |
17 | import java.time.Duration;
18 | import software.amazon.cloudformation.proxy.Delay;
19 |
20 | /**
21 | * All delays that have a min delay specified with a maximum time, effectively
22 | * range based
23 | *
24 | * @param the delay type that is being created.
25 | * @param the derived builder type
26 | */
27 | abstract class MinDelayBasedBuilder> extends BaseBuilder {
28 | protected Duration minDelay = Duration.ZERO;
29 |
30 | @SuppressWarnings("unchecked")
31 | public T minDelay(Duration minDelay) {
32 | this.minDelay = minDelay;
33 | return (T) this;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/delay/ShiftByMultipleOf.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.delay;
16 |
17 | import java.time.Duration;
18 |
19 | /**
20 | * Provides delay seconds which is a multiple of the delay shifted from previous
21 | * attempt's accrual until {@link ShiftByMultipleOf#timeout} has been reached.
22 | * After which it will return {@link Duration#ZERO}
23 | */
24 | public class ShiftByMultipleOf extends MultipleOf {
25 |
26 | ShiftByMultipleOf(Duration timeout,
27 | Duration delay,
28 | int multiple) {
29 | super(timeout, delay, multiple);
30 | }
31 |
32 | public static class Builder extends MultipleOf.Builder {
33 | @Override
34 | public ShiftByMultipleOf build() {
35 | return new ShiftByMultipleOf(timeout, delay, multiple);
36 | }
37 | }
38 |
39 | public static Builder shiftedOf() {
40 | return new Builder();
41 | }
42 |
43 | @Override
44 | public Duration nextDelay(int attempt) {
45 | Duration next = super.nextDelay(attempt);
46 | return next == Duration.ZERO ? next : accrued;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/hook/HookHandlerRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Builder;
19 | import lombok.Data;
20 | import lombok.NoArgsConstructor;
21 |
22 | /**
23 | * This interface describes the request object for the hook invocation request
24 | * passed to the implementor. It is transformed from an instance of
25 | * HookInvocationRequest by the HookLambdaWrapper to only items of concern
26 | *
27 | */
28 | @Data
29 | @AllArgsConstructor
30 | @NoArgsConstructor
31 | @Builder(toBuilder = true)
32 | public class HookHandlerRequest {
33 | private String clientRequestToken;
34 | private HookContext hookContext;
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/hook/HookHandlerTestPayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Builder;
19 | import lombok.Data;
20 | import lombok.NoArgsConstructor;
21 | import software.amazon.cloudformation.HookInvocationPoint;
22 | import software.amazon.cloudformation.proxy.Credentials;
23 |
24 | /**
25 | * This POJO is for the test entrypoint that bypasses the wrapper for direct
26 | * testing.
27 | *
28 | * @param Type of hook type configuration model
29 | * @param Type of callback data to be passed on re-invocation
30 | */
31 | @Data
32 | @AllArgsConstructor
33 | @NoArgsConstructor
34 | @Builder(toBuilder = true)
35 | public class HookHandlerTestPayload {
36 | private Credentials credentials;
37 | private HookInvocationPoint actionInvocationPoint;
38 | private HookHandlerRequest request;
39 | private CallbackT callbackContext;
40 | private ConfigurationT typeConfiguration;
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/hook/HookInvocationRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Builder;
19 | import lombok.Data;
20 | import lombok.NoArgsConstructor;
21 | import software.amazon.cloudformation.HookInvocationPoint;
22 |
23 | /**
24 | * This interface describes the request object for the hook invocation request.
25 | */
26 | @Data
27 | @NoArgsConstructor
28 | @AllArgsConstructor
29 | @Builder(toBuilder = true)
30 | public class HookInvocationRequest {
31 | private String clientRequestToken;
32 | private String awsAccountId;
33 | private String stackId;
34 | private String changeSetId;
35 | private String hookTypeName;
36 | private String hookTypeVersion;
37 | private ConfigurationT hookModel;
38 | private HookInvocationPoint actionInvocationPoint;
39 | private HookRequestData requestData;
40 | private HookRequestContext requestContext;
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/hook/HookRequestContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Data;
19 | import lombok.NoArgsConstructor;
20 |
21 | @Data
22 | @NoArgsConstructor
23 | @AllArgsConstructor
24 | public class HookRequestContext {
25 | /**
26 | * The number of times the handler has been invoked (including current)
27 | */
28 | private int invocation;
29 |
30 | /**
31 | * Custom context object to enable handlers to process re-invocation
32 | */
33 | private CallbackT callbackContext;
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/hook/HookRequestData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook;
16 |
17 | import java.util.Map;
18 | import lombok.AllArgsConstructor;
19 | import lombok.Builder;
20 | import lombok.Data;
21 | import lombok.NoArgsConstructor;
22 |
23 | @Data
24 | @NoArgsConstructor
25 | @AllArgsConstructor
26 | @Builder(toBuilder = true)
27 | public class HookRequestData {
28 | private String targetName;
29 | private String targetType;
30 | private String targetLogicalId;
31 | private Map targetModel;
32 | private String payload;
33 | private String callerCredentials;
34 | private String providerCredentials;
35 | private String providerLogGroupName;
36 | private String hookEncryptionKeyArn;
37 | private String hookEncryptionKeyRole;
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/hook/HookStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook;
16 |
17 | public enum HookStatus {
18 | PENDING,
19 | IN_PROGRESS,
20 | SUCCESS,
21 | CHANGE_SET_SUCCESS_SKIP_STACK_HOOK,
22 | FAILED
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/hook/targetmodel/ChangedResource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook.targetmodel;
16 |
17 | import com.fasterxml.jackson.annotation.JsonProperty;
18 | import lombok.AllArgsConstructor;
19 | import lombok.Builder;
20 | import lombok.Data;
21 | import lombok.NoArgsConstructor;
22 |
23 | @Data
24 | @Builder
25 | @AllArgsConstructor
26 | @NoArgsConstructor
27 | public class ChangedResource {
28 | @JsonProperty("LogicalResourceId")
29 | private String logicalResourceId;
30 |
31 | @JsonProperty("ResourceType")
32 | private String resourceType;
33 |
34 | @JsonProperty("LineNumber")
35 | private Integer lineNumber;
36 |
37 | @JsonProperty("Action")
38 | private String action;
39 |
40 | @JsonProperty("ResourceProperties")
41 | private String resourceProperties;
42 |
43 | @JsonProperty("PreviousResourceProperties")
44 | private String previousResourceProperties;
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/hook/targetmodel/HookTarget.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook.targetmodel;
16 |
17 | public interface HookTarget {
18 |
19 | Object get(String key);
20 |
21 | HookTargetType getHookTargetType();
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/software/amazon/cloudformation/proxy/hook/targetmodel/HookTargetType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook.targetmodel;
16 |
17 | public enum HookTargetType {
18 | /**
19 | * An agnostic target typed used when we do not know the type of a Hook's
20 | * target. Typically, Hooks can support multiple target types which won't be
21 | * known until runtime.
22 | */
23 | GENERIC,
24 |
25 | /**
26 | * A target model meant to represent a target for a Resource Hook. This model
27 | * type will have properties specific to the resource type.
28 | */
29 | RESOURCE,
30 |
31 | /**
32 | * A target model meant to represent a target for a Stack Hook. This model type
33 | * will have properties specific to the stack type.
34 | */
35 | STACK,
36 |
37 | /**
38 | * A target model meant to represent a target for a stack Change Set Hook. This
39 | * model type will have properties specific to the change set type.
40 | */
41 | CHANGE_SET;
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/resources/com/amazonaws/cloudformation/checkstyle-suppressions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
18 |
21 |
22 |
24 |
26 |
28 |
30 |
32 |
34 |
35 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/main/resources/com/amazonaws/cloudformation/intellij-copyright-profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/main/resources/com/amazonaws/cloudformation/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1}:%L - %m%n
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/main/resources/com/amazonaws/cloudformation/package.properties:
--------------------------------------------------------------------------------
1 | package.version=${project.version}
2 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/TestConfigurationModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Builder;
19 | import lombok.Data;
20 | import lombok.NoArgsConstructor;
21 |
22 | @Data
23 | @AllArgsConstructor
24 | @NoArgsConstructor
25 | @Builder
26 | public class TestConfigurationModel {
27 |
28 | private String property1;
29 |
30 | private Integer property2;
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/TestContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Builder;
19 | import lombok.Data;
20 | import lombok.NoArgsConstructor;
21 |
22 | @Data
23 | @AllArgsConstructor
24 | @NoArgsConstructor
25 | @Builder
26 | public class TestContext {
27 |
28 | private String contextPropertyA;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/TestModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation;
16 |
17 | import java.util.Map;
18 | import lombok.AllArgsConstructor;
19 | import lombok.Builder;
20 | import lombok.Data;
21 | import lombok.NoArgsConstructor;
22 |
23 | @Data
24 | @AllArgsConstructor
25 | @NoArgsConstructor
26 | @Builder
27 | public class TestModel {
28 |
29 | private String property1;
30 |
31 | private Integer property2;
32 |
33 | private Map tags;
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/create.request-with-stringified-resource.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "resourceProperties": {
24 | "property1": "abc",
25 | "property2": "123"
26 | },
27 | "systemTags": {
28 | "aws:cloudformation:stack-id": "SampleStack"
29 | },
30 | "stackTags": {
31 | "tag1": "abc"
32 | },
33 | "previousStackTags": {
34 | "tag1": "def"
35 | }
36 | },
37 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/create.request-without-caller-credentials.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "providerCredentials": {
12 | "accessKeyId": "HDI0745692Y45IUTYR78",
13 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
14 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
15 | },
16 | "providerLogGroupName": "providerLoggingGroupName",
17 | "logicalResourceId": "myBucket",
18 | "resourceProperties": {
19 | "property1": "abc",
20 | "property2": 123
21 | },
22 | "systemTags": {
23 | "aws:cloudformation:stack-id": "SampleStack"
24 | },
25 | "stackTags": {
26 | "tag1": "abc"
27 | },
28 | "previousStackTags": {
29 | "tag1": "def"
30 | }
31 | },
32 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
33 | }
34 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/create.request-without-logging-credentials.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "logicalResourceId": "myBucket",
17 | "resourceProperties": {
18 | "property1": "abc",
19 | "property2": 123
20 | },
21 | "systemTags": {
22 | "aws:cloudformation:stack-id": "SampleStack"
23 | },
24 | "stackTags": {
25 | "tag1": "abc"
26 | },
27 | "previousStackTags": {
28 | "tag1": "def"
29 | }
30 | },
31 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
32 | }
33 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/create.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "resourceProperties": {
24 | "property1": "abc",
25 | "property2": 123
26 | },
27 | "systemTags": {
28 | "aws:cloudformation:stack-id": "SampleStack"
29 | },
30 | "stackTags": {
31 | "tag1": "abc"
32 | },
33 | "previousStackTags": {
34 | "tag1": "def"
35 | }
36 | },
37 | "updatePolicy": {
38 | "Custom": "Term"
39 | },
40 | "creationPolicy": {
41 | "Custom": "Term"
42 | },
43 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
44 | }
45 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/create.request.with-extraneous-model-fields.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "resourceProperties": {
24 | "property1": "abc",
25 | "property2": 123,
26 | "fieldCausesValidationError": "DONOTIGNORE"
27 | },
28 | "systemTags": {
29 | "aws:cloudformation:stack-id": "SampleStack"
30 | },
31 | "stackTags": {
32 | "tag1": "abc"
33 | },
34 | "previousStackTags": {
35 | "tag1": "def"
36 | }
37 | },
38 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
39 | }
40 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/create.request.with-extraneous-request-fields.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "thisFieldShouldBeIgnored": "IGNOREME",
7 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
8 | "resourceType": "AWS::Test::TestModel",
9 | "resourceTypeVersion": "1.0",
10 | "requestContext": {},
11 | "requestData": {
12 | "thisFieldShouldAlsoBeIgnored": "IGNOREME",
13 | "callerCredentials": {
14 | "accessKeyId": "IASAYK835GAIFHAHEI23",
15 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
16 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
17 | },
18 | "providerCredentials": {
19 | "accessKeyId": "HDI0745692Y45IUTYR78",
20 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
21 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
22 | },
23 | "providerLogGroupName": "providerLoggingGroupName",
24 | "logicalResourceId": "myBucket",
25 | "resourceProperties": {
26 | "property1": "abc",
27 | "property2": 123
28 | },
29 | "systemTags": {
30 | "aws:cloudformation:stack-id": "SampleStack"
31 | },
32 | "stackTags": {
33 | "tag1": "abc"
34 | },
35 | "previousStackTags": {
36 | "tag1": "def"
37 | }
38 | },
39 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
40 | }
41 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/create.request.with-new-credentials.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "GY6P5DGSX9Q4X7SYOW3T",
13 | "secretAccessKey": "2VTH81RmywQPwF0n0f7g2KyGaARd7YKs71/C3y9J0",
14 | "sessionToken": "pmHYfNFZAaJkvLGYW1s3mWFVlUu9ygNJcvBZS0gF7gmYe5jTqNYjSjtgwgdOSFt1yB4ETRp2TgGnjpgXPTz7espt3Au4nnxh1Mto"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "resourceProperties": {
24 | "property1": "abc",
25 | "property2": 123
26 | },
27 | "systemTags": {
28 | "aws:cloudformation:stack-id": "SampleStack"
29 | },
30 | "stackTags": {
31 | "tag1": "abc"
32 | },
33 | "previousStackTags": {
34 | "tag1": "def"
35 | }
36 | },
37 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/create.with-callback-context.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "callbackContext": {
10 | "contextPropertyA": "Value"
11 | },
12 | "requestData": {
13 | "callerCredentials": {
14 | "accessKeyId": "IASAYK835GAIFHAHEI23",
15 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
16 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
17 | },
18 | "providerCredentials": {
19 | "accessKeyId": "HDI0745692Y45IUTYR78",
20 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
21 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
22 | },
23 | "providerLogGroupName": "providerLoggingGroupName",
24 | "logicalResourceId": "myBucket",
25 | "resourceProperties": {},
26 | "systemTags": {
27 | "aws:cloudformation:stack-id": "SampleStack"
28 | },
29 | "stackTags": {
30 | "tag1": "abc"
31 | },
32 | "previousStackTags": {
33 | "tag1": "def"
34 | }
35 | },
36 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/create.without-callback-context.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestData": {
10 | "callerCredentials": {
11 | "accessKeyId": "IASAYK835GAIFHAHEI23",
12 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
13 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
14 | },
15 | "providerCredentials": {
16 | "accessKeyId": "HDI0745692Y45IUTYR78",
17 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
18 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
19 | },
20 | "providerLogGroupName": "providerLoggingGroupName",
21 | "logicalResourceId": "myBucket",
22 | "resourceProperties": {},
23 | "systemTags": {
24 | "aws:cloudformation:stack-id": "SampleStack"
25 | },
26 | "stackTags": {
27 | "tag1": "abc"
28 | },
29 | "previousStackTags": {
30 | "tag1": "def"
31 | }
32 | },
33 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/delete.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "DELETE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "resourceProperties": {
24 | "property1": "abc",
25 | "property2": 123
26 | }
27 | },
28 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/delete.with-callback-context.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "DELETE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "callbackContext": {
10 | "contextPropertyA": "Value"
11 | },
12 | "requestData": {
13 | "callerCredentials": {
14 | "accessKeyId": "IASAYK835GAIFHAHEI23",
15 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
16 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
17 | },
18 | "providerCredentials": {
19 | "accessKeyId": "HDI0745692Y45IUTYR78",
20 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
21 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
22 | },
23 | "providerLogGroupName": "providerLoggingGroupName",
24 | "logicalResourceId": "myBucket",
25 | "resourceProperties": {}
26 | },
27 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/delete.with-request-context.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "DELETE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {
10 | "invocation": 2,
11 | "callbackContext": {
12 | "contextPropertyA": "Value"
13 | },
14 | "cloudWatchEventsRuleName": "reinvoke-handler-4754ac8a-623b-45fe-84bc-f5394118a8be",
15 | "cloudWatchEventsTargetId": "reinvoke-target-4754ac8a-623b-45fe-84bc-f5394118a8be"
16 | },
17 | "requestData": {
18 | "callerCredentials": {
19 | "accessKeyId": "IASAYK835GAIFHAHEI23",
20 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
21 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
22 | },
23 | "providerCredentials": {
24 | "accessKeyId": "HDI0745692Y45IUTYR78",
25 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
26 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
27 | },
28 | "providerLogGroupName": "providerLoggingGroupName",
29 | "logicalResourceId": "myBucket",
30 | "resourceProperties": {}
31 | },
32 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
33 | }
34 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/empty.request.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/empty.resource.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "logicalResourceId": "myBucket",
17 | "systemTags": {
18 | "aws:cloudformation:stack-id": "SampleStack"
19 | },
20 | "stackTags": {
21 | "tag1": "abc"
22 | },
23 | "previousStackTags": {
24 | "tag1": "def"
25 | }
26 | },
27 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/empty.request.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request-with-invalid-actionInvocationPoint.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "UPDATE_POST_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
27 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
28 | },
29 | "requestContext": {}
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request-with-stringified.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": "123"
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
27 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
28 | },
29 | "requestContext": {}
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request-with-unencrypted-credentials.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "requestData": {
14 | "targetName": "AWS::Example::ResourceTarget",
15 | "targetType": "RESOURCE",
16 | "targetLogicalId": "myResource",
17 | "targetModel": {
18 | "resourceProperties": {}
19 | },
20 | "callerCredentials": "{\"accessKeyId\": \"callerAccessKeyId\", \"secretAccessKey\": \"callerSecretAccessKey\", \"sessionToken\": \"callerSessionToken\"}",
21 | "providerCredentials": "{\"accessKeyId\": \"providerAccessKeyId\", \"secretAccessKey\": \"providerSecretAccessKey\", \"sessionToken\": \"providerSessionToken\"}",
22 | "providerLogGroupName": "providerLoggingGroupName"
23 | },
24 | "requestContext": {}
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request-without-caller-credentials.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "providerCredentials": "providerCredentials",
24 | "providerLogGroupName": "providerLoggingGroupName",
25 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
26 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
27 | },
28 | "requestContext": {}
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request-without-encryption-key-arn.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
27 | },
28 | "requestContext": {}
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request-without-encryption-key-role.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request-without-logging-credentials.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerLogGroupName": "providerLoggingGroupName",
25 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
26 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
27 | },
28 | "requestContext": {}
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request-without-target-model.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "callerCredentials": "callerCredentials",
21 | "providerCredentials": "providerCredentials",
22 | "providerLogGroupName": "providerLoggingGroupName",
23 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
24 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
25 | },
26 | "requestContext": {}
27 | }
28 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
27 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
28 | },
29 | "requestContext": {}
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request.with-new-credentials.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
27 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
28 | },
29 | "requestContext": {}
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.request.with-stack-level-hook.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "requestData": {
14 | "targetName": "STACK",
15 | "targetType": "STACK",
16 | "targetLogicalId": "myStack",
17 | "targetModel": {},
18 | "payload": "http://someS3PresignedUrl",
19 | "callerCredentials": "callerCredentials",
20 | "providerCredentials": "providerCredentials",
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
23 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
24 | },
25 | "requestContext": {}
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preCreate.with-request-context.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "CREATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
27 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
28 | },
29 | "requestContext": {
30 | "invocation": 2,
31 | "callbackContext": {
32 | "contextPropertyA": "Value"
33 | },
34 | "cloudWatchEventsRuleName": "reinvoke-handler-4754ac8a-623b-45fe-84bc-f5394118a8be",
35 | "cloudWatchEventsTargetId": "reinvoke-target-4754ac8a-623b-45fe-84bc-f5394118a8be"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preDelete.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "DELETE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
27 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
28 | },
29 | "requestContext": {}
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preDelete.with-request-context.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "DELETE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
27 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
28 | },
29 | "requestContext": {
30 | "invocation": 2,
31 | "callbackContext": {
32 | "contextPropertyA": "Value"
33 | },
34 | "cloudWatchEventsRuleName": "reinvoke-handler-4754ac8a-623b-45fe-84bc-f5394118a8be",
35 | "cloudWatchEventsTargetId": "reinvoke-target-4754ac8a-623b-45fe-84bc-f5394118a8be"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preUpdate.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "UPDATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
27 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
28 | },
29 | "requestContext": {}
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/preUpdate.with-request-context.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientRequestToken": "123456",
3 | "awsAccountId": "123456789012",
4 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968",
5 | "changeSetId": "arn:aws:cloudformation:us-east-1:123456789012:changeSet/SampleChangeSet-conditional/1a2345b6-0000-00a0-a123-00abc0abc000",
6 | "hookTypeName": "AWS::Test::TestModel",
7 | "hookTypeVersion": "1.0",
8 | "hookModel": {
9 | "property1": "abc",
10 | "property2": 123
11 | },
12 | "actionInvocationPoint": "UPDATE_PRE_PROVISION",
13 | "invocationId": "34325",
14 | "invocationPlanId": "12345457557866789012",
15 | "encryptedFas": "fas",
16 | "requestData": {
17 | "targetName": "AWS::Example::ResourceTarget",
18 | "targetType": "RESOURCE",
19 | "targetLogicalId": "myResource",
20 | "targetModel": {
21 | "resourceProperties": {}
22 | },
23 | "callerCredentials": "callerCredentials",
24 | "providerCredentials": "providerCredentials",
25 | "providerLogGroupName": "providerLoggingGroupName",
26 | "hookEncryptionKeyArn": "hookEncryptionKeyArn",
27 | "hookEncryptionKeyRole": "hookEncryptionKeyRole"
28 | },
29 | "requestContext": {
30 | "invocation": 2,
31 | "callbackContext": {
32 | "contextPropertyA": "Value"
33 | },
34 | "cloudWatchEventsRuleName": "reinvoke-handler-4754ac8a-623b-45fe-84bc-f5394118a8be",
35 | "cloudWatchEventsTargetId": "reinvoke-target-4754ac8a-623b-45fe-84bc-f5394118a8be"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/hook/test-target-schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "typeName": "Test::Resource::Type",
3 | "description": "a test schema",
4 | "properties": {
5 | "Property1": {
6 | "type": "string"
7 | },
8 | "Property2": {
9 | "type": "integer"
10 | },
11 | "Tags": {
12 | "type": "object"
13 | }
14 | },
15 | "primaryIdentifier": [
16 | "/properties/Property1"
17 | ],
18 | "readOnlyProperties": [
19 | "/properties/Property1"
20 | ],
21 | "additionalProperties": false
22 | }
23 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/list.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "LIST",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "resourceProperties": {
24 | "property1": "abc",
25 | "property2": 123
26 | }
27 | },
28 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/malformed.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "extraneousField": "notexpected",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "physicalResourceId": "",
24 | "resourceProperties": {},
25 | "systemTags": {
26 | "aws:cloudformation:stack-id": "SampleStack"
27 | },
28 | "stackTags": {
29 | "tag1": "abc"
30 | },
31 | "previousStackTags": {
32 | "tag1": "def"
33 | }
34 | },
35 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/no-response-endpoint.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "CREATE",
6 | "responseEndpoint": "",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "resourceProperties": {
24 | "property1": "abc",
25 | "property2": 123
26 | },
27 | "systemTags": {
28 | "aws:cloudformation:stack-id": "SampleStack"
29 | },
30 | "stackTags": {
31 | "tag1": "abc"
32 | },
33 | "previousStackTags": {
34 | "tag1": "def"
35 | }
36 | },
37 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/read.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "READ",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "resourceProperties": {
24 | "property1": "abc",
25 | "property2": 123
26 | }
27 | },
28 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/update.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "UPDATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestContext": {},
10 | "requestData": {
11 | "callerCredentials": {
12 | "accessKeyId": "IASAYK835GAIFHAHEI23",
13 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
14 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
15 | },
16 | "providerCredentials": {
17 | "accessKeyId": "HDI0745692Y45IUTYR78",
18 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
19 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
20 | },
21 | "providerLogGroupName": "providerLoggingGroupName",
22 | "logicalResourceId": "myBucket",
23 | "resourceProperties": {
24 | "property1": "abc",
25 | "property2": 123
26 | },
27 | "previousResourceProperties": {},
28 | "systemTags": {
29 | "aws:cloudformation:stack-id": "SampleStack"
30 | },
31 | "stackTags": {
32 | "tag1": "abc"
33 | },
34 | "previousStackTags": {
35 | "tag1": "def"
36 | }
37 | },
38 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
39 | }
40 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/update.with-callback-context.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "UPDATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "callbackContext": {
10 | "contextPropertyA": "Value"
11 | },
12 | "requestData": {
13 | "callerCredentials": {
14 | "accessKeyId": "IASAYK835GAIFHAHEI23",
15 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
16 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
17 | },
18 | "providerCredentials": {
19 | "accessKeyId": "HDI0745692Y45IUTYR78",
20 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
21 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
22 | },
23 | "providerLogGroupName": "providerLoggingGroupName",
24 | "logicalResourceId": "myBucket",
25 | "resourceProperties": {},
26 | "previousResourceProperties": {},
27 | "systemTags": {
28 | "aws:cloudformation:stack-id": "SampleStack"
29 | },
30 | "stackTags": {
31 | "tag1": "abc"
32 | },
33 | "previousStackTags": {
34 | "tag1": "def"
35 | }
36 | },
37 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/data/update.without-callback-context.request.json:
--------------------------------------------------------------------------------
1 | {
2 | "awsAccountId": "123456789012",
3 | "bearerToken": "123456",
4 | "region": "us-east-1",
5 | "action": "UPDATE",
6 | "responseEndpoint": "https://cloudformation.us-west-2.amazonaws.com",
7 | "resourceType": "AWS::Test::TestModel",
8 | "resourceTypeVersion": "1.0",
9 | "requestData": {
10 | "callerCredentials": {
11 | "accessKeyId": "IASAYK835GAIFHAHEI23",
12 | "secretAccessKey": "66iOGPN5LnpZorcLr8Kh25u8AbjHVllv5/poh2O0",
13 | "sessionToken": "lameHS2vQOknSHWhdFYTxm2eJc1JMn9YBNI4nV4mXue945KPL6DHfW8EsUQT5zwssYEC1NvYP9yD6Y5s5lKR3chflOHPFsIe6eqg"
14 | },
15 | "providerCredentials": {
16 | "accessKeyId": "HDI0745692Y45IUTYR78",
17 | "secretAccessKey": "4976TUYVI234/5GW87ERYG823RF87GY9EIUH452I3",
18 | "sessionToken": "842HYOFIQAEUDF78R8T7IU43HSADYGIFHBJSDHFA87SDF9PYvN1CEYASDUYFT5TQ97YASIHUDFAIUEYRISDKJHFAYSUDTFSDFADS"
19 | },
20 | "providerLogGroupName": "providerLoggingGroupName",
21 | "logicalResourceId": "myBucket",
22 | "resourceProperties": {},
23 | "previousResourceProperties": {},
24 | "systemTags": {
25 | "aws:cloudformation:stack-id": "SampleStack"
26 | },
27 | "stackTags": {
28 | "tag1": "abc"
29 | },
30 | "previousStackTags": {
31 | "tag1": "def"
32 | }
33 | },
34 | "stackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/e722ae60-fe62-11e8-9a0e-0ae8cc519968"
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/handler/Model.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.handler;
16 |
17 | import com.fasterxml.jackson.annotation.JsonProperty;
18 | import java.util.Date;
19 | import java.util.Set;
20 |
21 | @lombok.Builder
22 | @lombok.Data
23 | @lombok.EqualsAndHashCode
24 | @lombok.ToString
25 | @lombok.NoArgsConstructor
26 | @lombok.AllArgsConstructor
27 | public class Model {
28 | public static final String TYPE_NAME = "AWS::Code::Repository";
29 |
30 | @JsonProperty("RepoName")
31 | private String repoName;
32 | @JsonProperty("Users")
33 | private Set users;
34 | @JsonProperty("Arn")
35 | private String arn;
36 | @JsonProperty("Created")
37 | private Date created;
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/handler/TypeConfigurationModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.handler;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Builder;
19 | import lombok.Data;
20 |
21 | @Data
22 | @AllArgsConstructor
23 | @Builder
24 | public class TypeConfigurationModel {
25 |
26 | private String property1;
27 |
28 | private Integer property2;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/handler/hook/HookModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.handler.hook;
16 |
17 | import com.fasterxml.jackson.annotation.JsonProperty;
18 |
19 | @lombok.Builder
20 | @lombok.Data
21 | @lombok.EqualsAndHashCode
22 | @lombok.ToString
23 | @lombok.NoArgsConstructor
24 | @lombok.AllArgsConstructor
25 | public class HookModel {
26 | public static final String TYPE_NAME = "AWS::CFN::Hook";
27 |
28 | @JsonProperty("InputParameter")
29 | private String inputParameter;
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/hook/targetmodel/GenericTestResource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook.targetmodel;
16 |
17 | import com.fasterxml.jackson.annotation.JsonIgnore;
18 | import java.util.List;
19 | import org.json.JSONObject;
20 |
21 | /**
22 | * This test class represents a resource where the resource schema was not
23 | * provided at build time.
24 | */
25 | public class GenericTestResource extends ResourceHookTarget {
26 | @Override
27 | public JSONObject getPrimaryIdentifier() {
28 | return null;
29 | }
30 |
31 | @Override
32 | public List getAdditionalIdentifiers() {
33 | return null;
34 | }
35 |
36 | @Override
37 | public JSONObject targetSchemaJSONObject() {
38 | return null;
39 | }
40 |
41 | @Override
42 | public Boolean hasDefinedSchema() {
43 | return false;
44 | }
45 |
46 | @JsonIgnore
47 | @Override
48 | public Boolean isCloudFormationRegistryType() {
49 | return false;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/hook/targetmodel/GenericTestResourceHookTargetModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.hook.targetmodel;
16 |
17 | import com.fasterxml.jackson.core.type.TypeReference;
18 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
19 |
20 | @JsonDeserialize(as = GenericTestResourceHookTargetModel.class)
21 | public class GenericTestResourceHookTargetModel extends ResourceHookTargetModel {
22 | @Override
23 | public TypeReference getHookTargetTypeReference() {
24 | return new TypeReference() {
25 | };
26 | }
27 |
28 | @Override
29 | public TypeReference getTargetModelTypeReference() {
30 | return new TypeReference() {
31 | };
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/service/AccessDenied.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.service;
16 |
17 | import software.amazon.awssdk.awscore.exception.AwsServiceException;
18 |
19 | public class AccessDenied extends AwsServiceException {
20 | private static final long serialVersionUID = 1L;
21 |
22 | public AccessDenied(AwsServiceException.Builder builder) {
23 | super(builder);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/service/BadRequestException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.service;
16 |
17 | import software.amazon.awssdk.awscore.exception.AwsServiceException;
18 |
19 | public class BadRequestException extends AwsServiceException {
20 | private static final long serialVersionUID = 1L;
21 |
22 | public BadRequestException(AwsServiceException.Builder builder) {
23 | super(builder);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/service/ExistsException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.service;
16 |
17 | import software.amazon.awssdk.awscore.exception.AwsServiceException;
18 |
19 | public class ExistsException extends AwsServiceException {
20 | private static final long serialVersionUID = 1L;
21 |
22 | public ExistsException(Builder builder) {
23 | super(builder);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/service/NotFoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.service;
16 |
17 | import org.mockito.Mockito;
18 | import software.amazon.awssdk.awscore.exception.AwsErrorDetails;
19 | import software.amazon.awssdk.awscore.exception.AwsServiceException;
20 | import software.amazon.awssdk.http.SdkHttpResponse;
21 |
22 | public class NotFoundException extends AwsServiceException {
23 | private static final long serialVersionUID = 1L;
24 | private final SdkHttpResponse response;
25 |
26 | public NotFoundException(AwsServiceException.Builder builder) {
27 | super(builder);
28 | response = Mockito.mock(SdkHttpResponse.class);
29 | Mockito.when(response.statusCode()).thenReturn(404);
30 | }
31 |
32 | @Override
33 | public AwsErrorDetails awsErrorDetails() {
34 | return AwsErrorDetails.builder().errorCode("NotFound").errorMessage("Repo not existing").sdkHttpResponse(response)
35 | .build();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/service/Repository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.service;
16 |
17 | import java.util.Date;
18 | import java.util.Set;
19 |
20 | @lombok.Data
21 | @lombok.EqualsAndHashCode
22 | @lombok.ToString
23 | class Repository {
24 | private String repoName;
25 | private Set users;
26 | private String arn;
27 | private Date created;
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/service/ServiceClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.service;
16 |
17 | import software.amazon.awssdk.core.SdkClient;
18 |
19 | public interface ServiceClient extends SdkClient {
20 |
21 | default String serviceName() {
22 | return "serviceClient";
23 | }
24 |
25 | CreateResponse createRepository(CreateRequest r);
26 |
27 | DescribeResponse describeRepository(DescribeRequest r);
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/proxy/service/ThrottleException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.proxy.service;
16 |
17 | import software.amazon.awssdk.awscore.exception.AwsServiceException;
18 |
19 | public class ThrottleException extends AwsServiceException {
20 | private static final long serialVersionUID = 1L;
21 |
22 | public ThrottleException(Builder builder) {
23 | super(builder);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/scheduler/PutRuleRequestMatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.scheduler;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Data;
19 | import org.mockito.ArgumentMatcher;
20 | import software.amazon.awssdk.services.cloudwatchevents.model.PutRuleRequest;
21 | import software.amazon.awssdk.services.cloudwatchevents.model.RuleState;
22 |
23 | @Data
24 | @AllArgsConstructor
25 | public class PutRuleRequestMatcher implements ArgumentMatcher {
26 |
27 | private String name;
28 | private String scheduleExpression;
29 | private RuleState state;
30 |
31 | @Override
32 | public boolean matches(final PutRuleRequest argument) {
33 | return argument.description() == null && argument.eventPattern() == null && argument.name().startsWith(name)
34 | && argument.roleArn() == null && argument.scheduleExpression().equals(scheduleExpression)
35 | && argument.state().equals(state);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/scheduler/PutTargetsRequestMatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.scheduler;
16 |
17 | import java.util.List;
18 | import lombok.AllArgsConstructor;
19 | import lombok.Data;
20 | import org.mockito.ArgumentMatcher;
21 | import software.amazon.awssdk.services.cloudwatchevents.model.PutTargetsRequest;
22 | import software.amazon.awssdk.services.cloudwatchevents.model.Target;
23 |
24 | @Data
25 | @AllArgsConstructor
26 | public class PutTargetsRequestMatcher implements ArgumentMatcher {
27 |
28 | private final String rule;
29 | private final ArgumentMatcher> targetArgumentMatcher;
30 |
31 | @Override
32 | public boolean matches(final PutTargetsRequest argument) {
33 | return argument.rule().startsWith(rule) && targetArgumentMatcher.matches(argument.targets());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/scheduler/TargetMatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.scheduler;
16 |
17 | import lombok.AllArgsConstructor;
18 | import lombok.Data;
19 | import org.mockito.ArgumentMatcher;
20 | import software.amazon.awssdk.services.cloudwatchevents.model.Target;
21 |
22 | @Data
23 | @AllArgsConstructor
24 | public class TargetMatcher implements ArgumentMatcher {
25 |
26 | private final String arn;
27 | private final String id;
28 | private final Object input;
29 |
30 | @Override
31 | public boolean matches(final Target argument) {
32 | return argument.arn().equals(arn) && argument.id().startsWith(id) && argument.input().equals(input);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/java/software/amazon/cloudformation/scheduler/TargetsListMatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 | package software.amazon.cloudformation.scheduler;
16 |
17 | import java.util.List;
18 | import lombok.AllArgsConstructor;
19 | import lombok.Data;
20 | import org.mockito.ArgumentMatcher;
21 | import software.amazon.awssdk.services.cloudwatchevents.model.Target;
22 |
23 | @Data
24 | @AllArgsConstructor
25 | public class TargetsListMatcher implements ArgumentMatcher> {
26 |
27 | private final List targetMatchers;
28 |
29 | @Override
30 | public boolean matches(final List argument) {
31 | for (int i = 0; i < argument.size(); i++) {
32 | if (!targetMatchers.get(i).matches(argument.get(i))) {
33 | return false;
34 | }
35 | }
36 | return true;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker:
--------------------------------------------------------------------------------
1 | mock-maker-inline
2 |
--------------------------------------------------------------------------------
/src/test/resources/software/amazon/cloudformation/proxy/handler/hook/hookModel.json:
--------------------------------------------------------------------------------
1 | {
2 | "typeName": "AWS::CFN::Hook",
3 | "description": "Hook Type definition for AWS::CFN::Hook",
4 | "properties": {
5 | "InputParameter": {
6 | "type": "string"
7 | }
8 | },
9 | "required": [
10 | "InputParameter"
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/src/test/resources/software/amazon/cloudformation/proxy/handler/model.json:
--------------------------------------------------------------------------------
1 | {
2 | "typeName": "AWS::Code::Repository",
3 | "description": "Resource Type definition for AWS::Code::Repository",
4 | "properties": {
5 | "Arn": {
6 | "type": "string"
7 | },
8 | "RepoName": {
9 | "type": "string"
10 | },
11 | "Users": {
12 | "type": "array",
13 | "uniqueItems": true,
14 | "items": {
15 | "type": "string"
16 | }
17 | },
18 | "Created": {
19 | "type": "string",
20 | "format": "date-time"
21 | }
22 | },
23 | "required": [
24 | "RepoName"
25 | ],
26 | "additionalProperties": false,
27 | "readOnlyProperties": [
28 | "/properties/Arn",
29 | "/properties/Created"
30 | ],
31 | "createOnlyProperties": [
32 | "/properties/RepoName"
33 | ],
34 | "primaryIdentifier": [
35 | "/properties/RepoName"
36 | ]
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/resources/software/amazon/cloudformation/proxy/hook/targetmodel/test-target-schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "typeName": "Test::Resource::Type",
3 | "description": "a test schema",
4 | "properties": {
5 | "Property1": {
6 | "type": "string"
7 | },
8 | "Property2": {
9 | "type": "integer"
10 | },
11 | "Tags": {
12 | "type": "object"
13 | }
14 | },
15 | "primaryIdentifier": [
16 | "/properties/Property1"
17 | ],
18 | "readOnlyProperties": [
19 | "/properties/Property1"
20 | ],
21 | "additionalProperties": false
22 | }
23 |
--------------------------------------------------------------------------------
/src/test/resources/software/amazon/cloudformation/wrapper-override.json:
--------------------------------------------------------------------------------
1 | {
2 | "typeName": "Test::Resource::Type",
3 | "description": "Description",
4 | "definitions": {
5 | "subProperty": {
6 | "type": "object",
7 | "properties": {
8 | "propertyArray": {
9 | "type": "array",
10 | "items": {
11 | "type": "string"
12 | }
13 | }
14 | },
15 | "additionalProperties": false
16 | }
17 | },
18 | "properties": {
19 | "property1": {
20 | "type": "string"
21 | },
22 | "property2": {
23 | "type": "integer"
24 | },
25 | "property3": {
26 | "type": "object",
27 | "properties": {
28 | "subProperty": {
29 | "$ref": "#/definitions/subProperty"
30 | }
31 | },
32 | "additionalProperties": false
33 | }
34 | },
35 | "additionalProperties": false,
36 | "primaryIdentifier": [
37 | "/properties/property1"
38 | ]
39 | }
40 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-cloudformation/cloudformation-cli-java-plugin/d5ad0b721977a1fc3d9a271b989faa529a35b8ce/tests/__init__.py
--------------------------------------------------------------------------------
/tests/data/hook-schema-with-typeconfiguration.json:
--------------------------------------------------------------------------------
1 | {
2 | "typeName": "Company::Test::Hook",
3 | "description": "Test hook type",
4 | "definitions": {
5 | "cidrBlock": {
6 | "$comment": "TODO: regex could be more strict, for example this allows the cidr 999.999.999.999 and 999.999.999.999/32",
7 | "description": "Classless Inter-Domain Routing (CIDR) block",
8 | "type": "string",
9 | "pattern": "^([0-9]{1,3}.){3}[0-9]{1,3}(/([0-9]|[1-2][0-9]|3[0-2]))?$"
10 | }
11 | },
12 | "typeConfiguration": {
13 | "properties": {
14 | "limitSize": {
15 | "description": "string",
16 | "type": "string"
17 | },
18 | "cidr": {
19 | "$ref": "#/definitions/cidrBlock"
20 | }
21 | },
22 | "additionalProperties": false
23 | },
24 | "required": [
25 | "limitSize"
26 | ],
27 | "handlers": {
28 | "preCreate": {
29 | "targetNames": [
30 | "AWS::S3::Bucket",
31 | "AWS::SQS::Queue",
32 | "AWS::AutoScaling::AutoScalingGroup",
33 | "AWS::Route53::HealthCheck"
34 | ],
35 | "permissions": [
36 | "s3:ListBucket",
37 | "sqs:ListQueues"
38 | ]
39 | },
40 | "preUpdate": {
41 | "targetNames": [
42 | "AWS::S3::Bucket"
43 | ],
44 | "permissions": [
45 | "s3:ListBucket"
46 | ]
47 | }
48 | },
49 | "additionalProperties": false
50 | }
51 |
--------------------------------------------------------------------------------
/tests/data/hook-schema-without-typeconfiguration.json:
--------------------------------------------------------------------------------
1 | {
2 | "typeName": "Company::Test::Hook",
3 | "description": "Test hook type",
4 | "definitions": {
5 | "cidrBlock": {
6 | "$comment": "TODO: regex could be more strict, for example this allows the cidr 999.999.999.999 and 999.999.999.999/32",
7 | "description": "Classless Inter-Domain Routing (CIDR) block",
8 | "type": "string",
9 | "pattern": "^([0-9]{1,3}.){3}[0-9]{1,3}(/([0-9]|[1-2][0-9]|3[0-2]))?$"
10 | }
11 | },
12 | "properties": {
13 | "limitSize": {
14 | "description": "string",
15 | "type": "string"
16 | },
17 | "cidr": {
18 | "$ref": "#/definitions/cidrBlock"
19 | },
20 | "encryptionAlgorithm": {
21 | "description": "Encryption algorithm for SSE",
22 | "default": "AES256",
23 | "type": "string"
24 | }
25 | },
26 | "required": [
27 | "limitSize"
28 | ],
29 | "handlers": {
30 | "preCreate": {
31 | "targetNames": [
32 | "AWS::S3::Bucket",
33 | "AWS::SQS::Queue",
34 | "AWS::AutoScaling::AutoScalingGroup",
35 | "AWS::Route53::HealthCheck"
36 | ],
37 | "permissions": [
38 | "s3:ListBucket",
39 | "sqs:ListQueues"
40 | ]
41 | },
42 | "preUpdate": {
43 | "targetNames": [
44 | "AWS::S3::Bucket"
45 | ],
46 | "permissions": [
47 | "s3:ListBucket"
48 | ]
49 | }
50 | },
51 | "additionalProperties": false
52 | }
53 |
--------------------------------------------------------------------------------
/tests/data/schema-with-typeconfiguration.json:
--------------------------------------------------------------------------------
1 | {
2 | "typeName": "Company::Test::Type",
3 | "description": "Test type",
4 | "typeConfiguration": {
5 | "properties": {
6 | "Credentials": {
7 | "$ref": "#/definitions/Credentials"
8 | }
9 | },
10 | "additionalProperties": false,
11 | "required": [
12 | "Credentials"
13 | ]
14 | },
15 | "definitions": {
16 | "Credentials": {
17 | "type": "object",
18 | "properties": {
19 | "ApiKey": {
20 | "description": "API key",
21 | "type": "string"
22 | },
23 | "ApplicationKey": {
24 | "description": "application key",
25 | "type": "string"
26 | },
27 | "CountryCode": {
28 | "type": "string"
29 | }
30 | },
31 | "additionalProperties": false
32 | }
33 | },
34 | "properties": {
35 | "Type": {
36 | "type": "string",
37 | "description": "The type of the monitor",
38 | "enum": [
39 | "composite"
40 | ]
41 | }
42 | },
43 | "required": [
44 | "Type"
45 | ],
46 | "primaryIdentifier": [
47 | "/properties/Type"
48 | ],
49 | "additionalProperties": false
50 | }
51 |
--------------------------------------------------------------------------------
/tests/data/schema-without-typeconfiguration.json:
--------------------------------------------------------------------------------
1 | {
2 | "typeName": "Company::Test::Type",
3 | "description": "Test type",
4 | "definitions": {
5 | "Credentials": {
6 | "type": "object",
7 | "properties": {
8 | "ApiKey": {
9 | "description": "API key",
10 | "type": "string"
11 | },
12 | "ApplicationKey": {
13 | "description": "application key",
14 | "type": "string"
15 | },
16 | "CountryCode": {
17 | "type": "string"
18 | }
19 | },
20 | "additionalProperties": false
21 | }
22 | },
23 | "properties": {
24 | "Type": {
25 | "type": "string",
26 | "description": "The type of the monitor",
27 | "enum": [
28 | "composite"
29 | ]
30 | }
31 | },
32 | "required": [
33 | "Type"
34 | ],
35 | "primaryIdentifier": [
36 | "/properties/Type"
37 | ],
38 | "additionalProperties": false
39 | }
40 |
--------------------------------------------------------------------------------
/tests/flattened_schema.py:
--------------------------------------------------------------------------------
1 | FLATTENED_SCHEMA = {
2 | ("definitions", "location"): {
3 | "type": "object",
4 | "properties": {
5 | "country": {"type": "string"},
6 | "stateNumber": {"type": "integer"},
7 | },
8 | },
9 | ("properties", "coordinate", "items"): {
10 | "type": "object",
11 | "properties": {"lat": {"type": "number"}, "long": {"type": "number"}},
12 | },
13 | (): {
14 | "type": "object",
15 | "properties": {
16 | "state": {"$ref": ("definitions", "location")},
17 | "coordinates": {
18 | "type": "array",
19 | "items": {"$ref": ("properties", "coordinate", "items")},
20 | },
21 | "surroundingStates": {
22 | "type": "object",
23 | "patternProperties": {
24 | "[A-Za-z0-9]{1,64}": {"$ref": ("definitions", "location")}
25 | },
26 | },
27 | },
28 | },
29 | }
30 |
--------------------------------------------------------------------------------