API feita para testar a integração do Spring boot com o AWS DynamoDB.
-
Cadastro de dados de funcionários e seus respectivos departamentos
-
Consulta de dados de funcionários e seus respectivos departamentos
-
Atualização de dados de funcionários e seus respectivos departamentos
-
Exclusão de dados de funcionários e seus respectivos departamentos
{
"swagger": "2.0",
"info": {
"description": "API using Spring Boot for dynamoDB testing",
"version": "1.0.0",
"title": "DynamoDB API",
"license": {
"name": "Apache License Version 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
}
},
"host": "localhost:8080",
"basePath": "/",
"tags": [
{
"name": "employee-controller",
"description": "Employee Controller"
}
],
"paths": {
"/v1/employees": {
"post": {
"tags": [
"employee-controller"
],
"summary": "Saves a new employee",
"description": "Saves a new employee in dynamoDB",
"operationId": "saveEmployeeUsingPOST",
"consumes": [
"application/json"
],
"produces": [
"*/*"
],
"parameters": [
{
"in": "body",
"name": "employee",
"description": "Form for creation of user",
"required": true,
"schema": {
"$ref": "#/definitions/v1/employeesInput"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v1/employees"
}
},
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"deprecated": false
}
},
"/v1/employees/{id}": {
"get": {
"tags": [
"employee-controller"
],
"summary": "Get data of specific employee",
"description": "Get data of specific employee in dynamoDB",
"operationId": "getEmployeeUsingGET",
"produces": [
"*/*"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Employee id",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v1/employeesDto"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"deprecated": false
},
"put": {
"tags": [
"employee-controller"
],
"summary": "Update data of specific employee",
"description": "Update data of specific employee in dynamoDB",
"operationId": "updateEmployeeUsingPUT",
"consumes": [
"application/json"
],
"produces": [
"*/*"
],
"parameters": [
{
"in": "body",
"name": "employee",
"description": "Form to update user",
"required": true,
"schema": {
"$ref": "#/definitions/v1/employeesInput"
}
},
{
"name": "id",
"in": "path",
"description": "Employee id",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v1/employeesDto"
}
},
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"deprecated": false
},
"delete": {
"tags": [
"employee-controller"
],
"summary": "Deletes specific employee",
"description": "Deletes employee in dynamoDB",
"operationId": "deleteEmployeeUsingDELETE",
"produces": [
"*/*"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Employee id",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK"
},
"204": {
"description": "No Content"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"deprecated": false
}
}
},
"definitions": {
"Department": {
"type": "object",
"properties": {
"departmentCode": {
"type": "string"
},
"departmentName": {
"type": "string"
}
},
"title": "Department"
},
"Employee": {
"type": "object",
"properties": {
"department": {
"$ref": "#/definitions/Department"
},
"email": {
"type": "string"
},
"employeeId": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
}
},
"title": "Employee"
},
"EmployeeDto": {
"type": "object",
"properties": {
"departamentCode": {
"type": "string"
},
"departamentName": {
"type": "string"
},
"email": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
}
},
"title": "EmployeeDto"
},
"EmployeeInput": {
"type": "object",
"properties": {
"department": {
"$ref": "#/definitions/Department"
},
"email": {
"type": "string"
},
"employeeId": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
}
},
"title": "EmployeeInput"
}
}
}
Saves a new employee
Saves a new employee in dynamoDB
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
employee | body | Form for creation of user | Yes | EmployeeInput |
Code | Description | Schema |
---|---|---|
200 | OK | Employee |
201 | Created | |
401 | Unauthorized | |
403 | Forbidden | |
404 | Not Found |
Get data of specific employee
Get data of specific employee in dynamoDB
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
id | path | Employee id | Yes | string |
Code | Description | Schema |
---|---|---|
200 | OK | EmployeeDto |
401 | Unauthorized | |
403 | Forbidden | |
404 | Not Found |
Update data of specific employee
Update data of specific employee in dynamoDB
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
employee | body | Form to update user | Yes | EmployeeInput |
id | path | Employee id | Yes | string |
Code | Description | Schema |
---|---|---|
200 | OK | EmployeeDto |
201 | Created | |
401 | Unauthorized | |
403 | Forbidden | |
404 | Not Found |
Deletes specific employee
Deletes employee in dynamoDB
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
id | path | Employee id | Yes | string |
Code | Description |
---|---|
200 | OK |
204 | No Content |
401 | Unauthorized |
403 | Forbidden |
Name | Type | Description | Required |
---|---|---|---|
departmentCode | string | No | |
departmentName | string | No |
Name | Type | Description | Required |
---|---|---|---|
department | Department | No | |
string | No | ||
employeeId | string | No | |
firstName | string | No | |
lastName | string | No |
Name | Type | Description | Required |
---|---|---|---|
departamentCode | string | No | |
departamentName | string | No | |
string | No | ||
firstName | string | No | |
lastName | string | No |
Name | Type | Description | Required |
---|---|---|---|
department | Department | No | |
string | No | ||
employeeId | string | No | |
firstName | string | No | |
lastName | string | No |
Coleção para testar os endpoints da aplicação
Pré-requisitos para rodar localmente:
- JDK 11 ou superior
- Maven 3
- Uma conta na AWS com uma tabela chamada empoyee no dynamoDB
- Um usuário com as permissões (de preferencia a de full access ao bd)
Para rodar via docker, rode os comandos abaixo:
# Baixar a imagem
docker pull gustosilva/dynamodb-api:latest
# Gerar o containter
docker run \
--env ACCESS_KEY=<ACCESS_KEY> \
--env SECRET_KEY=<SECRET_KEY> \
--env SERVICE_ENDPOINT=<SERVICE_ENDPOINT> \
--env SIGNING_REGION=<SIGNING_REGION> \
-p 8080:8080 gustosilva/dynamodb-api:latest
Projeto feito usando Java 11 e Maven 3.8 como ferramenta de build.
- spring validation
- spring web
- lombok
- spring test
- spring cache
- modelmapper
- aws-java-sdk-dynamodb
- springfox-swagger2
- springfox-swagger-ui