Sign inSign up

allanbatista/b2flow-api

By allanbatista

•Updated over 6 years ago

Image
0

862

allanbatista/b2flow-api repository overview

⁠B2Flow

É uma ferramenta para automatizar jobs de forma simples e transparente.

⁠Deploy
wget https://raw.githubusercontent.com/allanbatista/b2flow/master/docker/docker-compose-prod.yml -O docker-compose.yml
docker-compose -f docker-compose.yml up -d --force-recreate

kubectl proxy --port=8080

⁠Configurações

Banco de Dados

O único banco de dados suportado é o mongo.

B2FLOW__DATABASE__URI=mongodb://mongo:password@localhost:27017/b2flow_test?authSource=admin

Kubernetes

B2FLOW__KUBERNETES__URI: http://localhost:8080
B2FLOW__KUBERNETES__VERSION: v1
B2FLOW__KUBERNETES__USERNAME: admin
B2FLOW__KUBERNETES__PASSWORD: password

Storate

O storage da suporte tanto para o S3 quando para o GCS com interoperabilidade

  B2FLOW__STORAGE__TYPE: S3 | GCS
  B2FLOW__STORAGE__ACCESS_KEY_ID: ""
  B2FLOW__STORAGE__SECRET_KEY_ID: ""
  B2FLOW__STORAGE__REGION: ""
  B2FLOW__STORAGE__BUCKET: ""
  B2FLOW__STORAGE__PREFIX: ""
⁠API

Para fazer qualquer interação com a API interna, é necessário ter um token de authenticação que é gerada como mostra o exemplo à baixo.

POST /authentications
Content-Type: application/json

{
    "email": "[email protected]",
    "password": "password"
}

---

{
    "token": "eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE"
}
⁠Query Parâmetros

Todos os endpoints Index possuem os seguintes parâmetros por padrão:

int per_page: min 1 max 100
int page: min 1 
⁠Users
GET /users/me
X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE

---

{
    "id": "85d34b8c-5a50-48f6-bd8c-e035d18a0cdc",
    "email": "[email protected]",
    "created_at": "2019-12-02T18:48:34.561+0000",
    "updated_at": "2019-12-02T18:48:34.561+0000"
}

⁠Resources

⁠TEAMS

Um time pode ter muitos projetos e é a unidade macro de gerenciamento.

index

GET /teams
X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE

---
status: 200

[
    {
        "id": "d46d0e86-7e3e-4bfe-93ad-8293148f4d3e",
        "name": "x-team",
        "created_at": "2019-12-02T18:47:22.637+0000",
        "updated_at": "2019-12-02T18:47:22.637+0000"
    }
]

show

GET /teams/x-team
X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE

---
status: 200

{
    "id": "d46d0e86-7e3e-4bfe-93ad-8293148f4d3e",
    "name": "x-team",
    "created_at": "2019-12-02T18:47:22.637+0000",
    "updated_at": "2019-12-02T18:47:22.637+0000"
}

create

GET /teams/x-team
X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE

{
  "name": "new-team"
}

---
status: 201

{
    "id": "b14ef17f-581e-4a91-a154-017116e39a57",
    "name": "new-team",
    "created_at": "2019-12-02T18:58:41.906+0000",
    "updated_at": "2019-12-02T18:58:41.906+0000"
}

update

PATCH /teams/new-team
X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE

{
  "name": "other-name"
}

---
status: 200

{
    "id": "b14ef17f-581e-4a91-a154-017116e39a57",
    "name": "other-name",
    "created_at": "2019-12-02T18:58:41.906+0000",
    "updated_at": "2019-12-02T19:01:47.761+0000"
}
⁠PROJECTS

É a unidade de gerenciamento de um projeto. Um projeto pode ter multiplos jobs.

index

lista projetos de um time

GET /teams/x-team/projects
X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE

---
status: 200

[
    {
        "id": "27c84cc3-a267-4f3e-bae8-f02734bfb143",
        "name": "x-project",
        "team_id": "d46d0e86-7e3e-4bfe-93ad-8293148f4d3e",
        "created_at": "2019-12-02T18:47:22.659+0000",
        "updated_at": "2019-12-02T18:47:22.659+0000"
    }
]

show

GET /teams/x-team/projects/x-project
X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE

---
status: 200

{
    "id": "27c84cc3-a267-4f3e-bae8-f02734bfb143",
    "name": "x-project",
    "team_id": "d46d0e86-7e3e-4bfe-93ad-8293148f4d3e",
    "created_at": "2019-12-02T18:47:22.659+0000",
    "updated_at": "2019-12-02T18:47:22.659+0000"
}

create

POST /teams/x-team/projects
X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE

{
	"name": "new-project"
}

---
status: 201

{
    "id": "9ec3f223-17e4-4f06-b995-254b3d39a985",
    "name": "new-project",
    "team_id": "d46d0e86-7e3e-4bfe-93ad-8293148f4d3e",
    "created_at": "2019-12-02T19:05:27.260+0000",
    "updated_at": "2019-12-02T19:05:27.260+0000"
}

update

PATCH /teams/x-team/projects/new-project
X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7ImlkIjoiODVkMzRiOGMtNWE1MC00OGY2LWJkOGMtZTAzNWQxOGEwY2RjIn0sImV4cCI6MTYwNjkzNTA0MH0.uVMaHgE3LugJu74k9pAU8sdSzF65z1RIa62RLNLwjFE

{
	"name": "other-project"
}

---
status: 200

{
    "team_id": "d46d0e86-7e3e-4bfe-93ad-8293148f4d3e",
    "id": "9ec3f223-17e4-4f06-b995-254b3d39a985",
    "name": "other-project",
    "created_at": "2019-12-02T19:05:27.260+0000",
    "updated_at": "2019-12-02T19:06:56.263+0000"
}

Tag summary

Content type

Image

Digest

Size

409.8 MB

Last updated

over 6 years ago

docker pull allanbatista/b2flow-api