Autoridade Certificadora (CA)

Esta é uma API de gerenciamento de Autoridades Certificadoras(CA).

Listar CAs Paginadas

API de listagem de CAs paginados. Ver documentação de paginação.

GET /api/openvpn/cas

GET /api/openvpn/cas?cursor=0&size=15

Exemplo de requisição

GET /api/openvpn/cas HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.openvpn.types import GetCasPageRequest

request = GetCasPageRequest(cursor=0, size=15)
pages = sdk.openvpn.get_cas_pages(request)
const pages = sdk.openvpn.getCAs();
const response = await pages.next();
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "cursor": {"current": 0, "next": null, "previous": null},
  "cas": [
    {
      "id": 1,
      "name": "empresa01",
      "description": "Empresa XYZ",
      "country": "BR",
      "province": "Rio de Janeiro",
      "city": "Rio de Janeiro",
      "organization": "Empresa XYZ",
      "sector": "TI",
      "email": "empresa01@email.com",
      "expiry_date": "2027-10-05T12:20:02.932000+00:00",
      "created_at": "2017-10-05T12:20:02.932000+00:00",
      "updated_at": "2017-11-05T12:20:02.932000+00:00",
    }
  ],
}
page = pages.next()
page = pages.previous()

# retornar os itens de uma página
for ca in page.cas:
    print(ca)

# retornar os itens de todas as páginas
for ca in pages:
    print(ca)
[
  {
    id: 1,
    name: "empresa01",
    description: "Empresa XYZ",
    country: "BR",
    province: "Rio de Janeiro",
    city: "Rio de Janeiro",
    organization: "Empresa XYZ",
    sector: "TI",
    email: "empresa01@email.com"
    createdAt: "2017-10-05T12:20:02Z",
    updatedAt: "2017-11-05T12:20:02Z",
    expiryDate: "2027-10-05T12:20:02Z"
  }
];

Buscar CA

API de busca de uma CA existente.

GET /api/openvpn/cas/<id>

Exemplo de requisição

GET /api/openvpn/cas/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.openvpn.types import GetCaRequest

request = GetCaRequest(id=1)
response = sdk.openvpn.get_ca(request)
const response = await sdk.openvpn.getCA({ id: 1 });
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 1,
  "name": "empresa01",
  "description": "Empresa XYZ",
  "country": "BR",
  "province": "Rio de Janeiro",
  "city": "Rio de Janeiro",
  "organization": "Empresa XYZ",
  "sector": "TI",
  "email": "empresa01@email.com",
  "expiry_date": "2027-10-05T12:20:02.932000+00:00",
  "created_at": "2017-10-05T12:20:02.932000+00:00",
  "updated_at": "2017-11-05T12:20:02.932000+00:00",
}
if response.success:
    return response.ca
{
  id: 1,
  name: "empresa01",
  description: "Empresa XYZ",
  country: "BR",
  province: "Rio de Janeiro",
  city: "Rio de Janeiro",
  organization: "Empresa XYZ",
  sector: "TI",
  email: "empresa01@email.com"
  createdAt: "2017-10-05T12:20:02Z",
  updatedAt: "2017-11-05T12:20:02Z",
  expiryDate: "2027-10-05T12:20:02Z"
}

Cadastrar CA

API de cadastro de CAs.

POST /api/openvpn/cas

Exemplo de requisição

POST /api/openvpn/cas HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>

{
  "name": "itflex",
  "description": "iTFLEX CA",
  "expiration": 3652,
  "country":"BR",
  "province":"Santa Catarina",
  "city":"Joinville",
  "organization": "itflex",
  "sector":"TI",
  "email":"itflex@email.com",
}
from itflex_sdk.openvpn.types import CreateCaRequest

request = CreateCaRequest(
            name="itflex",
            description="iTFLEX CA",
            expiration=3652,
            country="BR",
            province="Santa Catarina",
            city="Joinville",
            organization="itflex",
            sector="TI",
            email="itflex@email.com",
          )
response = sdk.openvpn.create_ca(request)
const ca = sdk.openvpn.types.CA();
ca.name = "itflex";
ca.description = "iTFLEX CA";
ca.expiration = 3652;
ca.country = "BR",
ca.province = "Santa Catarina",
ca.city = "Joinville",
ca.organization= "itflex",
ca.sector = "TI",
ca.email = "itflex@email.com",

const response = await sdk.auth.createCA(ca);
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 2,
  "name": "itflex",
  "description": "iTFLEX CA",
  "country":"BR",
  "province":"Santa Catarina",
  "city":"Joinville",
  "organization": "itflex",
  "sector":"TI",
  "email":"itflex@email.com",
  "expiry_date": "2027-10-05T12:20:02.932000+00:00",
  "created_at": "2017-10-05T12:20:02.932000+00:00",
  "updated_at": "2017-11-05T12:20:02.932000+00:00",
}
if response.success:
    return response.ca
{
  id: 2,
  name: "itflex",
  description: "iTFLEX CA",
  country: "BR",
  province: "Santa Catarina",
  city: "Joinville",
  organization: "itflex",
  sector: "TI",
  email: "itflex@email.com"
  createdAt: "2017-10-05T12:20:02Z",
  updatedAt: "2017-11-05T12:20:02Z",
  expiryDate: "2027-10-05T12:20:02Z"
}

