├── .gitmodules ├── 1-ecs-monolith-stack ├── .gitignore ├── README.md ├── app.py ├── cdk.json ├── docker │ └── Dockerfile ├── ecs_monolith │ ├── __init__.py │ └── ecs_monolith_stack.py └── requirements.txt ├── 2-ecs-microservice-stack ├── .gitignore ├── README.md ├── app.py ├── cdk.json ├── ecs_microservice │ ├── __init__.py │ └── ecs_microservice_stack.py ├── requirements.txt └── work │ ├── build.sh │ └── source │ ├── Dockerfile │ ├── application-mysql.properties │ ├── application.properties │ ├── code │ ├── ApiGatewayApplication.java │ ├── CustomersServiceApplication.java │ ├── VetsServiceApplication.java │ ├── VisitsServiceApplication.java │ └── owner-details.controller.js │ ├── customers_pom.xml │ ├── logback-spring.xml │ ├── root_pom.xml │ ├── static_pom.xml │ ├── vets_pom.xml │ └── visits_pom.xml ├── 3-serverless-microservice-stack ├── .gitignore ├── README.md ├── app.py ├── cdk.json ├── custom-resource-code │ └── init.py ├── requirements.txt ├── serverless │ ├── __init__.py │ └── serverless_stack.py ├── spring-petclinic-serverless │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ ├── spring-petclinic-customers-serverless │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── customers │ │ │ │ ├── CustomersServiceApplication.java │ │ │ │ ├── LambdaHandler.java │ │ │ │ ├── StreamLambdaHandler.java │ │ │ │ ├── common │ │ │ │ └── DynamoDBConfig.java │ │ │ │ ├── model │ │ │ │ ├── Owner.java │ │ │ │ ├── OwnerRepository.java │ │ │ │ └── Pet.java │ │ │ │ └── web │ │ │ │ ├── OwnerResource.java │ │ │ │ ├── PetDetails.java │ │ │ │ ├── PetRequest.java │ │ │ │ ├── PetResource.java │ │ │ │ └── ResourceNotFoundException.java │ │ │ └── resources │ │ │ └── logback-spring.xml │ ├── spring-petclinic-vets-serverless │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── vets │ │ │ │ ├── StreamLambdaHandler.java │ │ │ │ ├── VetsServiceApplication.java │ │ │ │ ├── common │ │ │ │ └── DynamoDBConfig.java │ │ │ │ ├── model │ │ │ │ ├── Vet.java │ │ │ │ └── VetRepository.java │ │ │ │ └── web │ │ │ │ └── VetResource.java │ │ │ └── resources │ │ │ └── logback-spring.xml │ └── spring-petclinic-visits-serverless │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── visits │ │ │ ├── StreamLambdaHandler.java │ │ │ ├── VisitsServiceApplication.java │ │ │ ├── common │ │ │ └── DynamoDBConfig.java │ │ │ ├── model │ │ │ ├── Visit.java │ │ │ └── VisitRepository.java │ │ │ └── web │ │ │ └── VisitResource.java │ │ └── resources │ │ └── logback-spring.xml └── spring-petclinic-static │ ├── css │ └── petclinic.css │ ├── data │ ├── owner.json │ ├── vet.json │ └── visit.json │ ├── fonts │ ├── montserrat-webfont.eot │ ├── montserrat-webfont.svg │ ├── montserrat-webfont.ttf │ ├── montserrat-webfont.woff │ ├── varela_round-webfont.eot │ ├── varela_round-webfont.svg │ ├── varela_round-webfont.ttf │ └── varela_round-webfont.woff │ ├── images │ ├── favicon.png │ ├── pets.png │ ├── platform-bg.png │ ├── spring-logo-dataflow-mobile.png │ ├── spring-logo-dataflow.png │ └── spring-pivotal-logo.png │ ├── index.html │ ├── scripts │ ├── app.js │ ├── config.js │ ├── fragments │ │ ├── footer.html │ │ ├── nav.html │ │ └── welcome.html │ ├── owner-details │ │ ├── owner-details.component.js │ │ ├── owner-details.controller.js │ │ ├── owner-details.js │ │ └── owner-details.template.html │ ├── owner-form │ │ ├── owner-form.component.js │ │ ├── owner-form.controller.js │ │ ├── owner-form.js │ │ └── owner-form.template.html │ ├── owner-list │ │ ├── owner-list.component.js │ │ ├── owner-list.controller.js │ │ ├── owner-list.js │ │ └── owner-list.template.html │ ├── pet-form │ │ ├── pet-form.component.js │ │ ├── pet-form.controller.js │ │ ├── pet-form.js │ │ └── pet-form.template.html │ ├── vet-list │ │ ├── vet-list.component.js │ │ ├── vet-list.controller.js │ │ ├── vet-list.js │ │ └── vet-list.template.html │ └── visits │ │ ├── visits.component.js │ │ ├── visits.controller.js │ │ ├── visits.js │ │ └── visits.template.html │ └── vendors │ ├── angular-ui-router │ ├── angular-ui-router.js │ └── angular-ui-router.min.js │ ├── angularjs │ └── angular.min.js │ ├── bootstrap │ ├── .editorconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .hound.yml │ ├── .travis.yml │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ └── npm.js │ └── jquery │ └── jquery.min.js ├── 4-serverless-cicd-stack ├── .gitignore ├── README.md ├── customer-service-cicd │ ├── .gitignore │ ├── README.md │ ├── app.py │ ├── cdk.json │ ├── custom-resource-code │ │ ├── cfnresponse.py │ │ ├── index.py │ │ └── owner.json │ ├── pom.xml │ ├── requirements.txt │ ├── serverless_cicd │ │ ├── __init__.py │ │ └── serverless_cicd_stack.py │ ├── serverless_lambda │ │ ├── __init__.py │ │ └── serverless_lambda_stack.py │ ├── setup.py │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── customers │ │ │ ├── CustomersServiceApplication.java │ │ │ ├── LambdaHandler.java │ │ │ ├── StreamLambdaHandler.java │ │ │ ├── common │ │ │ └── DynamoDBConfig.java │ │ │ ├── model │ │ │ ├── Owner.java │ │ │ ├── OwnerRepository.java │ │ │ └── Pet.java │ │ │ └── web │ │ │ ├── OwnerResource.java │ │ │ ├── PetDetails.java │ │ │ ├── PetRequest.java │ │ │ ├── PetResource.java │ │ │ └── ResourceNotFoundException.java │ │ └── resources │ │ └── logback-spring.xml ├── images │ ├── 1.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ └── 9.png ├── static-service-cicd │ ├── .gitignore │ ├── app.py │ ├── cdk.json │ ├── requirements.txt │ ├── static-resource │ │ ├── css │ │ │ └── petclinic.css │ │ ├── data │ │ │ ├── owner.json │ │ │ ├── vet.json │ │ │ └── visit.json │ │ ├── fonts │ │ │ ├── montserrat-webfont.eot │ │ │ ├── montserrat-webfont.svg │ │ │ ├── montserrat-webfont.ttf │ │ │ ├── montserrat-webfont.woff │ │ │ ├── varela_round-webfont.eot │ │ │ ├── varela_round-webfont.svg │ │ │ ├── varela_round-webfont.ttf │ │ │ └── varela_round-webfont.woff │ │ ├── images │ │ │ ├── favicon.png │ │ │ ├── pets.png │ │ │ ├── platform-bg.png │ │ │ ├── spring-logo-dataflow-mobile.png │ │ │ ├── spring-logo-dataflow.png │ │ │ └── spring-pivotal-logo.png │ │ ├── index.html │ │ ├── scripts │ │ │ ├── app.js │ │ │ ├── config.js │ │ │ ├── fragments │ │ │ │ ├── footer.html │ │ │ │ ├── nav.html │ │ │ │ └── welcome.html │ │ │ ├── owner-details │ │ │ │ ├── owner-details.component.js │ │ │ │ ├── owner-details.controller.js │ │ │ │ ├── owner-details.js │ │ │ │ └── owner-details.template.html │ │ │ ├── owner-form │ │ │ │ ├── owner-form.component.js │ │ │ │ ├── owner-form.controller.js │ │ │ │ ├── owner-form.js │ │ │ │ └── owner-form.template.html │ │ │ ├── owner-list │ │ │ │ ├── owner-list.component.js │ │ │ │ ├── owner-list.controller.js │ │ │ │ ├── owner-list.js │ │ │ │ └── owner-list.template.html │ │ │ ├── pet-form │ │ │ │ ├── pet-form.component.js │ │ │ │ ├── pet-form.controller.js │ │ │ │ ├── pet-form.js │ │ │ │ └── pet-form.template.html │ │ │ ├── vet-list │ │ │ │ ├── vet-list.component.js │ │ │ │ ├── vet-list.controller.js │ │ │ │ ├── vet-list.js │ │ │ │ └── vet-list.template.html │ │ │ └── visits │ │ │ │ ├── visits.component.js │ │ │ │ ├── visits.controller.js │ │ │ │ ├── visits.js │ │ │ │ └── visits.template.html │ │ └── vendors │ │ │ ├── angular-ui-router │ │ │ ├── angular-ui-router.js │ │ │ └── angular-ui-router.min.js │ │ │ ├── angularjs │ │ │ └── angular.min.js │ │ │ ├── bootstrap │ │ │ ├── .editorconfig │ │ │ ├── .gitattributes │ │ │ ├── .gitignore │ │ │ ├── .hound.yml │ │ │ ├── .travis.yml │ │ │ ├── css │ │ │ │ ├── bootstrap-theme.css │ │ │ │ ├── bootstrap-theme.css.map │ │ │ │ ├── bootstrap-theme.min.css │ │ │ │ ├── bootstrap-theme.min.css.map │ │ │ │ ├── bootstrap.css │ │ │ │ ├── bootstrap.css.map │ │ │ │ ├── bootstrap.min.css │ │ │ │ └── bootstrap.min.css.map │ │ │ ├── fonts │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ └── js │ │ │ │ ├── bootstrap.js │ │ │ │ ├── bootstrap.min.js │ │ │ │ └── npm.js │ │ │ └── jquery │ │ │ └── jquery.min.js │ └── static_cicd │ │ ├── __init__.py │ │ └── static_cicd_stack.py ├── vet-service-cicd │ ├── .gitignore │ ├── README.md │ ├── app.py │ ├── cdk.json │ ├── custom-resource-code │ │ ├── cfnresponse.py │ │ ├── index.py │ │ └── vet.json │ ├── pom.xml │ ├── requirements.txt │ ├── serverless_cicd │ │ ├── __init__.py │ │ └── serverless_cicd_stack.py │ ├── serverless_lambda │ │ ├── __init__.py │ │ └── serverless_lambda_stack.py │ ├── setup.py │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── vets │ │ │ ├── StreamLambdaHandler.java │ │ │ ├── VetsServiceApplication.java │ │ │ ├── common │ │ │ └── DynamoDBConfig.java │ │ │ ├── model │ │ │ ├── Vet.java │ │ │ └── VetRepository.java │ │ │ └── web │ │ │ └── VetResource.java │ │ └── resources │ │ └── logback-spring.xml └── visit-service-cicd │ ├── .gitignore │ ├── README.md │ ├── app.py │ ├── cdk.json │ ├── custom-resource-code │ ├── cfnresponse.py │ ├── index.py │ └── visit.json │ ├── pom.xml │ ├── requirements.txt │ ├── serverless_cicd │ ├── __init__.py │ └── serverless_cicd_stack.py │ ├── serverless_lambda │ ├── __init__.py │ └── serverless_lambda_stack.py │ ├── setup.py │ └── src │ └── main │ ├── java │ └── org │ │ └── springframework │ │ └── samples │ │ └── petclinic │ │ └── visits │ │ ├── StreamLambdaHandler.java │ │ ├── VisitsServiceApplication.java │ │ ├── common │ │ └── DynamoDBConfig.java │ │ ├── model │ │ ├── Visit.java │ │ └── VisitRepository.java │ │ └── web │ │ └── VisitResource.java │ └── resources │ └── logback-spring.xml ├── 5-serverless-xray-stack ├── .gitignore ├── README.md ├── app.py ├── cdk.json ├── custom-resource-code │ └── init.py ├── fagate_serverless │ ├── __init__.py │ └── fagate_serverless_stack.py ├── images │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ └── 8.png ├── requirements.txt ├── spring-petclinic-serverless │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ ├── spring-petclinic-customers-serverless │ │ ├── Dockerfile │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── org │ │ │ │ │ └── springframework │ │ │ │ │ └── samples │ │ │ │ │ └── petclinic │ │ │ │ │ └── customers │ │ │ │ │ ├── CustomersServiceApplication.java │ │ │ │ │ ├── common │ │ │ │ │ └── DynamoDBConfig.java │ │ │ │ │ ├── model │ │ │ │ │ ├── Owner.java │ │ │ │ │ ├── OwnerRepository.java │ │ │ │ │ └── Pet.java │ │ │ │ │ └── web │ │ │ │ │ ├── OwnerResource.java │ │ │ │ │ ├── PetDetails.java │ │ │ │ │ ├── PetRequest.java │ │ │ │ │ ├── PetResource.java │ │ │ │ │ └── ResourceNotFoundException.java │ │ │ └── resources │ │ │ │ ├── application.properties │ │ │ │ └── logback-spring.xml │ │ │ └── test │ │ │ └── resources │ │ │ ├── application-test.yml │ │ │ └── bootstrap-test.yml │ ├── spring-petclinic-vets-serverless │ │ ├── Dockerfile │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── org │ │ │ │ │ └── springframework │ │ │ │ │ └── samples │ │ │ │ │ └── petclinic │ │ │ │ │ └── vets │ │ │ │ │ ├── VetsServiceApplication.java │ │ │ │ │ ├── common │ │ │ │ │ └── DynamoDBConfig.java │ │ │ │ │ ├── model │ │ │ │ │ ├── Vet.java │ │ │ │ │ └── VetRepository.java │ │ │ │ │ └── web │ │ │ │ │ └── VetResource.java │ │ │ └── resources │ │ │ │ ├── application.properties │ │ │ │ └── logback-spring.xml │ │ │ └── test │ │ │ └── resources │ │ │ ├── application-test.yml │ │ │ └── bootstrap-test.yml │ └── spring-petclinic-visits-serverless │ │ ├── Dockerfile │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── visits │ │ │ │ ├── VisitsServiceApplication.java │ │ │ │ ├── common │ │ │ │ └── DynamoDBConfig.java │ │ │ │ ├── model │ │ │ │ ├── Visit.java │ │ │ │ └── VisitRepository.java │ │ │ │ └── web │ │ │ │ └── VisitResource.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── logback-spring.xml │ │ └── test │ │ └── resources │ │ ├── application-test.yml │ │ └── bootstrap-test.yml └── spring-petclinic-static │ ├── css │ └── petclinic.css │ ├── data │ ├── owner.json │ ├── vet.json │ └── visit.json │ ├── fonts │ ├── montserrat-webfont.eot │ ├── montserrat-webfont.svg │ ├── montserrat-webfont.ttf │ ├── montserrat-webfont.woff │ ├── varela_round-webfont.eot │ ├── varela_round-webfont.svg │ ├── varela_round-webfont.ttf │ └── varela_round-webfont.woff │ ├── images │ ├── favicon.png │ ├── pets.png │ ├── platform-bg.png │ ├── spring-logo-dataflow-mobile.png │ ├── spring-logo-dataflow.png │ └── spring-pivotal-logo.png │ ├── index.html │ ├── scripts │ ├── app.js │ ├── config.js │ ├── fragments │ │ ├── footer.html │ │ ├── nav.html │ │ └── welcome.html │ ├── owner-details │ │ ├── owner-details.component.js │ │ ├── owner-details.controller.js │ │ ├── owner-details.js │ │ └── owner-details.template.html │ ├── owner-form │ │ ├── owner-form.component.js │ │ ├── owner-form.controller.js │ │ ├── owner-form.js │ │ └── owner-form.template.html │ ├── owner-list │ │ ├── owner-list.component.js │ │ ├── owner-list.controller.js │ │ ├── owner-list.js │ │ └── owner-list.template.html │ ├── pet-form │ │ ├── pet-form.component.js │ │ ├── pet-form.controller.js │ │ ├── pet-form.js │ │ └── pet-form.template.html │ ├── vet-list │ │ ├── vet-list.component.js │ │ ├── vet-list.controller.js │ │ ├── vet-list.js │ │ └── vet-list.template.html │ └── visits │ │ ├── visits.component.js │ │ ├── visits.controller.js │ │ ├── visits.js │ │ └── visits.template.html │ └── vendors │ ├── angular-ui-router │ ├── angular-ui-router.js │ └── angular-ui-router.min.js │ ├── angularjs │ └── angular.min.js │ ├── bootstrap │ ├── .editorconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .hound.yml │ ├── .travis.yml │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ └── npm.js │ └── jquery │ └── jquery.min.js ├── 6-serverless-graphql-stack ├── .gitignore ├── AWS-AppSync.svg ├── AddPetPage.tsx ├── DateInput.tsx ├── Footer.tsx ├── README.md ├── UpdatePetPage.tsx ├── backend │ ├── app.py │ ├── app_sync_cdk │ │ ├── __pycache__ │ │ │ └── app_sync_cdk_stack.cpython-36.pyc │ │ └── app_sync_cdk_stack.py │ ├── cdk.json │ ├── custom-resource-code │ │ ├── cfnresponse.py │ │ ├── index.py │ │ ├── initDB.sql │ │ └── populateDB.sql │ ├── definition │ │ ├── petclinic.graphql │ │ └── template │ │ │ ├── function │ │ │ ├── request │ │ │ │ ├── Query_Owner_getOwnerById.json │ │ │ │ ├── Query_Owner_getPetsByOwner.json │ │ │ │ ├── Query_Owner_getVistsByPet.json │ │ │ │ ├── Query_Owners_getAllOwners.json │ │ │ │ ├── Query_Owners_getPetsByOwner.json │ │ │ │ ├── Query_Pet_getPetById.json │ │ │ │ ├── Query_Pet_getVisitByPet.json │ │ │ │ ├── Query_Vets_getSpecByVets.json │ │ │ │ └── Query_Vets_getVets.json │ │ │ └── response │ │ │ │ ├── Query_Owner_getOwnerById.vm │ │ │ │ ├── Query_Owner_getPetsByOwner.vm │ │ │ │ ├── Query_Owner_getVistsByPet.vm │ │ │ │ ├── Query_Owners_getAllOwners.vm │ │ │ │ ├── Query_Owners_getPetsByOwner.vm │ │ │ │ ├── Query_Pet_getPetById.vm │ │ │ │ ├── Query_Pet_getVisitByPet.vm │ │ │ │ ├── Query_Vets_getSpecByVets.vm │ │ │ │ └── Query_Vets_getVets.vm │ │ │ ├── mutation │ │ │ ├── request │ │ │ │ ├── addOwner.json │ │ │ │ ├── addPet.json │ │ │ │ ├── addSpecialty.json │ │ │ │ ├── addVisit.json │ │ │ │ ├── removeSpecialty.json │ │ │ │ ├── updateOwner.json │ │ │ │ ├── updatePet.json │ │ │ │ └── updateSpecialty.json │ │ │ └── response │ │ │ │ ├── addOwner.vm │ │ │ │ ├── addPet.vm │ │ │ │ ├── addSpecialty.vm │ │ │ │ ├── addVisit.vm │ │ │ │ ├── removeSpecialty.vm │ │ │ │ ├── updateOwner.vm │ │ │ │ ├── updatePet.vm │ │ │ │ └── updateSpecialty.vm │ │ │ └── query │ │ │ ├── request │ │ │ ├── pettypes.json │ │ │ └── specialties.json │ │ │ └── response │ │ │ ├── pettypes.vm │ │ │ └── specialties.vm │ └── requirements.txt ├── createGraphQLClient.tsx └── webpack.config.js ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE └── README.md /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "1-ecs-monolith-stack/spring-petclinic"] 2 | path = 1-ecs-monolith-stack/spring-petclinic 3 | url = https://github.com/spring-projects/spring-petclinic 4 | [submodule "2-ecs-microservice-stack/spring-petclinic-microservices"] 5 | path = 2-ecs-microservice-stack/spring-petclinic-microservices 6 | url = https://github.com/spring-petclinic/spring-petclinic-microservices.git 7 | [submodule "6-serverless-graphql-stack/spring-petclinic-graphql"] 8 | path = 6-serverless-graphql-stack/spring-petclinic-graphql 9 | url = https://github.com/spring-petclinic/spring-petclinic-graphql.git 10 | -------------------------------------------------------------------------------- /1-ecs-monolith-stack/.gitignore: -------------------------------------------------------------------------------- 1 | .env/ 2 | cdk.out/ 3 | cdk.context.json 4 | */__pycache__/ 5 | .DS_Store 6 | */.DS_Store/ 7 | */target/ -------------------------------------------------------------------------------- /1-ecs-monolith-stack/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Welcome to Spring Petclinic Monolith CDK Python project! 3 | 4 | This is a project for Python development with CDK. And you must have meet [requirement](../README.md#prerequisites) before to start below. 5 | 6 | First of all we need create the Spring Boot deployment JAR using: 7 | 8 | ```bash 9 | cd spring-petclinic && ./mvnw package -Dmaven.test.skip=true && mv target ../docker/ 10 | ``` 11 | 12 | We also manually create a virtualenv on MacOS and Linux in this project root folder: 13 | 14 | ```bash 15 | cd ../ && python3 -m venv .env 16 | ``` 17 | 18 | After the init process completes and the virtualenv is created, you can use the following 19 | step to activate your virtualenv. 20 | 21 | ```bash 22 | source .env/bin/activate 23 | ``` 24 | 25 | Once the virtualenv is activated, you can install the required dependencies. 26 | 27 | ```bash 28 | pip install -r requirements.txt 29 | ``` 30 | 31 | At this point you can now synthesize the CloudFormation template for this code. 32 | 33 | ```bash 34 | cdk synth 35 | ``` 36 | 37 | After review the CloudFormation template you can create the Docker Image which will upload to ECR Repo and deploy all the Infracture codes using: 38 | 39 | ```bash 40 | cdk deploy 41 | ``` 42 | 43 | Check the Spring Petclinic Application deployment is success by browse the CDK output AWS ELB url like 44 | 45 | ``` 46 | ecs-monolith-stack.Ec2ServiceServiceURL8FE8FAED = http://ecs-m-Ec2Se-17QZ5ETAVT9IO-2074181029.ap-northeast-1.elb.amazonaws.com 47 | ``` 48 | 49 | Finally you can clean up the whole stack by using: 50 | 51 | ```bash 52 | cdk destory 53 | ``` -------------------------------------------------------------------------------- /1-ecs-monolith-stack/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from ecs_monolith.ecs_monolith_stack import EcsMonolithStack 6 | 7 | app = core.App() 8 | 9 | EcsMonolithStack(app, "ecs-monolith-stack") 10 | 11 | app.synth() 12 | -------------------------------------------------------------------------------- /1-ecs-monolith-stack/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py" 3 | } 4 | -------------------------------------------------------------------------------- /1-ecs-monolith-stack/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | VOLUME /tmp 3 | ARG JAR_FILE 4 | ADD ./target/${JAR_FILE} app.jar 5 | RUN sh -c 'touch /app.jar' 6 | ENV JAVA_OPTS="" 7 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar --spring.datasource.initialization-mode=always" ] -------------------------------------------------------------------------------- /1-ecs-monolith-stack/ecs_monolith/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/1-ecs-monolith-stack/ecs_monolith/__init__.py -------------------------------------------------------------------------------- /1-ecs-monolith-stack/requirements.txt: -------------------------------------------------------------------------------- 1 | aws_cdk.core==1.191.0 2 | aws_cdk.aws_ec2==1.191.0 3 | aws_cdk.aws_ecs==1.191.0 4 | aws_cdk.aws_rds==1.191.0 5 | aws_cdk.aws_ecs_patterns==1.191.0 6 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/.gitignore: -------------------------------------------------------------------------------- 1 | .env/ 2 | cdk.out/ 3 | cdk.context.json 4 | */__pycache__/ 5 | .DS_Store 6 | */.DS_Store/ 7 | */target/ 8 | work/build/ 9 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Welcome to Spring Petclinic Microservice CDK Python project! 3 | 4 | This is a project for Python development with CDK. And you must have meet [requirement](../README.md#prerequisites) before to start below. 5 | 6 | First of all we need create the Spring Boot deployment JAR using: 7 | 8 | ```bash 9 | work/build.sh 10 | ``` 11 | 12 | This script will all the source codes from `spring-petclinic-microservices` repository, and run the MVN to compile the projects. 13 | 14 | We also manually create a virtualenv on MacOS and Linux in this project root folder: 15 | 16 | ```bash 17 | python3 -m venv .env 18 | ``` 19 | 20 | After the init process completes and the virtualenv is created, you can use the following 21 | step to activate your virtualenv. 22 | 23 | ```bash 24 | source .env/bin/activate 25 | ``` 26 | 27 | Once the virtualenv is activated, you can install the required dependencies. 28 | 29 | ```bash 30 | pip install -r requirements.txt 31 | ``` 32 | 33 | At this point you can now synthesize the CloudFormation template for this code. 34 | 35 | ```bash 36 | cdk synth 37 | ``` 38 | 39 | After review the CloudFormation template you can create the Docker Image which will upload to ECR Repo and deploy all the Infracture codes using: 40 | 41 | ```bash 42 | cdk deploy 43 | ``` 44 | 45 | Check the Spring Petclinic Application deployment is success by browse the CDK output AWS ELB url like 46 | 47 | ```bash 48 | ecs-microservice-stack.LoadBalancer = ecs-m-EcsLb-BO36NBDANAWP-1810594841.ap-northeast-1.elb.amazonaws.com 49 | ``` 50 | 51 | Finally you can clean up the whole stack by using: 52 | 53 | ```bash 54 | cdk destory 55 | ``` -------------------------------------------------------------------------------- /2-ecs-microservice-stack/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from ecs_microservice.ecs_microservice_stack import EcsMicroserviceStack 6 | 7 | 8 | app = core.App() 9 | EcsMicroserviceStack(app, "ecs-microservice-stack") 10 | 11 | app.synth() 12 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py" 3 | } 4 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/ecs_microservice/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/2-ecs-microservice-stack/ecs_microservice/__init__.py -------------------------------------------------------------------------------- /2-ecs-microservice-stack/requirements.txt: -------------------------------------------------------------------------------- 1 | aws_cdk.core==1.191.0 2 | aws_cdk.aws_ec2==1.191.0 3 | aws_cdk.aws_ecs==1.191.0 4 | aws_cdk.aws_rds==1.191.0 5 | aws_cdk.aws_ecs_patterns==1.191.0 6 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/work/source/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | VOLUME /tmp 3 | ARG JAR_FILE 4 | ADD target/${JAR_FILE} app.jar 5 | RUN sh -c 'touch /app.jar' 6 | ENV JAVA_OPTS="" 7 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ] -------------------------------------------------------------------------------- /2-ecs-microservice-stack/work/source/application-mysql.properties: -------------------------------------------------------------------------------- 1 | # database init, supports mysql too 2 | database=mysql 3 | spring.datasource.url=jdbc:mysql://localhost/petclinic 4 | spring.datasource.username=root 5 | spring.datasource.password=petclinic 6 | # Uncomment this the first time the app runs 7 | spring.datasource.initialization-mode=always 8 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/work/source/application.properties: -------------------------------------------------------------------------------- 1 | # database init, supports mysql too 2 | database=hsqldb 3 | spring.datasource.schema=classpath*:db/${database}/schema.sql 4 | spring.datasource.data=classpath*:db/${database}/data.sql 5 | 6 | # Web 7 | spring.thymeleaf.mode=HTML 8 | 9 | # JPA 10 | spring.jpa.hibernate.ddl-auto=none 11 | 12 | # Internationalization 13 | spring.messages.basename=messages/messages 14 | 15 | # Actuator / Management 16 | management.endpoints.web.base-path=/manage 17 | management.endpoints.web.exposure.include=* 18 | 19 | # Logging 20 | logging.level.org.springframework=INFO 21 | # logging.level.org.springframework.web=DEBUG 22 | # logging.level.org.springframework.context.annotation=TRACE 23 | 24 | # Maximum time static resources should be cached 25 | spring.resources.cache.cachecontrol.max-age=12h 26 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/work/source/code/CustomersServiceApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | //import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 21 | 22 | /** 23 | * @author Maciej Szarlinski 24 | */ 25 | //@EnableDiscoveryClient 26 | @SpringBootApplication 27 | public class CustomersServiceApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(CustomersServiceApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/work/source/code/VetsServiceApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 21 | //import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 22 | import org.springframework.samples.petclinic.vets.system.VetsProperties; 23 | 24 | /** 25 | * @author Maciej Szarlinski 26 | */ 27 | //@EnableDiscoveryClient 28 | @SpringBootApplication 29 | @EnableConfigurationProperties(VetsProperties.class) 30 | public class VetsServiceApplication { 31 | 32 | public static void main(String[] args) { 33 | SpringApplication.run(VetsServiceApplication.class, args); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/work/source/code/VisitsServiceApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.visits; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | //import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 21 | 22 | /** 23 | * @author Maciej Szarlinski 24 | */ 25 | //@EnableDiscoveryClient 26 | @SpringBootApplication 27 | public class VisitsServiceApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(VisitsServiceApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/work/source/code/owner-details.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .controller('OwnerDetailsController', ['$http', '$stateParams', function ($http, $stateParams) { 5 | var self = this; 6 | 7 | $http.get('api/customer/owners/' + $stateParams.ownerId).then(function (resp) { 8 | self.owner = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /2-ecs-microservice-stack/work/source/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/.gitignore: -------------------------------------------------------------------------------- 1 | .env/ 2 | cdk.out/ 3 | cdk.context.json 4 | */__pycache__/ 5 | .DS_Store 6 | */.DS_Store/ 7 | */*/target/ 8 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Welcome to Spring Petclinic Serverless CDK Python project! 3 | 4 | This is a project for Python development with CDK. And you must have meet [requirement](../README.md#prerequisites) before to start below. 5 | 6 | First of all we need create the Spring Boot deployment JAR using: 7 | 8 | ```bash 9 | cd spring-petclinic-serverless && ./mvnw package 10 | ``` 11 | 12 | We also manually create a virtualenv on MacOS and Linux in this project root folder: 13 | 14 | ```bash 15 | cd ../ && python3 -m venv .env 16 | ``` 17 | 18 | After the init process completes and the virtualenv is created, you can use the following 19 | step to activate your virtualenv. 20 | 21 | ```bash 22 | source .env/bin/activate 23 | ``` 24 | 25 | Once the virtualenv is activated, you can install the required dependencies. 26 | 27 | ```bash 28 | pip install -r requirements.txt 29 | ``` 30 | 31 | At this point you can now synthesize the CloudFormation template for this code. 32 | 33 | ```bash 34 | cdk synth 35 | ``` 36 | 37 | After review the CloudFormation template you can upload all the Lambda Function JARs, static files and deploy all the Infracture codes using: 38 | 39 | ```bash 40 | cdk deploy 41 | ``` 42 | 43 | Check the Spring Petclinic Application deployment is success by browse the CDK output AWS ELB url like: 44 | 45 | ```bash 46 | serverless-stack.PetclinicApiGatewayWithCorsEndpoint122A21C4 = https://gw5lflv1q3.execute-api.ap-northeast-1.amazonaws.com/prod/ 47 | serverless-stack.PetclinicWebsiteUrl = http://serverless-stack-petclinicwebsitebcda6fa7-yo4jhabxfujm.s3-website-ap-northeast-1.amazonaws.com 48 | ``` 49 | 50 | Finally you can clean up the whole stack by using: 51 | 52 | ```bash 53 | cdk destory 54 | ``` -------------------------------------------------------------------------------- /3-serverless-microservice-stack/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from serverless.serverless_stack import ServerlessStack 6 | 7 | 8 | app = core.App() 9 | ServerlessStack(app, "serverless-stack") 10 | 11 | app.synth() 12 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py" 3 | } 4 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/requirements.txt: -------------------------------------------------------------------------------- 1 | aws_cdk.core==1.191.0 2 | aws_cdk.aws_apigateway==1.191.0 3 | aws_cdk.aws_lambda==1.191.0 4 | aws_cdk.aws_s3==1.191.0 5 | aws_cdk.aws_s3_deployment==1.191.0 6 | aws_cdk.aws_dynamodb==1.191.0 7 | aws-cdk.aws_cloudformation==1.191.0 8 | aws-cdk.aws_events==1.191.0 9 | aws-cdk.aws_events_targets==1.191.0 10 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/serverless/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/serverless/__init__.py -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-serverless/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.4/maven-wrapper-0.5.4.jar 3 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/java/org/springframework/samples/petclinic/customers/model/OwnerRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: MIT-0 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | * software and associated documentation files (the "Software"), to deal in the Software 7 | * without restriction, including without limitation the rights to use, copy, modify, 8 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 13 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 14 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 15 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 16 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | 19 | package org.springframework.samples.petclinic.customers.model; 20 | 21 | import java.util.UUID; 22 | 23 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 24 | import org.springframework.data.repository.CrudRepository; 25 | 26 | @EnableScan() 27 | public interface OwnerRepository extends CrudRepository { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/java/org/springframework/samples/petclinic/customers/web/PetDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers.web; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.Date; 21 | 22 | import org.springframework.format.annotation.DateTimeFormat; 23 | import org.springframework.samples.petclinic.customers.model.Pet; 24 | import org.springframework.samples.petclinic.customers.model.Owner; 25 | 26 | /** 27 | * @author mszarlinski@bravurasolutions.com on 2016-12-05. 28 | */ 29 | @Data 30 | class PetDetails { 31 | 32 | private long id; 33 | 34 | private String name; 35 | 36 | private String owner; 37 | 38 | @DateTimeFormat(pattern = "yyyy-MM-dd") 39 | private Date birthDate; 40 | 41 | private String type; 42 | 43 | PetDetails(Pet pet, Owner owner) { 44 | this.id = pet.getId(); 45 | this.name = pet.getName(); 46 | this.owner = owner.getFirstName() + " " + owner.getLastName(); 47 | this.birthDate = pet.getBirthDate(); 48 | this.type = pet.getType(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/java/org/springframework/samples/petclinic/customers/web/PetRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers.web; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.Date; 21 | 22 | import javax.validation.constraints.Size; 23 | 24 | import com.fasterxml.jackson.annotation.JsonFormat; 25 | 26 | /** 27 | * @author mszarlinski@bravurasolutions.com on 2016-12-05. 28 | */ 29 | @Data 30 | class PetRequest { 31 | private int id; 32 | 33 | @JsonFormat(pattern = "yyyy-MM-dd") 34 | private Date birthDate; 35 | 36 | @Size(min = 1) 37 | private String name; 38 | 39 | private String type; 40 | } 41 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/java/org/springframework/samples/petclinic/customers/web/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.customers.web; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(value = HttpStatus.NOT_FOUND) 7 | public class ResourceNotFoundException extends RuntimeException { 8 | 9 | public ResourceNotFoundException(String message) { 10 | super(message); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/spring-petclinic-vets-serverless/src/main/java/org/springframework/samples/petclinic/vets/model/VetRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: MIT-0 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | * software and associated documentation files (the "Software"), to deal in the Software 7 | * without restriction, including without limitation the rights to use, copy, modify, 8 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 13 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 14 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 15 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 16 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | 19 | package org.springframework.samples.petclinic.vets.model; 20 | 21 | import java.util.UUID; 22 | 23 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 24 | import org.springframework.data.repository.CrudRepository; 25 | 26 | @EnableScan() 27 | public interface VetRepository extends CrudRepository { 28 | } 29 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/spring-petclinic-vets-serverless/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/spring-petclinic-visits-serverless/src/main/java/org/springframework/samples/petclinic/visits/model/VisitRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: MIT-0 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | * software and associated documentation files (the "Software"), to deal in the Software 7 | * without restriction, including without limitation the rights to use, copy, modify, 8 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 13 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 14 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 15 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 16 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package org.springframework.samples.petclinic.visits.model; 19 | 20 | import java.lang.Iterable; 21 | import java.util.UUID; 22 | 23 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 24 | import org.springframework.data.repository.CrudRepository; 25 | 26 | @EnableScan() 27 | public interface VisitRepository extends CrudRepository { 28 | Iterable findByPetName(String petName); 29 | } 30 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-serverless/spring-petclinic-visits-serverless/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/data/visit.json: -------------------------------------------------------------------------------- 1 | { 2 | "test_visit": [ 3 | { 4 | "PutRequest": { 5 | "Item": { 6 | "date": { 7 | "S": "2019-09-28T10:32:13.687Z" 8 | }, 9 | "petName": { 10 | "S": "Mulligan" 11 | }, 12 | "id": { 13 | "S": "062aa65d-f749-40cd-abff-3a5f82adf445" 14 | }, 15 | "ownerId": { 16 | "S": "c403fc06-af5e-46a3-b0f7-a63a4361d034" 17 | } 18 | } 19 | } 20 | }, 21 | { 22 | "PutRequest": { 23 | "Item": { 24 | "date": { 25 | "S": "2019-09-27T10:32:51.953Z" 26 | }, 27 | "petName": { 28 | "S": "Leo" 29 | }, 30 | "id": { 31 | "S": "88ee7695-82a7-4e78-a1b8-76042c404dd6" 32 | }, 33 | "ownerId": { 34 | "S": "e76a7cd1-9120-4a20-9cb5-560e13741341" 35 | } 36 | } 37 | } 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/fonts/montserrat-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/fonts/montserrat-webfont.eot -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/fonts/montserrat-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/fonts/montserrat-webfont.ttf -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/fonts/montserrat-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/fonts/montserrat-webfont.woff -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/fonts/varela_round-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/fonts/varela_round-webfont.eot -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/fonts/varela_round-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/fonts/varela_round-webfont.ttf -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/fonts/varela_round-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/fonts/varela_round-webfont.woff -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/images/favicon.png -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/images/pets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/images/pets.png -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/images/platform-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/images/platform-bg.png -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/images/spring-logo-dataflow-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/images/spring-logo-dataflow-mobile.png -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/images/spring-logo-dataflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/images/spring-logo-dataflow.png -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/images/spring-pivotal-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/images/spring-pivotal-logo.png -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /* App Module */ 3 | var petClinicApp = angular.module('petClinicApp', [ 4 | 'ui.router', 'layoutNav', 'layoutFooter', 'layoutWelcome', 5 | 'ownerList', 'ownerDetails', 'ownerForm', 'petForm', 'visits', 'vetList']); 6 | 7 | petClinicApp.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider', function( 8 | $stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) { 9 | 10 | // safari turns to be lazy sending the Cache-Control header 11 | $httpProvider.defaults.headers.common["Cache-Control"] = 'no-cache'; 12 | 13 | $locationProvider.hashPrefix('!'); 14 | 15 | $urlRouterProvider.otherwise('/welcome'); 16 | $stateProvider 17 | .state('app', { 18 | abstract: true, 19 | url: '', 20 | template: '' 21 | }) 22 | .state('welcome', { 23 | parent: 'app', 24 | url: '/welcome', 25 | template: '' 26 | }); 27 | }]); 28 | 29 | ['welcome', 'nav', 'footer'].forEach(function(c) { 30 | var mod = 'layout' + c.toUpperCase().substring(0, 1) + c.substring(1); 31 | angular.module(mod, []); 32 | angular.module(mod).component(mod, { 33 | templateUrl: "scripts/fragments/" + c + ".html" 34 | }); 35 | }); -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/config.js: -------------------------------------------------------------------------------- 1 | let _baseUrl = '' -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/fragments/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Sponsored by Pivotal
5 |
6 |
-------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/fragments/welcome.html: -------------------------------------------------------------------------------- 1 |

