Esta é uma API de gerenciamento dos clientes OpenVPN Site2Site.
API de listagem de clientes paginados. Ver documentação de paginação.
GET /api/openvpn/clients/site2site
GET /api/openvpn/clients/site2site?cursor=0&size=15&name=client-s2s&ca_id=1&status=valid
Exemplo de requisição
GET /api/openvpn/clients/site2site HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.openvpn.types import GetClientsSite2SitePageRequest
request = GetClientsSite2SitePageRequest(cursor=0, size=15)
pages = sdk.openvpn.get_clients_site2site_pages(request)
const pages = sdk.openvpn.getClientsSite2SitePages();
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},
"clients": [
{
"id": 1,
"ca_id": 1,
"name": "client-s2s",
"email": "client_s2s@client.com.br",
"description": "Empresa XYZ",
"country": "BR",
"province": "Rio de Janeiro",
"city": "Rio de Janeiro",
"organization": "Empresa XYZ",
"sector": "Suporte",
"expired": false,
"revoked": false,
"expiry_date": "2020-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 client in page.clients:
print(client)
# retornar os itens de todas as páginas
for client in pages:
print(client)
[
{
id: 1,
caId: 1,
name: "client-s2s",
email: "client_s2s@client.com.br",
description: "Empresa XYZ",
country: "BR",
province: "Rio de Janeiro",
city: "Rio de Janeiro",
organization: "Empresa XYZ",
sector: "Suporte",
expired: false,
revoked: false,
expiryDate: "2020-10-05T12:20:02Z",
createdAt: "2017-10-05T12:20:02Z",
updatedAt: "2017-11-05T12:20:02Z"
}
];
API de busca de cliente.
GET /api/openvpn/clients/site2site/<id>
Exemplo de requisição
GET /api/openvpn/clients/site2site/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.openvpn.types import GetClientSite2SiteRequest
request = GetClientSite2SiteRequest(id=1)
response = sdk.openvpn.get_client_site2site(request)
const response = await sdk.openvpn.getClientSite2Site({ id: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"ca_id": 1,
"name": "client-s2s",
"email": "client_s2s@client.com.br",
"description": "Empresa XYZ",
"country": "BR",
"province": "Rio de Janeiro",
"city": "Rio de Janeiro",
"organization": "Empresa XYZ",
"sector": "Suporte",
"expired": false,
"revoked": false,
"expiry_date": "2020-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.client
{
id: 1,
caId: 1,
name: "client-s2s",
email: "client_s2s@client.com.br",
description: "Empresa XYZ",
country: "BR",
province: "Rio de Janeiro",
city: "Rio de Janeiro",
organization: "Empresa XYZ",
sector: "Suporte",
expired: false,
revoked: false,
expiryDate: "2020-10-05T12:20:02Z",
createdAt: "2017-10-05T12:20:02Z",
updatedAt: "2017-11-05T12:20:02Z",
}
API de cadastro de cliente Site2Site.
POST /api/openvpn/clients/site2site
Exemplo de requisição
POST /api/openvpn/clients/site2site HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"ca_id": 1,
"name": "client-s2s",
"email": "client_s2s@client.com.br",
"password": "clients2spass",
"description": "Empresa XYZ",
"country": "BR",
"province": "Rio de Janeiro",
"city": "Rio de Janeiro",
"organization": "Empresa XYZ",
"sector": "Suporte",
"expiration": 10,
}
from itflex_sdk.openvpn.types import CreateClientSite2SiteRequest
request = CreateClientSite2SiteRequest(
ca_id=1,
name="client-s2s",
email="client_s2s@client.com.br",
password="clients2spass",
description="Empresa XYZ",
country="BR",
province="Rio de Janeiro",
city="Rio de Janeiro",
organization="Empresa XYZ",
sector="Suporte",
expiration=10
)
response = sdk.openvpn.create_client_site2site(request)
const clientS2S = sdk.openvpn.types.ClientSite2Site();
clientS2S.name = "client-s2s";
clientS2S.email = "client_s2s@client.com.br";
clientS2S.password = "clients2spass";
clientS2S.description = "Empresa XYZ";
clientS2S.country = "BR";
clientS2S.province = "Rio de Janeiro";
clientS2S.city = "Rio de Janeiro";
clientS2S.organization = "Empresa XYZ";
clientS2S.sector = "Suporte";
clientS2S.expiration = 10;
const response = await sdk.openvpn.createClientSite2Site(clientS2S);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"ca_id": 1,
"name": "client-s2s",
"email": "client_s2s@client.com.br",
"description": "Empresa XYZ",
"country": "BR",
"province": "Rio de Janeiro",
"city": "Rio de Janeiro",
"organization": "Empresa XYZ",
"sector": "Suporte",
"expired": false,
"revoked": false,
"expiry_date": "2020-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.client
{
id: 1,
caId: 1,
name: "client-s2s",
email: "client_s2s@client.com.br",
description: "Empresa XYZ",
country: "BR",
province: "Rio de Janeiro",
city: "Rio de Janeiro",
organization: "Empresa XYZ",
sector: "Suporte",
expired: false,
revoked: false,
expiryDate: "2020-10-05T12:20:02Z",
createdAt: "2017-10-05T12:20:02Z",
updatedAt: "2017-20-05T12:20:02Z",
}
API de edição de um modelo de instância existente.
PUT /api/openvpn/clients/site2site/<id>
Exemplo de requisição
PUT /api/openvpn/clients/site2site/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"email": "client_s2s_updated@client.com.br",
"description": "",
}
from itflex_sdk.openvpn.types import UpdateClientSite2SiteRequest
request = UpdateClientSite2SiteRequest(
id=1,
email="client_s2s_updated@client.com.br",
description="",
)
response = sdk.openvpn.update_client_site2site(request)
const clientS2S = {
id: 1,
email: "client_s2s_updated@client.com.br",
description: ""
};
const response = await sdk.openvpn.updateClientSite2Site(clientS2S);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"ca_id": 1,
"name": "client-s2s",
"email": "client_s2s_updated@client.com.br",
"description": "",
"country": "BR",
"province": "Rio de Janeiro",
"city": "Rio de Janeiro",
"organization": "Empresa XYZ",
"sector": "Suporte",
"expired": false,
"revoked": false,
"expiry_date": "2020-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.client
{
id: 1,
caId: 1,
name: "client-s2s",
email: "client_s2s_updated@client.com.br",
description: "",
country: "BR",
province: "Rio de Janeiro",
city: "Rio de Janeiro",
organization: "Empresa XYZ",
expired: false,
revoked: false,
expiryDate: "2020-10-05T12:20:02Z",
createdAt: "2017-10-05T12:20:02Z",
updatedAt: "2017-11-05T12:20:02Z",
}
API de revogação de cliente site2site.
DELETE /api/openvpn/clients/site2site/<id>
Exemplo de requisição
DELETE /api/openvpn/clients/site2site/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.openvpn.types import RevokeClientSite2SiteRequest
request = RevokeClientSite2SiteRequest(id=2)
response = sdk.openvpn.revoke_client_site2site(request)
const response = await sdk.openvpn.revokeClientSite2Site({ id: 2 });
console.log(response);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
return response.success
API de importação de cliente Site2Site.
POST /api/openvpn/clients/site2site/import
Exemplo de requisição
POST /api/openvpn/clients/site2site/import HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"ca_id": 1,
"email": "client_s2s@client.com.br",
"description": "Empresa XYZ",
"key": "<key>",
"cert": "<cert>",
"revoked": true,
"revoked_date": "2018-10-05T12:20:02Z"
}
from itflex_sdk.openvpn.types import ImportClientSite2SiteRequest
request = ImportClientSite2SiteRequest(
ca_id=1,
email="client_s2s@client.com.br",
description="Empresa XYZ",
key="<key>",
cert="<cert>",
revoked=True,
revoked_date="2018-10-05T12:20:02Z"
)
response = sdk.openvpn.import_client_site2site(request)
const clientS2S = sdk.openvpn.types.ImportClientSite2Site();
clientS2S.caId = 1;
clientS2S.email = "client_s2s@client.com.br";
clientS2S.description = "Empresa XYZ";
clientS2S.key = "<key>";
clientS2S.cert = "<cert>";
clientS2S.revoked = true;
clientS2S.revokedDate = "2018-10-05T12:20:02Z";
const response = await sdk.openvpn.importClientSite2Site(clientS2S);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"ca_id": 1,
"name": "client-s2s",
"email": "client_s2s@client.com.br",
"description": "Empresa XYZ",
"country": "BR",
"province": "Rio de Janeiro",
"city": "Rio de Janeiro",
"organization": "Empresa XYZ",
"sector": "Suporte",
"expired": false,
"revoked": false,
"expiry_date": "2020-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.client
{
id: 1,
caId: 1,
name: "client-s2s",
email: "client_s2s@client.com.br",
description: "Empresa XYZ",
country: "BR",
province: "Rio de Janeiro",
city: "Rio de Janeiro",
organization: "Empresa XYZ",
sector: "Suporte",
expired: false,
revoked: false,
expiryDate: "2020-10-05T12:20:02Z",
createdAt: "2017-10-05T12:20:02Z",
updatedAt: "2017-20-05T12:20:02Z",
}
Parâmetros da url
Parâmetro | Tipo | Descrição |
---|---|---|
id | integer | Identificador do cliente |
name | string | Nome do cliente |
ca_id | integer | Identificador da CA |
status | string | Estado do certificado do cliente Valores possíveis: valid : retorna somente os clientes com certificados SSL válidos, ou seja, os clientes com certificados que ainda não expiraram ou não foram revogados expired : retorna somente os clientes com certificados SSL expirados revoked : retorna somente os clientes com certificados SSL revogados Obs: Ao dexar o campo status vazio, a API retorna a listagem de todos os clientes com certificados SSL, ou seja, clientes com certificados válidos, expirados e revogados. |
Requisição
Parâmetro | Tipo | Valor Default | Descrição |
---|---|---|---|
id | integer | Identificador do cliente | |
ca_id | integer requerido |
Identificador da CA | |
name | string requerido único não editável |
Nome do cliente. Caracteres permitidos: A-Z a-z 0-9 - . Tamanho máximo: 30 |
|
description | string opcional |
Descrição do cliente | |
country | string opcional |
País do cliente | |
province | string opcional |
Estado do cliente | |
city | string opcional |
Cidade do cliente | |
organization | string opcional |
Nome da organização do cliente | |
sector | string opcional |
Setor do cliente | |
email requerido |
E-mail do cliente | ||
password | string opcional |
Senha do certificado do cliente | |
expiration | int não editável |
Tempo de validade do certificado SSL da instância OpenVPN em dias Padrão: 3650 Máximo: 7300 |
Resposta
Parâmetro | Tipo | Descrição |
---|---|---|
id | integer | Identificador do Cliente |
ca_id | integer | Identificador da CA |
name | string | Nome do cliente |
description | string | Descrição do cliente |
country | string | País do cliente |
province | string | Estado do cliente |
city | string | Cidade do cliente |
organization | string | Nome da organização do cliente |
sector | string | Setor do cliente |
E-mail do cliente | ||
expiry_date | string | Data de expiração do certificado |
revoked | boolean | Status de revogado do certificado |
expired | boolean | Status de expirado do certificado |
created_at | datetime | Data de criação |
updated_at | datetime | Data de edição |