Editar CA

API de edição de uma CA existente.

PUT /api/openvpn/cas/<id>

Exemplo de requisição

PUT /api/openvpn/cas/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>

{
  "description": "iTFLEX Tecnologia CA",
}
from itflex_sdk.openvpn.types import UpdateCaRequest

request = UpdateCaRequest(
            id=2,
            description="iTFLEX Tecnologia CA",
          )
response = sdk.openvpn.update_ca(request)
const ca = {
  id: 2,
  description: "iTFLEX Tecnologia CA"
};

const response = await sdk.openvpn.updateCA(ca);
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 2,
  "name": "itflex",
  "description": "iTFLEX Tecnologia CA",
  "country":"BR",
  "province":"Santa Catarina",
  "city":"Joinville",
  "organization": "iTFLEX Tecnologia CA",
  "sector":"TI",
  "email":"itflex@email.com",
  "expiry_date": "2027-10-05T12:20:02.932000+00:00",
  "created_at": "2017-10-05T12:20:02.932000+00:00",
  "updated_at": "2017-11-05T12:20:02.932000+00:00",
}
if response.success:
    return response.ca
{
  id: 2,
  name: "itflex",
  description: "iTFLEX Tecnologia CA",
  country: "BR",
  province:"Santa Catarina",
  city:"Joinville",
  organization: "iTFLEX Tecnologia CA",
  sector:"TI",
  email:"itflex@email.com",
  expiryDate: "2027-10-05T12:20:02Z"
  createdAt: "2017-10-05T12:20:02Z",
  updatedAt: "2017-11-05T12:20:02Z",
}

Excluir CA

API de exclusão de uma CA existente.

DELETE /api/openvpn/cas/<id>

Exemplo de requisição

DELETE /api/openvpn/cas/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.openvpn.types import DeleteCaRequest

request = DeleteCaRequest(id=2)
response = sdk.openvpn.delete_ca(request)
const response = await sdk.openvpn.deleteCA({ id: 2 });

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json
return response.success

Importar CA

API de importação de CAs.

POST /api/openvpn/cas/import

Exemplo de requisição

POST /api/openvpn/cas/import HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>

{
  "name": "ca01",
  "cert": "<cert>",
  "key": "<key>",
  "ta_key": "<ta_key>",
}
from itflex_sdk.openvpn.types import ImportCARequest

request = ImportCARequest(
    name="ca01",
    cert="<cert>",
    key="<key>",
    ta_key="<ta_key>",
)
response = sdk.openvpn.import_ca(request)
const ca = sdk.openvpn.types.ImportCA();
ca.name = "ca01";
ca.cert = "<cert>";
ca.key = "<key>";
ca.taKey = "<ta_key>";

const response = await sdk.openvpn.importCA(ca);
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 2,
  "name": "itflex",
  "description": "iTFLEX CA",
  "country":"BR",
  "province":"Santa Catarina",
  "city":"Joinville",
  "organization": "itflex",
  "sector":"TI",
  "email":"itflex@email.com",
  "expiry_date": "2027-10-05T12:20:02.932000+00:00",
  "created_at": "2017-10-05T12:20:02.932000+00:00",
  "updated_at": "2017-11-05T12:20:02.932000+00:00",
}
if response.success:
    return response.payload
{
  id: 2,
  name: "itflex",
  description: "iTFLEX CA",
  country: "BR",
  province: "Santa Catarina",
  city: "Joinville",
  organization: "itflex",
  sector: "TI",
  email: "itflex@email.com"
  createdAt: "2017-10-05T12:20:02Z",
  updatedAt: "2017-11-05T12:20:02Z",
  expiryDate: "2027-10-05T12:20:02Z"
}

Formato dos dados

Parâmetros da url

Parâmetro Tipo
id integer

Requisição

Parâmetro Tipo Valor Dafault Descrição
id integer Identificador da CA
name string requerido Nome da CA
description string opcional Descrição da CA
expiration integer requerido Expiração em dias
country string requerido País
province string requerido Estado
city string requerido Cidade
organization string requerido Nome da organização
sector string requerido Nome do setor
email email requerido E-mail

Resposta

Parâmetro Tipo Descrição
id integer Identificador da CA
name string Nome da CA
description string Descrição da CA
country string País
province string Estado
city string Cidade
organization string Nome da organização
sector string Nome do setor
email email E-mail
expiry_date datetime Data de expiração
created_at datetime Data de criação
updated_at datetime Data de edição