Welcome to Petclinic

2 | 3 |
4 |
5 | pets logo 6 |
7 |
-------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-details/owner-details.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .component('ownerDetails', { 5 | templateUrl: 'scripts/owner-details/owner-details.template.html', 6 | controller: 'OwnerDetailsController' 7 | }); 8 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-details/owner-details.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .controller('OwnerDetailsController', ['$http', '$stateParams', function ($http, $stateParams) { 5 | var self = this; 6 | 7 | $http.get(_baseUrl + 'api/customer/owners/' + $stateParams.ownerId).then(function (resp) { 8 | self.owner = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-details/owner-details.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerDetails', { 7 | parent: 'app', 8 | url: '/owners/details/:ownerId', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-form/owner-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .component('ownerForm', { 5 | templateUrl: 'scripts/owner-form/owner-form.template.html', 6 | controller: 'OwnerFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-form/owner-form.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .controller('OwnerFormController', ["$http", '$state', '$stateParams', function ($http, $state, $stateParams) { 5 | var self = this; 6 | 7 | var ownerId = $stateParams.ownerId || 0; 8 | 9 | if (!ownerId) { 10 | self.owner = {}; 11 | } else { 12 | $http.get(_baseUrl + "api/customer/owners/" + ownerId).then(function (resp) { 13 | self.owner = resp.data; 14 | }); 15 | } 16 | 17 | self.submitOwnerForm = function () { 18 | var id = self.owner.id; 19 | var req; 20 | if (id) { 21 | req = $http.put(_baseUrl + "api/customer/owners/" + id, self.owner); 22 | } else { 23 | req = $http.post(_baseUrl + "api/customer/owners", self.owner); 24 | } 25 | 26 | req.then(function () { 27 | $state.go('owners'); 28 | }, function (response) { 29 | var error = response.data; 30 | alert(error.error + "\r\n" + error.errors.map(function (e) { 31 | return e.field + ": " + e.defaultMessage; 32 | }).join("\r\n")); 33 | }); 34 | }; 35 | }]); 36 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-form/owner-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerNew', { 7 | parent: 'app', 8 | url: '/owners/new', 9 | template: '' 10 | }) 11 | .state('ownerEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/edit', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-form/owner-form.template.html: -------------------------------------------------------------------------------- 1 |

Owner

2 |
3 |
4 | 5 | 6 | First name is required. 7 |
8 | 9 |
10 | 11 | 12 | Last name is required. 13 |
14 | 15 | 16 |
17 | 18 | 19 | Address is required. 20 |
21 | 22 |
23 | 24 | 25 | City is required. 26 |
27 | 28 |
29 | 30 | 31 | Telephone is required. 32 |
33 | 34 |
35 | 36 |
37 |
38 | 39 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-list/owner-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .component('ownerList', { 5 | templateUrl: 'scripts/owner-list/owner-list.template.html', 6 | controller: 'OwnerListController' 7 | }); 8 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-list/owner-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .controller('OwnerListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get(_baseUrl + 'api/customer/owners').then(function (resp) { 8 | self.owners = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-list/owner-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('owners', { 7 | parent: 'app', 8 | url: '/owners', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/owner-list/owner-list.template.html: -------------------------------------------------------------------------------- 1 |

Owners

2 | 3 |
4 |
5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | 30 | 31 |
NameCityTelephone
22 | 23 | {{owner.firstName}} {{owner.lastName}} 24 | 25 | {{owner.city}}{{owner.telephone}}
32 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/pet-form/pet-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm') 4 | .component('petForm', { 5 | templateUrl: 'scripts/pet-form/pet-form.template.html', 6 | controller: 'PetFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/pet-form/pet-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('petNew', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/new-pet', 9 | template: '' 10 | }) 11 | .state('petEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/pets/:petName', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/pet-form/pet-form.template.html: -------------------------------------------------------------------------------- 1 |

Pet

2 | 3 |
4 |
5 | 6 |
7 |

{{$ctrl.pet.owner}}

8 |
9 |
10 | 11 |
12 | 13 |
14 | 15 | Name is required. 16 |
17 |
18 | 19 |
20 | 21 |
22 | 23 | birth date is required. 24 |
25 |
26 | 27 |
28 | 29 |
30 | 33 |
34 |
35 | 36 |
37 |
38 | 41 |
42 |
43 |
44 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/vet-list/vet-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .component('vetList', { 5 | templateUrl: 'scripts/vet-list/vet-list.template.html', 6 | controller: 'VetListController' 7 | }); 8 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/vet-list/vet-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .controller('VetListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get(_baseUrl + 'api/vet/vets').then(function (resp) { 8 | self.vetList = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/vet-list/vet-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('vets', { 7 | parent: 'app', 8 | url: '/vets', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/vet-list/vet-list.template.html: -------------------------------------------------------------------------------- 1 |

Veterinarians

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
NameSpecialties
{{vet.firstName}} {{vet.lastName}}{{specialty + ' '}}
16 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/visits/visits.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .component('visits', { 5 | templateUrl: 'scripts/visits/visits.template.html', 6 | controller: 'VisitsController' 7 | }); 8 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/visits/visits.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .controller('VisitsController', ['$http', '$state', '$stateParams', '$filter', function ($http, $state, $stateParams, $filter) { 5 | var self = this; 6 | var petName = $stateParams.petName || 0; 7 | var url = _baseUrl + "api/visit/owners/" + ($stateParams.ownerId || 0) + "/pets/" + petName + "/visits"; 8 | self.date = new Date(); 9 | self.desc = ""; 10 | 11 | $http.get(url).then(function (resp) { 12 | self.visits = resp.data; 13 | }); 14 | 15 | self.submit = function () { 16 | var data = { 17 | date: $filter('date')(self.date, "yyyy-MM-dd"), 18 | description: self.desc 19 | }; 20 | 21 | $http.post(url, data).then(function () { 22 | $state.go("owners", { ownerId: $stateParams.ownerId }); 23 | }, function (response) { 24 | var error = response.data; 25 | alert(error.error + "\r\n" + error.errors.map(function (e) { 26 | return e.field + ": " + e.defaultMessage; 27 | }).join("\r\n")); 28 | }); 29 | }; 30 | }]); 31 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/visits/visits.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('visits', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/pets/:petName/visits', 9 | template: '' 10 | }) 11 | }]); 12 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/scripts/visits/visits.template.html: -------------------------------------------------------------------------------- 1 |

Visits

2 | 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 |
11 | 12 | 13 |
14 | 15 |
16 | 17 |
18 | 19 |
20 | 21 |

Previous Visits

22 | 23 | 24 | 25 | 26 | 27 |
{{v.date}}{{v.description}}
-------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | indent_size = 2 9 | indent_style = space 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | trim_trailing_whitespace = false 15 | 16 | [*.py] 17 | indent_size = 4 18 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | *.css text eol=lf 3 | *.html text eol=lf 4 | *.js text eol=lf 5 | *.json text eol=lf 6 | *.less text eol=lf 7 | *.md text eol=lf 8 | *.svg text eol=lf 9 | *.yml text eol=lf 10 | # Don't diff or textually merge source maps 11 | *.map binary 12 | 13 | bootstrap-theme.css linguist-vendored=false 14 | bootstrap.css linguist-vendored=false 15 | bootstrap.js linguist-vendored=false 16 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore docs files 2 | _gh_pages 3 | _site 4 | .ruby-version 5 | 6 | # Numerous always-ignore extensions 7 | *.diff 8 | *.err 9 | *.log 10 | *.orig 11 | *.rej 12 | *.swo 13 | *.swp 14 | *.vi 15 | *.zip 16 | *~ 17 | 18 | # OS or Editor folders 19 | ._* 20 | .cache 21 | .DS_Store 22 | .idea 23 | .project 24 | .settings 25 | .tmproj 26 | *.esproj 27 | *.sublime-project 28 | *.sublime-workspace 29 | nbproject 30 | Thumbs.db 31 | 32 | # Komodo 33 | .komodotools 34 | *.komodoproject 35 | 36 | # Jekyll metadata 37 | docs/.jekyll-metadata 38 | 39 | # Folders to ignore 40 | bower_components 41 | node_modules 42 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/.hound.yml: -------------------------------------------------------------------------------- 1 | fail_on_violations: true 2 | 3 | scss: 4 | enabled: false 5 | 6 | javascript: 7 | enabled: true 8 | config_file: js/.jshintrc 9 | 10 | jscs: 11 | enabled: true 12 | config_file: js/.jscsrc 13 | -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /3-serverless-microservice-stack/spring-petclinic-static/vendors/bootstrap/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /4-serverless-cicd-stack/.gitignore: -------------------------------------------------------------------------------- 1 | .env/ 2 | cdk.out/ 3 | cdk.context.json 4 | */__pycache__/ 5 | .DS_Store 6 | */.DS_Store/ 7 | */target/ 8 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/.gitignore: -------------------------------------------------------------------------------- 1 | .env/ 2 | cdk.out/ 3 | cdk.context.json 4 | */__pycache__/ 5 | target/ 6 | .git/ -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Welcome to your CDK Python project! 3 | 4 | This is a blank project for Python development with CDK. 5 | 6 | The `cdk.json` file tells the CDK Toolkit how to execute your app. 7 | 8 | This project is set up like a standard Python project. The initialization 9 | process also creates a virtualenv within this project, stored under the .env 10 | directory. To create the virtualenv it assumes that there is a `python3` 11 | (or `python` for Windows) executable in your path with access to the `venv` 12 | package. If for any reason the automatic creation of the virtualenv fails, 13 | you can create the virtualenv manually. 14 | 15 | To manually create a virtualenv on MacOS and Linux: 16 | 17 | ``` 18 | $ python3 -m venv .env 19 | ``` 20 | 21 | After the init process completes and the virtualenv is created, you can use the following 22 | step to activate your virtualenv. 23 | 24 | ``` 25 | $ source .env/bin/activate 26 | ``` 27 | 28 | If you are a Windows platform, you would activate the virtualenv like this: 29 | 30 | ``` 31 | % .env\Scripts\activate.bat 32 | ``` 33 | 34 | Once the virtualenv is activated, you can install the required dependencies. 35 | 36 | ``` 37 | $ pip install -r requirements.txt 38 | ``` 39 | 40 | At this point you can now synthesize the CloudFormation template for this code. 41 | 42 | ``` 43 | $ cdk synth 44 | ``` 45 | 46 | Need Clear up resource manully: 47 | 48 | 1. CodePipeline Atrifact S3 Bucket 49 | 2. KMS Alias and Managed Key 50 | 3. Delete the Lambda Stack CloudFormation Deployment 51 | 52 | ```bash 53 | git init 54 | git remote add origin *REPO_URL* 55 | git add . 56 | git commit -m "init commit" 57 | git push --set-upstream origin master 58 | Username: 59 | Password: 60 | ``` 61 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from serverless_cicd.serverless_cicd_stack import ServerlessCicdStack 6 | from serverless_lambda.serverless_lambda_stack import ServerlessLambdaStack 7 | 8 | app = core.App() 9 | lambda_stack = ServerlessLambdaStack(app, 'customer-lambda-stack') 10 | ServerlessCicdStack(app, "customer-cicd-stack", lambda_code=lambda_stack.lambda_code, custom_resource=lambda_stack.custom_resource) 11 | 12 | app.synth() 13 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py" 3 | } 4 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/custom-resource-code/index.py: -------------------------------------------------------------------------------- 1 | import json 2 | import boto3 3 | import cfnresponse 4 | from botocore.exceptions import ClientError 5 | import time 6 | 7 | s3 = boto3.resource('s3') 8 | ddb_client = boto3.client('dynamodb') 9 | 10 | def create(properties, physical_id): 11 | print("Create Event and Properties: {}".format(json.dumps(properties))) 12 | 13 | print('Begin init dynamodb table data!') 14 | owner_request = {} 15 | 16 | table = properties["DynamoDBTable"] 17 | 18 | print('Import owner table data!') 19 | 20 | with open('owner.json', 'r') as owner_body: 21 | owner_request[table] = json.load(owner_body)['test_owner'] 22 | 23 | ddb_client.batch_write_item(RequestItems=owner_request) 24 | 25 | return cfnresponse.SUCCESS, None 26 | 27 | def update(properties, physical_id): 28 | return create(properties, physical_id) 29 | 30 | def delete(properties, physical_id): 31 | return cfnresponse.SUCCESS, physical_id 32 | 33 | def handler(event, context): 34 | print ("Received event: {}".format(json.dumps(event))) 35 | 36 | status = cfnresponse.FAILED 37 | new_physical_id = None 38 | 39 | try: 40 | properties = event.get('ResourceProperties') 41 | physical_id = event.get('PhysicalResourceId') 42 | 43 | status, new_physical_id = { 44 | 'Create': create, 45 | 'Update': update, 46 | 'Delete': delete 47 | }.get(event['RequestType'], lambda x, y: (cfnresponse.FAILED, None))(properties, physical_id) 48 | except Exception as e: 49 | print ("Exception: {}".format(e)) 50 | status = cfnresponse.FAILED 51 | finally: 52 | cfnresponse.send(event, context, status, {}, new_physical_id) -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/requirements.txt: -------------------------------------------------------------------------------- 1 | aws_cdk.core==1.191.0 2 | aws_cdk.aws_apigateway==1.191.0 3 | aws_cdk.aws_lambda==1.191.0 4 | aws_cdk.aws_s3==1.191.0 5 | aws_cdk.aws_s3_deployment==1.191.0 6 | aws_cdk.aws_dynamodb==1.191.0 7 | aws-cdk.aws_cloudformation==1.191.0 8 | aws-cdk.aws_lambda_event_sources==1.191.0 9 | aws-cdk.aws_codepipeline_actions==1.191.0 10 | aws-cdk.aws_codebuild==1.191.0 11 | aws-cdk.aws_codecommit==1.191.0 12 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/serverless_cicd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/customer-service-cicd/serverless_cicd/__init__.py -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/serverless_lambda/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/customer-service-cicd/serverless_lambda/__init__.py -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | 4 | with open("README.md") as fp: 5 | long_description = fp.read() 6 | 7 | 8 | setuptools.setup( 9 | name="4_serverless_cicd", 10 | version="0.0.1", 11 | 12 | description="An empty CDK Python app", 13 | long_description=long_description, 14 | long_description_content_type="text/markdown", 15 | 16 | author="author", 17 | 18 | package_dir={"": "4_serverless_cicd"}, 19 | packages=setuptools.find_packages(where="4_serverless_cicd"), 20 | 21 | install_requires=[ 22 | "aws-cdk.core", 23 | ], 24 | 25 | python_requires=">=3.6", 26 | 27 | classifiers=[ 28 | "Development Status :: 4 - Beta", 29 | 30 | "Intended Audience :: Developers", 31 | 32 | "License :: OSI Approved :: Apache Software License", 33 | 34 | "Programming Language :: JavaScript", 35 | "Programming Language :: Python :: 3 :: Only", 36 | "Programming Language :: Python :: 3.6", 37 | "Programming Language :: Python :: 3.7", 38 | "Programming Language :: Python :: 3.8", 39 | 40 | "Topic :: Software Development :: Code Generators", 41 | "Topic :: Utilities", 42 | 43 | "Typing :: Typed", 44 | ], 45 | ) 46 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/src/main/java/org/springframework/samples/petclinic/customers/model/OwnerRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: MIT-0 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | * software and associated documentation files (the "Software"), to deal in the Software 7 | * without restriction, including without limitation the rights to use, copy, modify, 8 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 13 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 14 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 15 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 16 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | 19 | package org.springframework.samples.petclinic.customers.model; 20 | 21 | import java.util.UUID; 22 | 23 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 24 | import org.springframework.data.repository.CrudRepository; 25 | 26 | @EnableScan() 27 | public interface OwnerRepository extends CrudRepository { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/src/main/java/org/springframework/samples/petclinic/customers/web/PetRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: MIT-0 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | * software and associated documentation files (the "Software"), to deal in the Software 7 | * without restriction, including without limitation the rights to use, copy, modify, 8 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 13 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 14 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 15 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 16 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | 19 | package org.springframework.samples.petclinic.customers.web; 20 | 21 | import lombok.Data; 22 | 23 | import java.util.Date; 24 | 25 | import javax.validation.constraints.Size; 26 | 27 | import com.fasterxml.jackson.annotation.JsonFormat; 28 | 29 | /** 30 | * @author mszarlinski@bravurasolutions.com on 2016-12-05. 31 | */ 32 | @Data 33 | class PetRequest { 34 | private int id; 35 | 36 | @JsonFormat(pattern = "yyyy-MM-dd") 37 | private Date birthDate; 38 | 39 | @Size(min = 1) 40 | private String name; 41 | 42 | private String type; 43 | } 44 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/src/main/java/org/springframework/samples/petclinic/customers/web/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: MIT-0 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | * software and associated documentation files (the "Software"), to deal in the Software 7 | * without restriction, including without limitation the rights to use, copy, modify, 8 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 13 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 14 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 15 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 16 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | 19 | package org.springframework.samples.petclinic.customers.web; 20 | 21 | import org.springframework.http.HttpStatus; 22 | import org.springframework.web.bind.annotation.ResponseStatus; 23 | 24 | @ResponseStatus(value = HttpStatus.NOT_FOUND) 25 | public class ResourceNotFoundException extends RuntimeException { 26 | 27 | public ResourceNotFoundException(String message) { 28 | super(message); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/customer-service-cicd/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/1.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/10.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/11.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/12.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/13.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/14.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/2.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/3.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/4.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/5.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/6.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/7.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/8.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/images/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/images/9.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/.gitignore: -------------------------------------------------------------------------------- 1 | .env/ 2 | cdk.out/ 3 | cdk.context.json 4 | */__pycache__/ 5 | target/ 6 | .git/ -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from static_cicd.static_cicd_stack import StaticCicdStack 6 | 7 | app = core.App() 8 | StaticCicdStack(app, "static-cicd-stack") 9 | 10 | app.synth() 11 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py" 3 | } 4 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/requirements.txt: -------------------------------------------------------------------------------- 1 | aws_cdk.core==1.191.0 2 | aws_cdk.aws_apigateway==1.191.0 3 | aws_cdk.aws_lambda==1.191.0 4 | aws_cdk.aws_s3==1.191.0 5 | aws_cdk.aws_s3_deployment==1.191.0 6 | aws_cdk.aws_dynamodb==1.191.0 7 | aws-cdk.aws_cloudformation==1.191.0 8 | aws-cdk.aws_lambda_event_sources==1.191.0 9 | aws-cdk.aws_codepipeline_actions==1.191.0 10 | aws-cdk.aws_codebuild==1.191.0 11 | aws-cdk.aws_codecommit==1.191.0 12 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/data/visit.json: -------------------------------------------------------------------------------- 1 | { 2 | "test_visit": [ 3 | { 4 | "PutRequest": { 5 | "Item": { 6 | "date": { 7 | "S": "2019-09-28T10:32:13.687Z" 8 | }, 9 | "petName": { 10 | "S": "Mulligan" 11 | }, 12 | "id": { 13 | "S": "062aa65d-f749-40cd-abff-3a5f82adf445" 14 | }, 15 | "ownerId": { 16 | "S": "c403fc06-af5e-46a3-b0f7-a63a4361d034" 17 | } 18 | } 19 | } 20 | }, 21 | { 22 | "PutRequest": { 23 | "Item": { 24 | "date": { 25 | "S": "2019-09-27T10:32:51.953Z" 26 | }, 27 | "petName": { 28 | "S": "Leo" 29 | }, 30 | "id": { 31 | "S": "88ee7695-82a7-4e78-a1b8-76042c404dd6" 32 | }, 33 | "ownerId": { 34 | "S": "e76a7cd1-9120-4a20-9cb5-560e13741341" 35 | } 36 | } 37 | } 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/montserrat-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/montserrat-webfont.eot -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/montserrat-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/montserrat-webfont.ttf -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/montserrat-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/montserrat-webfont.woff -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/varela_round-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/varela_round-webfont.eot -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/varela_round-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/varela_round-webfont.ttf -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/varela_round-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/fonts/varela_round-webfont.woff -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/images/favicon.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/images/pets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/images/pets.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/images/platform-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/images/platform-bg.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/images/spring-logo-dataflow-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/images/spring-logo-dataflow-mobile.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/images/spring-logo-dataflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/images/spring-logo-dataflow.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/images/spring-pivotal-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/images/spring-pivotal-logo.png -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /* App Module */ 3 | var petClinicApp = angular.module('petClinicApp', [ 4 | 'ui.router', 'layoutNav', 'layoutFooter', 'layoutWelcome', 5 | 'ownerList', 'ownerDetails', 'ownerForm', 'petForm', 'visits', 'vetList']); 6 | 7 | petClinicApp.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider', function( 8 | $stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) { 9 | 10 | // safari turns to be lazy sending the Cache-Control header 11 | $httpProvider.defaults.headers.common["Cache-Control"] = 'no-cache'; 12 | 13 | $locationProvider.hashPrefix('!'); 14 | 15 | $urlRouterProvider.otherwise('/welcome'); 16 | $stateProvider 17 | .state('app', { 18 | abstract: true, 19 | url: '', 20 | template: '' 21 | }) 22 | .state('welcome', { 23 | parent: 'app', 24 | url: '/welcome', 25 | template: '' 26 | }); 27 | }]); 28 | 29 | ['welcome', 'nav', 'footer'].forEach(function(c) { 30 | var mod = 'layout' + c.toUpperCase().substring(0, 1) + c.substring(1); 31 | angular.module(mod, []); 32 | angular.module(mod).component(mod, { 33 | templateUrl: "scripts/fragments/" + c + ".html" 34 | }); 35 | }); -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/config.js: -------------------------------------------------------------------------------- 1 | let _baseUrl = 'http://localhost:8081/' -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/fragments/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Sponsored by Pivotal
5 |
6 |
-------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/fragments/welcome.html: -------------------------------------------------------------------------------- 1 |

Welcome to Petclinic

2 | 3 |
4 |
5 | pets logo 6 |
7 |
-------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-details/owner-details.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .component('ownerDetails', { 5 | templateUrl: 'scripts/owner-details/owner-details.template.html', 6 | controller: 'OwnerDetailsController' 7 | }); 8 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-details/owner-details.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .controller('OwnerDetailsController', ['$http', '$stateParams', function ($http, $stateParams) { 5 | var self = this; 6 | 7 | $http.get(_baseUrl + 'api/customer/owners/' + $stateParams.ownerId).then(function (resp) { 8 | self.owner = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-details/owner-details.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerDetails', { 7 | parent: 'app', 8 | url: '/owners/details/:ownerId', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-form/owner-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .component('ownerForm', { 5 | templateUrl: 'scripts/owner-form/owner-form.template.html', 6 | controller: 'OwnerFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-form/owner-form.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .controller('OwnerFormController', ["$http", '$state', '$stateParams', function ($http, $state, $stateParams) { 5 | var self = this; 6 | 7 | var ownerId = $stateParams.ownerId || 0; 8 | 9 | if (!ownerId) { 10 | self.owner = {}; 11 | } else { 12 | $http.get(_baseUrl + "api/customer/owners/" + ownerId).then(function (resp) { 13 | self.owner = resp.data; 14 | }); 15 | } 16 | 17 | self.submitOwnerForm = function () { 18 | var id = self.owner.id; 19 | var req; 20 | if (id) { 21 | req = $http.put(_baseUrl + "api/customer/owners/" + id, self.owner); 22 | } else { 23 | req = $http.post(_baseUrl + "api/customer/owners", self.owner); 24 | } 25 | 26 | req.then(function () { 27 | $state.go('owners'); 28 | }, function (response) { 29 | var error = response.data; 30 | alert(error.error + "\r\n" + error.errors.map(function (e) { 31 | return e.field + ": " + e.defaultMessage; 32 | }).join("\r\n")); 33 | }); 34 | }; 35 | }]); 36 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-form/owner-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerNew', { 7 | parent: 'app', 8 | url: '/owners/new', 9 | template: '' 10 | }) 11 | .state('ownerEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/edit', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-form/owner-form.template.html: -------------------------------------------------------------------------------- 1 |

Owner

2 |
3 |
4 | 5 | 6 | First name is required. 7 |
8 | 9 |
10 | 11 | 12 | Last name is required. 13 |
14 | 15 | 16 |
17 | 18 | 19 | Address is required. 20 |
21 | 22 |
23 | 24 | 25 | City is required. 26 |
27 | 28 |
29 | 30 | 31 | Telephone is required. 32 |
33 | 34 |
35 | 36 |
37 |
38 | 39 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-list/owner-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .component('ownerList', { 5 | templateUrl: 'scripts/owner-list/owner-list.template.html', 6 | controller: 'OwnerListController' 7 | }); 8 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-list/owner-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .controller('OwnerListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get(_baseUrl + 'api/customer/owners').then(function (resp) { 8 | self.owners = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-list/owner-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('owners', { 7 | parent: 'app', 8 | url: '/owners', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-list/owner-list.template.html: -------------------------------------------------------------------------------- 1 |

Owners

2 | 3 |
4 |
5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | 30 | 31 |
NameCityTelephone
22 | 23 | {{owner.firstName}} {{owner.lastName}} 24 | 25 | {{owner.city}}{{owner.telephone}}
32 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/pet-form/pet-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm') 4 | .component('petForm', { 5 | templateUrl: 'scripts/pet-form/pet-form.template.html', 6 | controller: 'PetFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/pet-form/pet-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('petNew', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/new-pet', 9 | template: '' 10 | }) 11 | .state('petEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/pets/:petName', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/pet-form/pet-form.template.html: -------------------------------------------------------------------------------- 1 |

Pet

2 | 3 |
4 |
5 | 6 |
7 |

{{$ctrl.pet.owner}}

8 |
9 |
10 | 11 |
12 | 13 |
14 | 15 | Name is required. 16 |
17 |
18 | 19 |
20 | 21 |
22 | 23 | birth date is required. 24 |
25 |
26 | 27 |
28 | 29 |
30 | 33 |
34 |
35 | 36 |
37 |
38 | 41 |
42 |
43 |
44 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/vet-list/vet-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .component('vetList', { 5 | templateUrl: 'scripts/vet-list/vet-list.template.html', 6 | controller: 'VetListController' 7 | }); 8 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/vet-list/vet-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .controller('VetListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get(_baseUrl + 'api/vet/vets').then(function (resp) { 8 | self.vetList = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/vet-list/vet-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('vets', { 7 | parent: 'app', 8 | url: '/vets', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/vet-list/vet-list.template.html: -------------------------------------------------------------------------------- 1 |

Veterinarians

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
NameSpecialties
{{vet.firstName}} {{vet.lastName}}{{specialty + ' '}}
16 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/visits/visits.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .component('visits', { 5 | templateUrl: 'scripts/visits/visits.template.html', 6 | controller: 'VisitsController' 7 | }); 8 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/visits/visits.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .controller('VisitsController', ['$http', '$state', '$stateParams', '$filter', function ($http, $state, $stateParams, $filter) { 5 | var self = this; 6 | var petName = $stateParams.petName || 0; 7 | var url = _baseUrl + "api/visit/owners/" + ($stateParams.ownerId || 0) + "/pets/" + petName + "/visits"; 8 | self.date = new Date(); 9 | self.desc = ""; 10 | 11 | $http.get(url).then(function (resp) { 12 | self.visits = resp.data; 13 | }); 14 | 15 | self.submit = function () { 16 | var data = { 17 | date: $filter('date')(self.date, "yyyy-MM-dd"), 18 | description: self.desc 19 | }; 20 | 21 | $http.post(url, data).then(function () { 22 | $state.go("owners", { ownerId: $stateParams.ownerId }); 23 | }, function (response) { 24 | var error = response.data; 25 | alert(error.error + "\r\n" + error.errors.map(function (e) { 26 | return e.field + ": " + e.defaultMessage; 27 | }).join("\r\n")); 28 | }); 29 | }; 30 | }]); 31 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/visits/visits.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('visits', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/pets/:petName/visits', 9 | template: '' 10 | }) 11 | }]); 12 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/visits/visits.template.html: -------------------------------------------------------------------------------- 1 |

Visits

2 | 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 |
11 | 12 | 13 |
14 | 15 |
16 | 17 |
18 | 19 |
20 | 21 |

Previous Visits

22 | 23 | 24 | 25 | 26 | 27 |
{{v.date}}{{v.description}}
-------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | indent_size = 2 9 | indent_style = space 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | trim_trailing_whitespace = false 15 | 16 | [*.py] 17 | indent_size = 4 18 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | *.css text eol=lf 3 | *.html text eol=lf 4 | *.js text eol=lf 5 | *.json text eol=lf 6 | *.less text eol=lf 7 | *.md text eol=lf 8 | *.svg text eol=lf 9 | *.yml text eol=lf 10 | # Don't diff or textually merge source maps 11 | *.map binary 12 | 13 | bootstrap-theme.css linguist-vendored=false 14 | bootstrap.css linguist-vendored=false 15 | bootstrap.js linguist-vendored=false 16 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore docs files 2 | _gh_pages 3 | _site 4 | .ruby-version 5 | 6 | # Numerous always-ignore extensions 7 | *.diff 8 | *.err 9 | *.log 10 | *.orig 11 | *.rej 12 | *.swo 13 | *.swp 14 | *.vi 15 | *.zip 16 | *~ 17 | 18 | # OS or Editor folders 19 | ._* 20 | .cache 21 | .DS_Store 22 | .idea 23 | .project 24 | .settings 25 | .tmproj 26 | *.esproj 27 | *.sublime-project 28 | *.sublime-workspace 29 | nbproject 30 | Thumbs.db 31 | 32 | # Komodo 33 | .komodotools 34 | *.komodoproject 35 | 36 | # Jekyll metadata 37 | docs/.jekyll-metadata 38 | 39 | # Folders to ignore 40 | bower_components 41 | node_modules 42 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/.hound.yml: -------------------------------------------------------------------------------- 1 | fail_on_violations: true 2 | 3 | scss: 4 | enabled: false 5 | 6 | javascript: 7 | enabled: true 8 | config_file: js/.jshintrc 9 | 10 | jscs: 11 | enabled: true 12 | config_file: js/.jscsrc 13 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static-resource/vendors/bootstrap/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /4-serverless-cicd-stack/static-service-cicd/static_cicd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/static-service-cicd/static_cicd/__init__.py -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/.gitignore: -------------------------------------------------------------------------------- 1 | .env/ 2 | cdk.out/ 3 | cdk.context.json 4 | */__pycache__/ 5 | target/ 6 | .git/ -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Welcome to your CDK Python project! 3 | 4 | This is a blank project for Python development with CDK. 5 | 6 | The `cdk.json` file tells the CDK Toolkit how to execute your app. 7 | 8 | This project is set up like a standard Python project. The initialization 9 | process also creates a virtualenv within this project, stored under the .env 10 | directory. To create the virtualenv it assumes that there is a `python3` 11 | (or `python` for Windows) executable in your path with access to the `venv` 12 | package. If for any reason the automatic creation of the virtualenv fails, 13 | you can create the virtualenv manually. 14 | 15 | To manually create a virtualenv on MacOS and Linux: 16 | 17 | ``` 18 | $ python3 -m venv .env 19 | ``` 20 | 21 | After the init process completes and the virtualenv is created, you can use the following 22 | step to activate your virtualenv. 23 | 24 | ``` 25 | $ source .env/bin/activate 26 | ``` 27 | 28 | If you are a Windows platform, you would activate the virtualenv like this: 29 | 30 | ``` 31 | % .env\Scripts\activate.bat 32 | ``` 33 | 34 | Once the virtualenv is activated, you can install the required dependencies. 35 | 36 | ``` 37 | $ pip install -r requirements.txt 38 | ``` 39 | 40 | At this point you can now synthesize the CloudFormation template for this code. 41 | 42 | ``` 43 | $ cdk synth 44 | ``` 45 | 46 | Need Clear up resource manully: 47 | 48 | 1. CodePipeline Atrifact S3 Bucket 49 | 2. KMS Alias and Managed Key 50 | 3. Delete the Lambda Stack CloudFormation Deployment 51 | 52 | ```bash 53 | git init 54 | git remote add origin *REPO_URL* 55 | git add . 56 | git commit -m "init commit" 57 | git push --set-upstream origin master 58 | Username: 59 | Password: 60 | ``` 61 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from serverless_cicd.serverless_cicd_stack import ServerlessCicdStack 6 | from serverless_lambda.serverless_lambda_stack import ServerlessLambdaStack 7 | 8 | app = core.App() 9 | lambda_stack = ServerlessLambdaStack(app, 'vet-lambda-stack') 10 | ServerlessCicdStack(app, "vet-cicd-stack", lambda_code=lambda_stack.lambda_code, custom_resource=lambda_stack.custom_resource) 11 | 12 | app.synth() 13 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py" 3 | } 4 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/custom-resource-code/cfnresponse.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Amazon Web Services, Inc. or its affiliates. All Rights Reserved. 2 | # This file is licensed to you under the AWS Customer Agreement (the "License"). 3 | # You may not use this file except in compliance with the License. 4 | # A copy of the License is located at http://aws.amazon.com/agreement/ . 5 | # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. 6 | # See the License for the specific language governing permissions and limitations under the License. 7 | 8 | from botocore.vendored import requests 9 | import json 10 | 11 | SUCCESS = "SUCCESS" 12 | FAILED = "FAILED" 13 | 14 | def send(event, context, responseStatus, responseData, physicalResourceId=None, noEcho=False): 15 | responseUrl = event['ResponseURL'] 16 | 17 | print(responseUrl) 18 | 19 | responseBody = {} 20 | responseBody['Status'] = responseStatus 21 | responseBody['Reason'] = 'See the details in CloudWatch Log Stream: ' + context.log_stream_name 22 | responseBody['PhysicalResourceId'] = physicalResourceId or context.log_stream_name 23 | responseBody['StackId'] = event['StackId'] 24 | responseBody['RequestId'] = event['RequestId'] 25 | responseBody['LogicalResourceId'] = event['LogicalResourceId'] 26 | responseBody['NoEcho'] = noEcho 27 | responseBody['Data'] = responseData 28 | 29 | json_responseBody = json.dumps(responseBody) 30 | 31 | print("Response body:\n" + json_responseBody) 32 | 33 | headers = { 34 | 'content-type' : '', 35 | 'content-length' : str(len(json_responseBody)) 36 | } 37 | 38 | try: 39 | response = requests.put(responseUrl, 40 | data=json_responseBody, 41 | headers=headers) 42 | print("Status code: " + response.reason) 43 | except Exception as e: 44 | print("send(..) failed executing requests.put(..): " + str(e)) -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/custom-resource-code/index.py: -------------------------------------------------------------------------------- 1 | import json 2 | import boto3 3 | import cfnresponse 4 | from botocore.exceptions import ClientError 5 | import time 6 | 7 | s3 = boto3.resource('s3') 8 | ddb_client = boto3.client('dynamodb') 9 | 10 | def create(properties, physical_id): 11 | print("Create Event and Properties: {}".format(json.dumps(properties))) 12 | 13 | print('Begin init dynamodb table data!') 14 | vet_request = {} 15 | 16 | table = properties["DynamoDBTable"] 17 | 18 | print('Import vet table data!') 19 | 20 | with open('vet.json', 'r') as owner_body: 21 | vet_request[table] = json.load(owner_body)['test_vet'] 22 | 23 | ddb_client.batch_write_item(RequestItems=vet_request) 24 | 25 | return cfnresponse.SUCCESS, None 26 | 27 | def update(properties, physical_id): 28 | return create(properties, physical_id) 29 | 30 | def delete(properties, physical_id): 31 | return cfnresponse.SUCCESS, physical_id 32 | 33 | def handler(event, context): 34 | print ("Received event: {}".format(json.dumps(event))) 35 | 36 | status = cfnresponse.FAILED 37 | new_physical_id = None 38 | 39 | try: 40 | properties = event.get('ResourceProperties') 41 | physical_id = event.get('PhysicalResourceId') 42 | 43 | status, new_physical_id = { 44 | 'Create': create, 45 | 'Update': update, 46 | 'Delete': delete 47 | }.get(event['RequestType'], lambda x, y: (cfnresponse.FAILED, None))(properties, physical_id) 48 | except Exception as e: 49 | print ("Exception: {}".format(e)) 50 | status = cfnresponse.FAILED 51 | finally: 52 | cfnresponse.send(event, context, status, {}, new_physical_id) -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/requirements.txt: -------------------------------------------------------------------------------- 1 | aws_cdk.core==1.191.0 2 | aws_cdk.aws_apigateway==1.191.0 3 | aws_cdk.aws_lambda==1.191.0 4 | aws_cdk.aws_s3==1.191.0 5 | aws_cdk.aws_s3_deployment==1.191.0 6 | aws_cdk.aws_dynamodb==1.191.0 7 | aws-cdk.aws_cloudformation==1.191.0 8 | aws-cdk.aws_lambda_event_sources==1.191.0 9 | aws-cdk.aws_codepipeline_actions==1.191.0 10 | aws-cdk.aws_codebuild==1.191.0 11 | aws-cdk.aws_codecommit==1.191.0 12 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/serverless_cicd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/vet-service-cicd/serverless_cicd/__init__.py -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/serverless_lambda/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/vet-service-cicd/serverless_lambda/__init__.py -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | 4 | with open("README.md") as fp: 5 | long_description = fp.read() 6 | 7 | 8 | setuptools.setup( 9 | name="4_serverless_cicd", 10 | version="0.0.1", 11 | 12 | description="An empty CDK Python app", 13 | long_description=long_description, 14 | long_description_content_type="text/markdown", 15 | 16 | author="author", 17 | 18 | package_dir={"": "4_serverless_cicd"}, 19 | packages=setuptools.find_packages(where="4_serverless_cicd"), 20 | 21 | install_requires=[ 22 | "aws-cdk.core", 23 | ], 24 | 25 | python_requires=">=3.6", 26 | 27 | classifiers=[ 28 | "Development Status :: 4 - Beta", 29 | 30 | "Intended Audience :: Developers", 31 | 32 | "License :: OSI Approved :: Apache Software License", 33 | 34 | "Programming Language :: JavaScript", 35 | "Programming Language :: Python :: 3 :: Only", 36 | "Programming Language :: Python :: 3.6", 37 | "Programming Language :: Python :: 3.7", 38 | "Programming Language :: Python :: 3.8", 39 | 40 | "Topic :: Software Development :: Code Generators", 41 | "Topic :: Utilities", 42 | 43 | "Typing :: Typed", 44 | ], 45 | ) 46 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/src/main/java/org/springframework/samples/petclinic/vets/model/VetRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets.model; 17 | 18 | import java.util.UUID; 19 | 20 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 21 | import org.springframework.data.repository.CrudRepository; 22 | 23 | @EnableScan() 24 | public interface VetRepository extends CrudRepository { 25 | } 26 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/src/main/java/org/springframework/samples/petclinic/vets/web/VetResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets.web; 17 | 18 | import lombok.RequiredArgsConstructor; 19 | 20 | import java.util.List; 21 | import java.util.ArrayList; 22 | 23 | import org.springframework.samples.petclinic.vets.model.Vet; 24 | import org.springframework.samples.petclinic.vets.model.VetRepository; 25 | import org.springframework.web.bind.annotation.GetMapping; 26 | import org.springframework.web.bind.annotation.RequestMapping; 27 | import org.springframework.web.bind.annotation.RestController; 28 | import org.springframework.web.bind.annotation.CrossOrigin; 29 | 30 | /** 31 | * @author Juergen Hoeller 32 | * @author Mark Fisher 33 | * @author Ken Krebs 34 | * @author Arjen Poutsma 35 | * @author Maciej Szarlinski 36 | */ 37 | @RequestMapping("/vets") 38 | @CrossOrigin(origins = "*") 39 | @RestController 40 | @RequiredArgsConstructor 41 | class VetResource { 42 | 43 | private final VetRepository vetRepository; 44 | 45 | @GetMapping 46 | public List showResourcesVetList() { 47 | Iterable source = vetRepository.findAll(); 48 | List target = new ArrayList<>(); 49 | source.forEach(target::add); 50 | return target; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/vet-service-cicd/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/.gitignore: -------------------------------------------------------------------------------- 1 | .env/ 2 | cdk.out/ 3 | cdk.context.json 4 | */__pycache__/ 5 | target/ 6 | .git/ -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Welcome to your CDK Python project! 3 | 4 | This is a blank project for Python development with CDK. 5 | 6 | The `cdk.json` file tells the CDK Toolkit how to execute your app. 7 | 8 | This project is set up like a standard Python project. The initialization 9 | process also creates a virtualenv within this project, stored under the .env 10 | directory. To create the virtualenv it assumes that there is a `python3` 11 | (or `python` for Windows) executable in your path with access to the `venv` 12 | package. If for any reason the automatic creation of the virtualenv fails, 13 | you can create the virtualenv manually. 14 | 15 | To manually create a virtualenv on MacOS and Linux: 16 | 17 | ``` 18 | $ python3 -m venv .env 19 | ``` 20 | 21 | After the init process completes and the virtualenv is created, you can use the following 22 | step to activate your virtualenv. 23 | 24 | ``` 25 | $ source .env/bin/activate 26 | ``` 27 | 28 | If you are a Windows platform, you would activate the virtualenv like this: 29 | 30 | ``` 31 | % .env\Scripts\activate.bat 32 | ``` 33 | 34 | Once the virtualenv is activated, you can install the required dependencies. 35 | 36 | ``` 37 | $ pip install -r requirements.txt 38 | ``` 39 | 40 | At this point you can now synthesize the CloudFormation template for this code. 41 | 42 | ``` 43 | $ cdk synth 44 | ``` 45 | 46 | Need Clear up resource manully: 47 | 48 | 1. CodePipeline Atrifact S3 Bucket 49 | 2. KMS Alias and Managed Key 50 | 3. Delete the Lambda Stack CloudFormation Deployment 51 | 52 | ```bash 53 | git init 54 | git remote add origin *REPO_URL* 55 | git add . 56 | git commit -m "init commit" 57 | git push --set-upstream origin master 58 | Username: 59 | Password: 60 | ``` 61 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from serverless_cicd.serverless_cicd_stack import ServerlessCicdStack 6 | from serverless_lambda.serverless_lambda_stack import ServerlessLambdaStack 7 | 8 | app = core.App() 9 | lambda_stack = ServerlessLambdaStack(app, 'visit-lambda-stack') 10 | ServerlessCicdStack(app, "visit-cicd-stack", lambda_code=lambda_stack.lambda_code, custom_resource=lambda_stack.custom_resource) 11 | 12 | app.synth() 13 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py" 3 | } 4 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/custom-resource-code/index.py: -------------------------------------------------------------------------------- 1 | import json 2 | import boto3 3 | import cfnresponse 4 | from botocore.exceptions import ClientError 5 | import time 6 | 7 | s3 = boto3.resource('s3') 8 | ddb_client = boto3.client('dynamodb') 9 | 10 | def create(properties, physical_id): 11 | print("Create Event and Properties: {}".format(json.dumps(properties))) 12 | 13 | print('Begin init dynamodb table data!') 14 | visit_request = {} 15 | 16 | table = properties["DynamoDBTable"] 17 | 18 | print('Import visit table data!') 19 | 20 | with open('visit.json', 'r') as owner_body: 21 | visit_request[table] = json.load(owner_body)['test_visit'] 22 | 23 | ddb_client.batch_write_item(RequestItems=visit_request) 24 | 25 | return cfnresponse.SUCCESS, None 26 | 27 | def update(properties, physical_id): 28 | return create(properties, physical_id) 29 | 30 | def delete(properties, physical_id): 31 | return cfnresponse.SUCCESS, physical_id 32 | 33 | def handler(event, context): 34 | print ("Received event: {}".format(json.dumps(event))) 35 | 36 | status = cfnresponse.FAILED 37 | new_physical_id = None 38 | 39 | try: 40 | properties = event.get('ResourceProperties') 41 | physical_id = event.get('PhysicalResourceId') 42 | 43 | status, new_physical_id = { 44 | 'Create': create, 45 | 'Update': update, 46 | 'Delete': delete 47 | }.get(event['RequestType'], lambda x, y: (cfnresponse.FAILED, None))(properties, physical_id) 48 | except Exception as e: 49 | print ("Exception: {}".format(e)) 50 | status = cfnresponse.FAILED 51 | finally: 52 | cfnresponse.send(event, context, status, {}, new_physical_id) -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/custom-resource-code/visit.json: -------------------------------------------------------------------------------- 1 | { 2 | "test_visit": [ 3 | { 4 | "PutRequest": { 5 | "Item": { 6 | "date": { 7 | "S": "2019-09-28T10:32:13.687Z" 8 | }, 9 | "petName": { 10 | "S": "Mulligan" 11 | }, 12 | "id": { 13 | "S": "062aa65d-f749-40cd-abff-3a5f82adf445" 14 | }, 15 | "ownerId": { 16 | "S": "c403fc06-af5e-46a3-b0f7-a63a4361d034" 17 | } 18 | } 19 | } 20 | }, 21 | { 22 | "PutRequest": { 23 | "Item": { 24 | "date": { 25 | "S": "2019-09-27T10:32:51.953Z" 26 | }, 27 | "petName": { 28 | "S": "Leo" 29 | }, 30 | "id": { 31 | "S": "88ee7695-82a7-4e78-a1b8-76042c404dd6" 32 | }, 33 | "ownerId": { 34 | "S": "e76a7cd1-9120-4a20-9cb5-560e13741341" 35 | } 36 | } 37 | } 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/requirements.txt: -------------------------------------------------------------------------------- 1 | aws_cdk.core==1.191.0 2 | aws_cdk.aws_apigateway==1.191.0 3 | aws_cdk.aws_lambda==1.191.0 4 | aws_cdk.aws_s3==1.191.0 5 | aws_cdk.aws_s3_deployment==1.191.0 6 | aws_cdk.aws_dynamodb==1.191.0 7 | aws-cdk.aws_cloudformation==1.191.0 8 | aws-cdk.aws_lambda_event_sources==1.191.0 9 | aws-cdk.aws_codepipeline_actions==1.191.0 10 | aws-cdk.aws_codebuild==1.191.0 11 | aws-cdk.aws_codecommit==1.191.0 12 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/serverless_cicd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/visit-service-cicd/serverless_cicd/__init__.py -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/serverless_lambda/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/4-serverless-cicd-stack/visit-service-cicd/serverless_lambda/__init__.py -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | 4 | with open("README.md") as fp: 5 | long_description = fp.read() 6 | 7 | 8 | setuptools.setup( 9 | name="4_serverless_cicd", 10 | version="0.0.1", 11 | 12 | description="An empty CDK Python app", 13 | long_description=long_description, 14 | long_description_content_type="text/markdown", 15 | 16 | author="author", 17 | 18 | package_dir={"": "4_serverless_cicd"}, 19 | packages=setuptools.find_packages(where="4_serverless_cicd"), 20 | 21 | install_requires=[ 22 | "aws-cdk.core", 23 | ], 24 | 25 | python_requires=">=3.6", 26 | 27 | classifiers=[ 28 | "Development Status :: 4 - Beta", 29 | 30 | "Intended Audience :: Developers", 31 | 32 | "License :: OSI Approved :: Apache Software License", 33 | 34 | "Programming Language :: JavaScript", 35 | "Programming Language :: Python :: 3 :: Only", 36 | "Programming Language :: Python :: 3.6", 37 | "Programming Language :: Python :: 3.7", 38 | "Programming Language :: Python :: 3.8", 39 | 40 | "Topic :: Software Development :: Code Generators", 41 | "Topic :: Utilities", 42 | 43 | "Typing :: Typed", 44 | ], 45 | ) 46 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/src/main/java/org/springframework/samples/petclinic/visits/model/VisitRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.visits.model; 17 | 18 | import java.lang.Iterable; 19 | import java.util.UUID; 20 | 21 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 22 | import org.springframework.data.repository.CrudRepository; 23 | 24 | @EnableScan() 25 | public interface VisitRepository extends CrudRepository { 26 | Iterable findByPetName(String petName); 27 | } 28 | -------------------------------------------------------------------------------- /4-serverless-cicd-stack/visit-service-cicd/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/.gitignore: -------------------------------------------------------------------------------- 1 | .env/ 2 | cdk.out/ 3 | cdk.context.json 4 | */__pycache__/ 5 | .DS_Store 6 | */.DS_Store/ 7 | */*/target/ 8 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from fagate_serverless.fagate_serverless_stack import FagateServerlessStack 6 | 7 | 8 | app = core.App() 9 | FagateServerlessStack(app, "serverless-xray-stack") 10 | 11 | app.synth() 12 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py" 3 | } 4 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/fagate_serverless/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/fagate_serverless/__init__.py -------------------------------------------------------------------------------- /5-serverless-xray-stack/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/images/1.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/images/2.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/images/3.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/images/4.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/images/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/images/5.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/images/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/images/6.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/images/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/images/7.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/images/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/images/8.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/requirements.txt: -------------------------------------------------------------------------------- 1 | aws_cdk.core==1.191.0 2 | aws_cdk.aws_ec2==1.191.0 3 | aws_cdk.aws_ecs==1.191.0 4 | aws_cdk.aws_cloudformation==1.191.0 5 | aws_cdk.aws_lambda==1.191.0 6 | aws_cdk.aws_s3==1.191.0 7 | aws_cdk.aws_s3_deployment==1.191.0 8 | aws_cdk.aws_dynamodb==1.191.0 9 | aws_cdk.aws_elasticloadbalancingv2==1.191.0 10 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-serverless/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.4/maven-wrapper-0.5.4.jar 3 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | VOLUME /tmp 3 | ARG JAR_FILE 4 | ADD target/${JAR_FILE} app.jar 5 | RUN sh -c 'touch /app.jar' 6 | ENV JAVA_OPTS="" 7 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ] -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/java/org/springframework/samples/petclinic/customers/model/OwnerRepository.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.customers.model; 2 | 3 | import java.util.UUID; 4 | 5 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 6 | import org.springframework.data.repository.CrudRepository; 7 | 8 | @EnableScan() 9 | public interface OwnerRepository extends CrudRepository { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/java/org/springframework/samples/petclinic/customers/model/Pet.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.customers.model; 2 | 3 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBDocument; 4 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBGeneratedUuid; 5 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGenerateStrategy; 6 | 7 | import java.util.Date; 8 | import java.util.UUID; 9 | 10 | @DynamoDBDocument 11 | public class Pet { 12 | 13 | private int id; 14 | private String name; 15 | private Date birthDate; 16 | private String type; 17 | 18 | public Pet(String name, Date birthDate, String type){ 19 | this.name = name; 20 | this.birthDate = birthDate; 21 | this.type = type; 22 | } 23 | 24 | public Pet(){ 25 | 26 | } 27 | 28 | 29 | public int getId() { 30 | return id; 31 | } 32 | 33 | public void setId(final int id) { 34 | this.id = id; 35 | } 36 | 37 | public String getName() { 38 | return this.name; 39 | } 40 | 41 | public void setName(final String name) { 42 | this.name = name; 43 | } 44 | 45 | public Date getBirthDate() { 46 | return birthDate; 47 | } 48 | 49 | public void setBirthDate(final Date birthDate) { 50 | this.birthDate = birthDate; 51 | } 52 | 53 | public String getType(){ 54 | return type; 55 | } 56 | 57 | public void setType(String type){ 58 | this.type = type; 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/java/org/springframework/samples/petclinic/customers/web/PetDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers.web; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.Date; 21 | 22 | import org.springframework.format.annotation.DateTimeFormat; 23 | import org.springframework.samples.petclinic.customers.model.Pet; 24 | import org.springframework.samples.petclinic.customers.model.Owner; 25 | 26 | /** 27 | * @author mszarlinski@bravurasolutions.com on 2016-12-05. 28 | */ 29 | @Data 30 | class PetDetails { 31 | 32 | private long id; 33 | 34 | private String name; 35 | 36 | private String owner; 37 | 38 | @DateTimeFormat(pattern = "yyyy-MM-dd") 39 | private Date birthDate; 40 | 41 | private String type; 42 | 43 | PetDetails(Pet pet, Owner owner) { 44 | this.id = pet.getId(); 45 | this.name = pet.getName(); 46 | this.owner = owner.getFirstName() + " " + owner.getLastName(); 47 | this.birthDate = pet.getBirthDate(); 48 | this.type = pet.getType(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/java/org/springframework/samples/petclinic/customers/web/PetRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers.web; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.Date; 21 | 22 | import javax.validation.constraints.Size; 23 | 24 | import com.fasterxml.jackson.annotation.JsonFormat; 25 | 26 | /** 27 | * @author mszarlinski@bravurasolutions.com on 2016-12-05. 28 | */ 29 | @Data 30 | class PetRequest { 31 | private int id; 32 | 33 | @JsonFormat(pattern = "yyyy-MM-dd") 34 | private Date birthDate; 35 | 36 | @Size(min = 1) 37 | private String name; 38 | 39 | private String type; 40 | } 41 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/java/org/springframework/samples/petclinic/customers/web/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.customers.web; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(value = HttpStatus.NOT_FOUND) 7 | public class ResourceNotFoundException extends RuntimeException { 8 | 9 | public ResourceNotFoundException(String message) { 10 | super(message); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Actuator / Management 2 | management.endpoints.web.base-path=/manage 3 | management.endpoints.web.exposure.include=* 4 | 5 | # Logging 6 | logging.level.org.springframework=INFO 7 | logging.level.com.amazonaws=INFO 8 | # logging.level.org.springframework.web=DEBUG 9 | # logging.level.org.springframework.context.annotation=TRACE 10 | 11 | # Maximum time static resources should be cached 12 | spring.resources.cache.cachecontrol.max-age=12h -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring.jpa.hibernate.ddl-auto: none 2 | 3 | spring: 4 | datasource: 5 | schema: classpath*:db/hsqldb/schema.sql 6 | data: classpath*:db/hsqldb/data.sql 7 | 8 | logging.level.org.springframework: INFO 9 | 10 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-customers-serverless/src/test/resources/bootstrap-test.yml: -------------------------------------------------------------------------------- 1 | spring.cloud.config.enabled: false 2 | eureka.client.enabled: false 3 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-vets-serverless/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | VOLUME /tmp 3 | ARG JAR_FILE 4 | ADD target/${JAR_FILE} app.jar 5 | RUN sh -c 'touch /app.jar' 6 | ENV JAVA_OPTS="" 7 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ] -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-vets-serverless/src/main/java/org/springframework/samples/petclinic/vets/model/VetRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets.model; 17 | 18 | import java.util.UUID; 19 | 20 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 21 | import org.springframework.data.repository.CrudRepository; 22 | 23 | @EnableScan() 24 | public interface VetRepository extends CrudRepository { 25 | } 26 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-vets-serverless/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Actuator / Management 2 | management.endpoints.web.base-path=/manage 3 | management.endpoints.web.exposure.include=* 4 | 5 | # Logging 6 | logging.level.org.springframework=INFO 7 | # logging.level.org.springframework.web=DEBUG 8 | # logging.level.org.springframework.context.annotation=TRACE 9 | 10 | # Maximum time static resources should be cached 11 | spring.resources.cache.cachecontrol.max-age=12h 12 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-vets-serverless/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-vets-serverless/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring.jpa.hibernate.ddl-auto: none 2 | 3 | spring: 4 | datasource: 5 | schema: classpath*:db/hsqldb/schema.sql 6 | data: classpath*:db/hsqldb/data.sql 7 | 8 | vets: 9 | cache: 10 | ttl: 10 11 | heap-size: 10 12 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-vets-serverless/src/test/resources/bootstrap-test.yml: -------------------------------------------------------------------------------- 1 | spring.cloud.config.enabled: false 2 | eureka.client.enabled: false 3 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-visits-serverless/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | VOLUME /tmp 3 | ARG JAR_FILE 4 | ADD target/${JAR_FILE} app.jar 5 | RUN sh -c 'touch /app.jar' 6 | ENV JAVA_OPTS="" 7 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ] -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-visits-serverless/src/main/java/org/springframework/samples/petclinic/visits/model/VisitRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.visits.model; 17 | 18 | import java.lang.Iterable; 19 | import java.util.UUID; 20 | 21 | import org.socialsignin.spring.data.dynamodb.repository.EnableScan; 22 | import org.springframework.data.repository.CrudRepository; 23 | 24 | @EnableScan() 25 | public interface VisitRepository extends CrudRepository { 26 | Iterable findByPetName(String petName); 27 | } 28 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-visits-serverless/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Actuator / Management 2 | management.endpoints.web.base-path=/manage 3 | management.endpoints.web.exposure.include=* 4 | 5 | # Logging 6 | logging.level.org.springframework=INFO 7 | # logging.level.org.springframework.web=DEBUG 8 | # logging.level.org.springframework.context.annotation=TRACE 9 | 10 | # Maximum time static resources should be cached 11 | spring.resources.cache.cachecontrol.max-age=12h 12 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-visits-serverless/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-visits-serverless/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring.jpa.hibernate.ddl-auto: none 2 | 3 | spring: 4 | datasource: 5 | schema: classpath*:db/hsqldb/schema.sql 6 | data: classpath*:db/hsqldb/data.sql 7 | 8 | logging.level.org.springframework: INFO 9 | 10 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-serverless/spring-petclinic-visits-serverless/src/test/resources/bootstrap-test.yml: -------------------------------------------------------------------------------- 1 | spring.cloud.config.enabled: false 2 | eureka.client.enabled: false 3 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/data/visit.json: -------------------------------------------------------------------------------- 1 | { 2 | "test_visit": [ 3 | { 4 | "PutRequest": { 5 | "Item": { 6 | "date": { 7 | "S": "2019-09-28T10:32:13.687Z" 8 | }, 9 | "petName": { 10 | "S": "Mulligan" 11 | }, 12 | "id": { 13 | "S": "062aa65d-f749-40cd-abff-3a5f82adf445" 14 | }, 15 | "ownerId": { 16 | "S": "c403fc06-af5e-46a3-b0f7-a63a4361d034" 17 | } 18 | } 19 | } 20 | }, 21 | { 22 | "PutRequest": { 23 | "Item": { 24 | "date": { 25 | "S": "2019-09-27T10:32:51.953Z" 26 | }, 27 | "petName": { 28 | "S": "Leo" 29 | }, 30 | "id": { 31 | "S": "88ee7695-82a7-4e78-a1b8-76042c404dd6" 32 | }, 33 | "ownerId": { 34 | "S": "e76a7cd1-9120-4a20-9cb5-560e13741341" 35 | } 36 | } 37 | } 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/fonts/montserrat-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/fonts/montserrat-webfont.eot -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/fonts/montserrat-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/fonts/montserrat-webfont.ttf -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/fonts/montserrat-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/fonts/montserrat-webfont.woff -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/fonts/varela_round-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/fonts/varela_round-webfont.eot -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/fonts/varela_round-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/fonts/varela_round-webfont.ttf -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/fonts/varela_round-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/fonts/varela_round-webfont.woff -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/images/favicon.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/images/pets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/images/pets.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/images/platform-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/images/platform-bg.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/images/spring-logo-dataflow-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/images/spring-logo-dataflow-mobile.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/images/spring-logo-dataflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/images/spring-logo-dataflow.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/images/spring-pivotal-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/images/spring-pivotal-logo.png -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /* App Module */ 3 | var petClinicApp = angular.module('petClinicApp', [ 4 | 'ui.router', 'layoutNav', 'layoutFooter', 'layoutWelcome', 5 | 'ownerList', 'ownerDetails', 'ownerForm', 'petForm', 'visits', 'vetList']); 6 | 7 | petClinicApp.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider', function( 8 | $stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) { 9 | 10 | // safari turns to be lazy sending the Cache-Control header 11 | $httpProvider.defaults.headers.common["Cache-Control"] = 'no-cache'; 12 | 13 | $locationProvider.hashPrefix('!'); 14 | 15 | $urlRouterProvider.otherwise('/welcome'); 16 | $stateProvider 17 | .state('app', { 18 | abstract: true, 19 | url: '', 20 | template: '' 21 | }) 22 | .state('welcome', { 23 | parent: 'app', 24 | url: '/welcome', 25 | template: '' 26 | }); 27 | }]); 28 | 29 | ['welcome', 'nav', 'footer'].forEach(function(c) { 30 | var mod = 'layout' + c.toUpperCase().substring(0, 1) + c.substring(1); 31 | angular.module(mod, []); 32 | angular.module(mod).component(mod, { 33 | templateUrl: "scripts/fragments/" + c + ".html" 34 | }); 35 | }); -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/config.js: -------------------------------------------------------------------------------- 1 | let _baseUrl = '' -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/fragments/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Sponsored by Pivotal
5 |
6 |
-------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/fragments/welcome.html: -------------------------------------------------------------------------------- 1 |

Welcome to Petclinic

2 | 3 |
4 |
5 | pets logo 6 |
7 |
-------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-details/owner-details.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .component('ownerDetails', { 5 | templateUrl: 'scripts/owner-details/owner-details.template.html', 6 | controller: 'OwnerDetailsController' 7 | }); 8 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-details/owner-details.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .controller('OwnerDetailsController', ['$http', '$stateParams', function ($http, $stateParams) { 5 | var self = this; 6 | 7 | $http.get(_baseUrl + 'api/customer/owners/' + $stateParams.ownerId).then(function (resp) { 8 | self.owner = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-details/owner-details.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerDetails', { 7 | parent: 'app', 8 | url: '/owners/details/:ownerId', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-form/owner-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .component('ownerForm', { 5 | templateUrl: 'scripts/owner-form/owner-form.template.html', 6 | controller: 'OwnerFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-form/owner-form.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .controller('OwnerFormController', ["$http", '$state', '$stateParams', function ($http, $state, $stateParams) { 5 | var self = this; 6 | 7 | var ownerId = $stateParams.ownerId || 0; 8 | 9 | if (!ownerId) { 10 | self.owner = {}; 11 | } else { 12 | $http.get(_baseUrl + "api/customer/owners/" + ownerId).then(function (resp) { 13 | self.owner = resp.data; 14 | }); 15 | } 16 | 17 | self.submitOwnerForm = function () { 18 | var id = self.owner.id; 19 | var req; 20 | if (id) { 21 | req = $http.put(_baseUrl + "api/customer/owners/" + id, self.owner); 22 | } else { 23 | req = $http.post(_baseUrl + "api/customer/owners", self.owner); 24 | } 25 | 26 | req.then(function () { 27 | $state.go('owners'); 28 | }, function (response) { 29 | var error = response.data; 30 | alert(error.error + "\r\n" + error.errors.map(function (e) { 31 | return e.field + ": " + e.defaultMessage; 32 | }).join("\r\n")); 33 | }); 34 | }; 35 | }]); 36 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-form/owner-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerNew', { 7 | parent: 'app', 8 | url: '/owners/new', 9 | template: '' 10 | }) 11 | .state('ownerEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/edit', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-form/owner-form.template.html: -------------------------------------------------------------------------------- 1 |

Owner

2 |
3 |
4 | 5 | 6 | First name is required. 7 |
8 | 9 |
10 | 11 | 12 | Last name is required. 13 |
14 | 15 | 16 |
17 | 18 | 19 | Address is required. 20 |
21 | 22 |
23 | 24 | 25 | City is required. 26 |
27 | 28 |
29 | 30 | 31 | Telephone is required. 32 |
33 | 34 |
35 | 36 |
37 |
38 | 39 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-list/owner-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .component('ownerList', { 5 | templateUrl: 'scripts/owner-list/owner-list.template.html', 6 | controller: 'OwnerListController' 7 | }); 8 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-list/owner-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .controller('OwnerListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get(_baseUrl + 'api/customer/owners').then(function (resp) { 8 | self.owners = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-list/owner-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('owners', { 7 | parent: 'app', 8 | url: '/owners', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/owner-list/owner-list.template.html: -------------------------------------------------------------------------------- 1 |

Owners

2 | 3 |
4 |
5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | 30 | 31 |
NameCityTelephone
22 | 23 | {{owner.firstName}} {{owner.lastName}} 24 | 25 | {{owner.city}}{{owner.telephone}}
32 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/pet-form/pet-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm') 4 | .component('petForm', { 5 | templateUrl: 'scripts/pet-form/pet-form.template.html', 6 | controller: 'PetFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/pet-form/pet-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('petNew', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/new-pet', 9 | template: '' 10 | }) 11 | .state('petEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/pets/:petName', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/pet-form/pet-form.template.html: -------------------------------------------------------------------------------- 1 |

Pet

2 | 3 |
4 |
5 | 6 |
7 |

{{$ctrl.pet.owner}}

8 |
9 |
10 | 11 |
12 | 13 |
14 | 15 | Name is required. 16 |
17 |
18 | 19 |
20 | 21 |
22 | 23 | birth date is required. 24 |
25 |
26 | 27 |
28 | 29 |
30 | 33 |
34 |
35 | 36 |
37 |
38 | 41 |
42 |
43 |
44 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/vet-list/vet-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .component('vetList', { 5 | templateUrl: 'scripts/vet-list/vet-list.template.html', 6 | controller: 'VetListController' 7 | }); 8 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/vet-list/vet-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .controller('VetListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get(_baseUrl + 'api/vet/vets').then(function (resp) { 8 | self.vetList = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/vet-list/vet-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('vets', { 7 | parent: 'app', 8 | url: '/vets', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/vet-list/vet-list.template.html: -------------------------------------------------------------------------------- 1 |

Veterinarians

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
NameSpecialties
{{vet.firstName}} {{vet.lastName}}{{specialty + ' '}}
16 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/visits/visits.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .component('visits', { 5 | templateUrl: 'scripts/visits/visits.template.html', 6 | controller: 'VisitsController' 7 | }); 8 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/visits/visits.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .controller('VisitsController', ['$http', '$state', '$stateParams', '$filter', function ($http, $state, $stateParams, $filter) { 5 | var self = this; 6 | var petName = $stateParams.petName || 0; 7 | var url = _baseUrl + "api/visit/owners/" + ($stateParams.ownerId || 0) + "/pets/" + petName + "/visits"; 8 | self.date = new Date(); 9 | self.desc = ""; 10 | 11 | $http.get(url).then(function (resp) { 12 | self.visits = resp.data; 13 | }); 14 | 15 | self.submit = function () { 16 | var data = { 17 | date: $filter('date')(self.date, "yyyy-MM-dd"), 18 | description: self.desc 19 | }; 20 | 21 | $http.post(url, data).then(function () { 22 | $state.go("owners", { ownerId: $stateParams.ownerId }); 23 | }, function (response) { 24 | var error = response.data; 25 | alert(error.error + "\r\n" + error.errors.map(function (e) { 26 | return e.field + ": " + e.defaultMessage; 27 | }).join("\r\n")); 28 | }); 29 | }; 30 | }]); 31 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/visits/visits.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('visits', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/pets/:petName/visits', 9 | template: '' 10 | }) 11 | }]); 12 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/scripts/visits/visits.template.html: -------------------------------------------------------------------------------- 1 |

Visits

2 | 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 |
11 | 12 | 13 |
14 | 15 |
16 | 17 |
18 | 19 |
20 | 21 |

Previous Visits

22 | 23 | 24 | 25 | 26 | 27 |
{{v.date}}{{v.description}}
-------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | indent_size = 2 9 | indent_style = space 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | trim_trailing_whitespace = false 15 | 16 | [*.py] 17 | indent_size = 4 18 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | *.css text eol=lf 3 | *.html text eol=lf 4 | *.js text eol=lf 5 | *.json text eol=lf 6 | *.less text eol=lf 7 | *.md text eol=lf 8 | *.svg text eol=lf 9 | *.yml text eol=lf 10 | # Don't diff or textually merge source maps 11 | *.map binary 12 | 13 | bootstrap-theme.css linguist-vendored=false 14 | bootstrap.css linguist-vendored=false 15 | bootstrap.js linguist-vendored=false 16 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore docs files 2 | _gh_pages 3 | _site 4 | .ruby-version 5 | 6 | # Numerous always-ignore extensions 7 | *.diff 8 | *.err 9 | *.log 10 | *.orig 11 | *.rej 12 | *.swo 13 | *.swp 14 | *.vi 15 | *.zip 16 | *~ 17 | 18 | # OS or Editor folders 19 | ._* 20 | .cache 21 | .DS_Store 22 | .idea 23 | .project 24 | .settings 25 | .tmproj 26 | *.esproj 27 | *.sublime-project 28 | *.sublime-workspace 29 | nbproject 30 | Thumbs.db 31 | 32 | # Komodo 33 | .komodotools 34 | *.komodoproject 35 | 36 | # Jekyll metadata 37 | docs/.jekyll-metadata 38 | 39 | # Folders to ignore 40 | bower_components 41 | node_modules 42 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/.hound.yml: -------------------------------------------------------------------------------- 1 | fail_on_violations: true 2 | 3 | scss: 4 | enabled: false 5 | 6 | javascript: 7 | enabled: true 8 | config_file: js/.jshintrc 9 | 10 | jscs: 11 | enabled: true 12 | config_file: js/.jscsrc 13 | -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /5-serverless-xray-stack/spring-petclinic-static/vendors/bootstrap/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /6-serverless-graphql-stack/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | */.DS_Store/ 3 | */.env/ 4 | */cdk.out/ 5 | */cdk.context.json 6 | */__pycache__/ 7 | frontend/ 8 | -------------------------------------------------------------------------------- /6-serverless-graphql-stack/AWS-AppSync.svg: -------------------------------------------------------------------------------- 1 | AWS-AppSync_light-bg -------------------------------------------------------------------------------- /6-serverless-graphql-stack/DateInput.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import ReactDatePicker from "react-datepicker"; 3 | import * as moment from "moment"; 4 | 5 | import { FieldError, InputChangeHandler } from "../../types"; 6 | 7 | import FieldFeedbackPanel from "./FieldFeedbackPanel"; 8 | 9 | const DateInput = ({ 10 | object, 11 | fieldError, 12 | name, 13 | label, 14 | onChange, 15 | onBlur 16 | }: { 17 | object: any; 18 | fieldError: FieldError | null; 19 | name: string; 20 | label: string; 21 | onChange: InputChangeHandler; 22 | onBlur: (name: string) => void; 23 | }) => { 24 | const handleOnChange = (value: any) => { 25 | const dateString = value ? value.format("YYYY-MM-DD") : null; 26 | onChange(name, dateString); 27 | }; 28 | 29 | const selectedValue = object[name] ? moment(object[name], "YYYY-MM-DD") : null; 30 | const valid = !fieldError && selectedValue != null; 31 | 32 | const cssGroup = `form-group ${fieldError ? "has-error" : ""}`; 33 | 34 | return ( 35 |
36 | 39 | 40 |
41 | onBlur(e.currentTarget.name)}/> 43 |
46 |
47 | ); 48 | }; 49 | export default DateInput; 50 | -------------------------------------------------------------------------------- /6-serverless-graphql-stack/UpdatePetPage.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { gql, graphql, QueryProps, DefaultChildProps, MutationFunc } from "react-apollo"; 3 | import { withRouter, RouteComponentProps } from "react-router-dom"; 4 | import * as UpdatePetMutationGql from "./UpdatePetMutation.graphql"; 5 | import { GetUpdatePetFormDataQuery, UpdatePetInput, UpdatePetMutation, PetData } from "../../types"; 6 | import PetEditForm from "../PetForm"; 7 | 8 | import withUpdatePetFormData from "./withUpdatePetFormData"; 9 | 10 | type UpdatePetPageOwnProps = RouteComponentProps<{}> & { 11 | formData: GetUpdatePetFormDataQuery; 12 | }; 13 | type UpdatePetPageProps = UpdatePetPageOwnProps & { 14 | mutate: MutationFunc; 15 | }; 16 | 17 | const UpdatePetPage = ({ mutate, history, formData }: UpdatePetPageProps) => 18 |
19 | { 27 | const input: UpdatePetInput = { 28 | name: pet.name, 29 | petId: formData.pet.id, 30 | birthDate: pet.birthDate, 31 | typeId: pet.type 32 | }; 33 | return mutate({ 34 | variables: { input } 35 | }) 36 | .then(({ data }) => { 37 | history.push(`/owners/${formData.pet.owner.id}`); 38 | }) 39 | .catch(error => { 40 | console.log("there was an error sending the query", error); 41 | return Promise.reject(`Could not save owner: ${error}`); 42 | }); 43 | }} 44 | /> 45 |
; 46 | 47 | export default withUpdatePetFormData(graphql(UpdatePetMutationGql)(UpdatePetPage)); 48 | -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from app_sync_cdk.app_sync_cdk_stack import AppSyncCdkStack 6 | 7 | 8 | app = core.App() 9 | AppSyncCdkStack(app, "serverless-appsync-stack") 10 | 11 | app.synth() -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/app_sync_cdk/__pycache__/app_sync_cdk_stack.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/cdk-microservices-labs/fabed4332f79b01937c193bd4fed3eee474adf14/6-serverless-graphql-stack/backend/app_sync_cdk/__pycache__/app_sync_cdk_stack.cpython-36.pyc -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py" 3 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/custom-resource-code/cfnresponse.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Amazon Web Services, Inc. or its affiliates. All Rights Reserved. 2 | # This file is licensed to you under the AWS Customer Agreement (the "License"). 3 | # You may not use this file except in compliance with the License. 4 | # A copy of the License is located at http://aws.amazon.com/agreement/ . 5 | # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. 6 | # See the License for the specific language governing permissions and limitations under the License. 7 | 8 | from botocore.vendored import requests 9 | import json 10 | 11 | SUCCESS = "SUCCESS" 12 | FAILED = "FAILED" 13 | 14 | def send(event, context, responseStatus, responseData, physicalResourceId=None, noEcho=False): 15 | responseUrl = event['ResponseURL'] 16 | 17 | print(responseUrl) 18 | 19 | responseBody = {} 20 | responseBody['Status'] = responseStatus 21 | responseBody['Reason'] = 'See the details in CloudWatch Log Stream: ' + context.log_stream_name 22 | responseBody['PhysicalResourceId'] = physicalResourceId or context.log_stream_name 23 | responseBody['StackId'] = event['StackId'] 24 | responseBody['RequestId'] = event['RequestId'] 25 | responseBody['LogicalResourceId'] = event['LogicalResourceId'] 26 | responseBody['NoEcho'] = noEcho 27 | responseBody['Data'] = responseData 28 | 29 | json_responseBody = json.dumps(responseBody) 30 | 31 | print("Response body:\n" + json_responseBody) 32 | 33 | headers = { 34 | 'content-type' : '', 35 | 'content-length' : str(len(json_responseBody)) 36 | } 37 | 38 | try: 39 | response = requests.put(responseUrl, 40 | data=json_responseBody, 41 | headers=headers) 42 | print("Status code: " + response.reason) 43 | except Exception as e: 44 | print("send(..) failed executing requests.put(..): " + str(e)) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/custom-resource-code/initDB.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS vets ( 2 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 | first_name VARCHAR(30), 4 | last_name VARCHAR(30), 5 | INDEX(last_name) 6 | ) engine=InnoDB; 7 | 8 | CREATE TABLE IF NOT EXISTS specialties ( 9 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 10 | name VARCHAR(80), 11 | INDEX(name) 12 | ) engine=InnoDB; 13 | 14 | CREATE TABLE IF NOT EXISTS vet_specialties ( 15 | vet_id INT(4) UNSIGNED NOT NULL, 16 | specialty_id INT(4) UNSIGNED NOT NULL, 17 | FOREIGN KEY (vet_id) REFERENCES vets(id), 18 | FOREIGN KEY (specialty_id) REFERENCES specialties(id), 19 | UNIQUE (vet_id,specialty_id) 20 | ) engine=InnoDB; 21 | 22 | CREATE TABLE IF NOT EXISTS types ( 23 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 24 | name VARCHAR(80), 25 | INDEX(name) 26 | ) engine=InnoDB; 27 | 28 | CREATE TABLE IF NOT EXISTS owners ( 29 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 30 | first_name VARCHAR(30), 31 | last_name VARCHAR(30), 32 | address VARCHAR(255), 33 | city VARCHAR(80), 34 | telephone VARCHAR(20), 35 | INDEX(last_name) 36 | ) engine=InnoDB; 37 | 38 | CREATE TABLE IF NOT EXISTS pets ( 39 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 40 | name VARCHAR(30), 41 | birth_date DATE, 42 | type_id INT(4) UNSIGNED NOT NULL, 43 | owner_id INT(4) UNSIGNED NOT NULL, 44 | INDEX(name), 45 | FOREIGN KEY (owner_id) REFERENCES owners(id), 46 | FOREIGN KEY (type_id) REFERENCES types(id) 47 | ) engine=InnoDB; 48 | 49 | CREATE TABLE IF NOT EXISTS visits ( 50 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 51 | pet_id INT(4) UNSIGNED NOT NULL, 52 | visit_date DATE, 53 | description VARCHAR(255), 54 | FOREIGN KEY (pet_id) REFERENCES pets(id) 55 | ) engine=InnoDB; 56 | -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/request/Query_Owner_getOwnerById.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "statements": [ 6 | "select id, first_name firstName, last_name lastName, address, city, telephone from owners where id = $ctx.args.id" 7 | ] 8 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/request/Query_Owner_getPetsByOwner.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "statements": [ 6 | "select pets.id, pets.name, pets.birth_date birthDate, pets.type_id, types.name type_name from pets,types where pets.type_id=types.id and owner_id = $ctx.args.id" 7 | ] 8 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/request/Query_Owner_getVistsByPet.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "statements": [ 6 | "select visits.id, visits.visit_date date, visits.description, visits.pet_id from visits,pets,owners where visits.pet_id=pets.id and pets.owner_id = owners.id and owners.id = $ctx.args.id" 7 | ] 8 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/request/Query_Owners_getAllOwners.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "statements": [ 6 | "select id,first_name firstName,last_name lastName,address,city,telephone from owners" 7 | ] 8 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/request/Query_Owners_getPetsByOwner.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "statements": [ 6 | "select pets.id,pets.name,pets.birth_date birthDate,pets.owner_id,pets.type_id,types.name type_name from pets,types where pets.type_id=types.id", 7 | "select id,visit_date date,pet_id,description from visits" 8 | ] 9 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/request/Query_Pet_getPetById.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "statements": [ 6 | "SELECT pets.id,pets.name,pets.birth_date birthDate,owner_id,type_id,owners.first_name owner_firstName, owners.last_name owner_lastName,owners.address owner_address,owners.city owner_city,owners.telephone owner_telephone, types.name type_name FROM types,owners,pets WHERE pets.type_id=types.id and pets.owner_id=owners.id and pets.id = $ctx.args.id" 7 | ] 8 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/request/Query_Pet_getVisitByPet.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "statements": [ 6 | "select visits.id, visits.visit_date date, visits.description, visits.pet_id from visits,pets where visits.pet_id=pets.id and pets.id = $ctx.args.id" 7 | ] 8 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/request/Query_Vets_getSpecByVets.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "statements": [ 6 | "select a.*, b.name, b.id from vet_specialties a, specialties b where a.specialty_id=b.id" 7 | ] 8 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/request/Query_Vets_getVets.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "statements": [ 6 | "select id, first_name firstName, last_name lastName from vets" 7 | ] 8 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/response/Query_Owner_getOwnerById.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson($utils.rds.toJsonObject($ctx.result)[0][0]) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/response/Query_Owner_getPetsByOwner.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | #set($owner=$ctx.prev.result) 6 | #set($pets=$utils.rds.toJsonObject($ctx.result)[0]) 7 | #foreach( $pet in $pets ) 8 | $util.qr($pet.put("type", {"id": $pet.type_id, "name":$pet.type_name})) 9 | #end 10 | $util.qr($owner.put("pets",$pets)) 11 | 12 | $utils.toJson($owner) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/response/Query_Owner_getVistsByPet.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | #set($owner=$ctx.prev.result) 6 | #set($visits=$utils.rds.toJsonObject($ctx.result)[0]) 7 | #set($pets=[]) 8 | #foreach( $pet in $owner.pets ) 9 | #set($out=[]) 10 | #foreach( $visit in $visits ) 11 | #if($pet.id == $visit.pet_id) 12 | $util.qr($out.add($visit)) 13 | #end 14 | #end 15 | $util.qr($pet.put("visits", {"visits":$out,"totalCount":$out.size()})) 16 | $util.qr($pets.add($pet)) 17 | #end 18 | $util.qr($owner.put("pets", $pets)) 19 | $utils.toJson($owner) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/response/Query_Owners_getAllOwners.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson($utils.rds.toJsonObject($ctx.result)[0]) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/response/Query_Owners_getPetsByOwner.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | #set($owners=$ctx.prev.result) 7 | #set($pets=$utils.rds.toJsonObject($ctx.result)[0]) 8 | #set($visits=$utils.rds.toJsonObject($ctx.result)[1]) 9 | #foreach( $owner in $owners ) 10 | #set($out=[]) 11 | #foreach( $pet in $pets ) 12 | #if($owner.id == $pet.owner_id) 13 | $util.qr($out.add($pet)) 14 | #set($type={"id": $pet.type_id, "name": $pet.type_name}) 15 | $util.qr($pet.put("type", $type)) 16 | #set($vout=[]) 17 | #foreach( $visit in $visits ) 18 | #if($visit.pet_id==$pet.id) 19 | $util.qr($vout.add($visit)) 20 | #end 21 | #end 22 | $util.qr($pet.put("visits", {"visits": $vout, "totalCount":$vout.size()})) 23 | #end 24 | #end 25 | $util.qr($owner.put("pets", $out)) 26 | #end 27 | $utils.toJson($owners) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/response/Query_Pet_getPetById.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | #set($output={}) 6 | #set($type={}) 7 | #set($owner={}) 8 | #set($origin=$utils.rds.toJsonObject($ctx.result)[0][0]) 9 | 10 | #foreach ($key in $origin.keySet()) 11 | #if($key.startsWith("owner_")) 12 | $util.qr($owner.put($key.replace("owner_",""), $origin.get($key))) 13 | #elseif($key.startsWith("type_")) 14 | $util.qr($type.put($key.replace("type_",""), $origin.get($key))) 15 | #else 16 | $util.qr($output.put($key, $origin.get($key))) 17 | #end 18 | #end 19 | 20 | $util.qr($output.put("owner", $owner)) 21 | $util.qr($output.put("type",$type)) 22 | 23 | $utils.toJson($output) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/response/Query_Pet_getVisitByPet.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | #set($visits=$utils.rds.toJsonObject($ctx.result)[0]) 7 | #set($pet=$ctx.prev.result) 8 | $util.qr($pet.put("visits", {"visits":$visits,"totalCount":$visits.size()})) 9 | 10 | $utils.toJson($pet) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/response/Query_Vets_getSpecByVets.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | #set($vets=$ctx.prev.result) 6 | #set($vetSpecs=$utils.rds.toJsonObject($ctx.result)[0]) 7 | #set($output=[]) 8 | 9 | #foreach($vet in $vets) 10 | #set($specOut=[]) 11 | #foreach( $vetSpec in $vetSpecs ) 12 | #if($vet.id==$vetSpec.vet_id) 13 | $util.qr($specOut.add($vetSpec)) 14 | #end 15 | #end 16 | ##if($specOut.size()>0) 17 | $util.qr($vet.put("specialties", $specOut)) 18 | ##end 19 | $util.qr($output.add($vet)) 20 | #end 21 | 22 | $utils.toJson($output) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/function/response/Query_Vets_getVets.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson($utils.rds.toJsonObject($ctx.result)[0]) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/request/addOwner.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2018-05-29", 3 | "statements": [ 4 | "INSERT INTO owners VALUES (NULL, '$ctx.args.input.firstName', '$ctx.args.input.lastName', '$ctx.args.input.address', '$ctx.args.input.city', '$ctx.args.input.telephone')", 5 | "SELECT id, first_name firstName, last_name lastName, address, city, telephone FROM owners WHERE id = LAST_INSERT_ID()" 6 | ] 7 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/request/addPet.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "version": "2018-05-29", 6 | "statements": [ 7 | "insert into pets VALUES (null, '$ctx.args.input.name', '$ctx.args.input.birthDate', $ctx.args.input.typeId, $ctx.args.input.ownerId)", 8 | "SELECT pets.id,pets.name,pets.birth_date birthDate,owner_id,type_id,owners.first_name owner_firstName, owners.last_name owner_lastName,owners.address owner_address,owners.city owner_city,owners.telephone owner_telephone, types.name type_name FROM types,owners,pets WHERE pets.type_id=types.id and pets.owner_id=owners.id and pets.id = LAST_INSERT_ID()" 9 | ] 10 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/request/addSpecialty.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "version": "2018-05-29", 6 | "statements": [ 7 | "INSERT INTO specialties VALUES(NULL, '$ctx.args.input.name')", 8 | "SELECT * FROM specialties WHERE id=LAST_INSERT_ID()" 9 | ] 10 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/request/addVisit.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "version": "2018-05-29", 6 | "statements": [ 7 | "INSERT INTO visits VALUES(NULL, $ctx.args.input.petId, '$ctx.args.input.date', '$ctx.args.input.description')", 8 | "SELECT visits.id, pet_id, visit_date date, description, pets.name pet_name, pets.birth_date pet_birthDate, pets.owner_id,pets.type_id,owners.first_name owner_firstName,owners.last_name owner_lastName,owners.address owner_address,owners.city owner_city,owners.telephone owner_telephone,types.name type_name FROM visits,pets,owners,types WHERE visits.pet_id=pets.id AND pets.owner_id=owners.id AND pets.type_id=types.id AND visits.id=LAST_INSERT_ID()" 9 | ] 10 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/request/removeSpecialty.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "version": "2018-05-29", 6 | "statements": [ 7 | "SELECT * FROM specialties WHERE id = $ctx.args.input.specialtyId", 8 | "DELETE FROM specialties WHERE id = $ctx.args.input.specialtyId" 9 | ] 10 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/request/updateOwner.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2018-05-29", 3 | "statements": [ 4 | "update owners set first_name='$ctx.args.input.firstName', last_name='$ctx.args.input.lastName', address='$ctx.args.input.address', city='$ctx.args.input.city', telephone='$ctx.args.input.telephone' WHERE id=$ctx.args.input.ownerId", 5 | "SELECT id, first_name firstName, last_name lastName, address, city, telephone FROM owners WHERE id = $ctx.args.input.ownerId" 6 | ] 7 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/request/updatePet.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "version": "2018-05-29", 6 | "statements": [ 7 | "UPDATE pets SET type_id=$ctx.args.input.typeId, name='$ctx.args.input.name', birth_date='$ctx.args.input.birthDate' WHERE id=$ctx.args.input.petId", 8 | "SELECT pets.id,pets.name,pets.birth_date birthDate,owner_id,type_id,owners.first_name owner_firstName, owners.last_name owner_lastName,owners.address owner_address,owners.city owner_city,owners.telephone owner_telephone, types.name type_name FROM types,owners,pets WHERE pets.type_id=types.id and pets.owner_id=owners.id and pets.id=$ctx.args.input.petId" 9 | ] 10 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/request/updateSpecialty.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "version": "2018-05-29", 6 | "statements": [ 7 | "UPDATE specialties SET name='$ctx.args.input.name' WHERE id=$ctx.args.input.specialtyId", 8 | "SELECT * FROM specialties WHERE id=$ctx.args.input.specialtyId" 9 | ] 10 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/response/addOwner.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson({"owner": $utils.rds.toJsonObject($ctx.result)[1][0]}) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/response/addPet.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | #set($output={}) 6 | #set($type={}) 7 | #set($owner={}) 8 | #set($origin=$utils.rds.toJsonObject($ctx.result)[1][0]) 9 | 10 | #foreach ($key in $origin.keySet()) 11 | #if($key.startsWith("owner_")) 12 | $util.qr($owner.put($key.replace("owner_",""), $origin.get($key))) 13 | #elseif($key.startsWith("type_")) 14 | $util.qr($type.put($key.replace("type_",""), $origin.get($key))) 15 | #else 16 | $util.qr($output.put($key, $origin.get($key))) 17 | #end 18 | #end 19 | 20 | $util.qr($output.put("owner", $owner)) 21 | $util.qr($output.put("type",$type)) 22 | 23 | $utils.toJson({"pet": $output}) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/response/addSpecialty.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson({"specialty":$utils.rds.toJsonObject($ctx.result)[1][0]}) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/response/addVisit.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | #set($pet={}) 6 | #set($owner={}) 7 | #set($type={}) 8 | #set($output={}) 9 | #set($origin=$utils.rds.toJsonObject($ctx.result)[1][0]) 10 | 11 | #foreach($key in $origin.keySet()) 12 | #if($key.startsWith("pet_")) 13 | $util.qr($pet.put($key.replace("pet_",""), $origin.get($key))) 14 | #elseif($key.startsWith("owner_")) 15 | $util.qr($owner.put($key.replace("owner_",""),$origin.get($key))) 16 | #elseif($key.startsWith("type_")) 17 | $util.qr($type.put($key.replace("type_",""),$origin.get($key))) 18 | #else 19 | $util.qr($output.put($key, $origin.get($key))) 20 | #end 21 | #end 22 | 23 | $util.qr($pet.put("owner", $owner)) 24 | $util.qr($pet.put("type",$type)) 25 | $util.qr($output.put("pet", $pet)) 26 | 27 | $utils.toJson({"visit": $output}) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/response/removeSpecialty.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson({"specialties":$utils.rds.toJsonObject($ctx.result)[0]}) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/response/updateOwner.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson({"owner": $utils.rds.toJsonObject($ctx.result)[1][0]}) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/response/updatePet.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | #set($output={}) 6 | #set($type={}) 7 | #set($owner={}) 8 | #set($origin=$utils.rds.toJsonObject($ctx.result)[1][0]) 9 | 10 | #foreach ($key in $origin.keySet()) 11 | #if($key.startsWith("owner_")) 12 | $util.qr($owner.put($key.replace("owner_",""), $origin.get($key))) 13 | #elseif($key.startsWith("type_")) 14 | $util.qr($type.put($key.replace("type_",""), $origin.get($key))) 15 | #else 16 | $util.qr($output.put($key, $origin.get($key))) 17 | #end 18 | #end 19 | 20 | $util.qr($output.put("owner", $owner)) 21 | $util.qr($output.put("type",$type)) 22 | 23 | $utils.toJson({"pet": $output}) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/mutation/response/updateSpecialty.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson({"specialty":$utils.rds.toJsonObject($ctx.result)[1][0]}) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/query/request/pettypes.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "version": "2018-05-29", 6 | "statements": [ 7 | "select * from types" 8 | ] 9 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/query/request/specialties.json: -------------------------------------------------------------------------------- 1 | #** 2 | Select statement for a relational database data source 3 | *# 4 | { 5 | "version": "2018-05-29", 6 | "statements": [ 7 | "select * from specialties" 8 | ] 9 | } -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/query/response/pettypes.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson($utils.rds.toJsonObject($ctx.result)[0]) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/definition/template/query/response/specialties.vm: -------------------------------------------------------------------------------- 1 | ## Raise a GraphQL field error in case of a datasource invocation error 2 | #if($ctx.error) 3 | $utils.error($ctx.error.message, $ctx.error.type) 4 | #end 5 | 6 | $utils.toJson($utils.rds.toJsonObject($ctx.result)[0]) -------------------------------------------------------------------------------- /6-serverless-graphql-stack/backend/requirements.txt: -------------------------------------------------------------------------------- 1 | aws_cdk.core==1.191.0 2 | aws_cdk.aws_appsync==1.191.0 3 | aws_cdk.aws_rds==1.191.0 4 | aws_cdk.aws_iam==1.191.0 5 | aws_cdk.aws_secretsmanager==1.191.0 6 | aws_cdk.aws_lambda==1.191.0 7 | aws_cdk.aws_s3==1.191.0 8 | aws_cdk.aws_s3_deployment==1.191.0 9 | aws-cdk.aws_cloudformation==1.191.0 -------------------------------------------------------------------------------- /6-serverless-graphql-stack/createGraphQLClient.tsx: -------------------------------------------------------------------------------- 1 | import { ApolloClient, createNetworkInterface } from 'react-apollo'; 2 | 3 | // http://dev.apollodata.com/react/initialization.html#creating-client 4 | export const createGraphQLClient = () => { 5 | const networkInterface = createNetworkInterface({ 6 | uri: 'https://xxxxx.appsync-api.ap-northeast-1.amazonaws.com/graphql' 7 | }); 8 | 9 | networkInterface.use([{ 10 | applyMiddleware(req, next) { 11 | if (!req.options.headers) { 12 | req.options.headers = {}; // Create the header object if needed. 13 | } 14 | // get the authentication token from local storage if it exists 15 | 16 | req.options.headers['x-api-key'] = 'da2-xxxxx' 17 | next(); 18 | } 19 | }]); 20 | 21 | 22 | const client = new ApolloClient({ 23 | networkInterface: networkInterface 24 | }); 25 | 26 | return client; 27 | }; 28 | -------------------------------------------------------------------------------- /6-serverless-graphql-stack/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | module.exports = { 3 | entry: [ 4 | "react-hot-loader/patch", 5 | "./src/index.tsx" 6 | ], 7 | 8 | output: { 9 | path: __dirname + '/public/dist/', 10 | filename: "main.js", 11 | publicPath: '/dist' 12 | }, 13 | 14 | devtool: 'inline-source-map', 15 | 16 | resolve: { 17 | extensions: ['.js', '.jsx', '.ts', '.tsx'] 18 | }, 19 | 20 | plugins: [ 21 | new webpack.NamedModulesPlugin(), 22 | new webpack.HotModuleReplacementPlugin(), 23 | ], 24 | 25 | module: { 26 | rules: [ 27 | { 28 | test: /\.less$/, 29 | use: [{ 30 | loader: "style-loader" // creates style nodes from JS strings 31 | }, { 32 | loader: "css-loader" // translates CSS into CommonJS 33 | }, { 34 | loader: "less-loader" // compiles Sass to CSS 35 | }] 36 | }, 37 | { 38 | test: /\.(graphql|gql)$/, 39 | exclude: /node_modules/, 40 | loader: ['graphql-tag/loader'], 41 | }, 42 | { 43 | test: /\.(t|j)sx?$/, 44 | use: [ 45 | "react-hot-loader/webpack", 46 | 'awesome-typescript-loader', 47 | ], 48 | exclude: /node_modules/, 49 | }, 50 | { 51 | test: /\.(png|jpg)$/, 52 | loader: 'url-loader', 53 | options: { 54 | limit: 25000 55 | } 56 | }, 57 | { 58 | test: /\.(eot|svg|ttf|woff|woff2)$/, 59 | loader: 'file-loader', 60 | options: { 61 | 'name': '/public/fonts/[name].[ext]' 62 | } 63 | }, 64 | { 65 | enforce: "pre", 66 | test: /\.js$/, 67 | loader: "source-map-loader", 68 | exclude: [/node_modules/, /dist/, /__test__/], 69 | } 70 | ] 71 | }, 72 | devServer: { 73 | hot: true, 74 | historyApiFallback: true 75 | } 76 | }; 77 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------