API Client represents a low level interface for Security API. All API operation can be performed using this.
A low-level client for Security API
from abeja.security import APIClient
api_client = APIClient()
check a ip address
API reference: POST /organizations/<organization_id>/security/cidrs/check
organization_id = "1111111111111"
payload = {
"ip_address": "33.222.111.44"
}
response = api_client.check_ip_address(organization_id, payload=payload)
organization_id (str): organization identifier
ip_address (str): ip address
dict
{
"accessible": true,
"ip_address": "33.222.111.44"
}
Unauthorized: Authentication failed
InternalServerError
create a ip address
API reference: POST /organizations/<organization_id>/security/cidrs
organization_id = "1111111111111"
payload = {
"description": "Example CIDR",
"cidr": "192.168.0.0/24"
}
response = api_client.create_ip_address(organization_id, payload=payload)
organization_id (str): organization identifier
description (str): description
cidr (str): cidr
dict
{
"id": "305",
"description": "Example CIDR",
"cidr": "192.168.0.0/24",
"created_at": "2017-04-27T07:49:30Z",
"updated_at": "2018-02-14T03:14:05Z"
}
Unauthorized: Authentication failed
InternalServerError
delete a ip address
API reference: DELETE /organizations/<organization_id>/security/cidrs/<cidr_id>
response = api_client.delete_ip_address(
organization_id='1111111111111', cidr_id='305')
organization_id (str): organization_id
cidr_id (str): cidr identifier
dict
{
"id": "305",
"description": "Example CIDR",
"cidr": "192.168.0.0/24",
"created_at": "2017-04-27T07:49:30Z",
"updated_at": "2018-02-14T03:14:05Z"
}
NotFound: ip address not found
Unauthorized: Authentication failed
InternalServerError
get a ip address
API reference: GET /organizations/<organization_id>/security/cidrs/<cidr_id>
response = api_client.get_ip_address(organization_id='1111111111111', cidr_id='305')
organization_id (str): organization_id
cidr_id (str): cidr identifier
dict
{
"id": "305",
"description": "Example CIDR",
"cidr": "192.168.0.0/24",
"created_at": "2017-04-27T07:49:30Z",
"updated_at": "2018-02-14T03:14:05Z"
}
NotFound: Ip address not found
Unauthorized: Authentication failed
InternalServerError
Get ip address entries
API reference: GET /organizations/<organization_id>/security/cidrs
response = api_client.get_ip_addresses(organization_id='1111111111111')
organization_id (str): organization_id
dict
{
"organization_id": "1111111111111",
"organization_name": "organization-1178",
"created_at": "2019-02-19T03:01:49Z",
"updated_at": "2019-02-19T03:01:49Z",
"offset": 0,
"limit": 50,
"has_next": false,
"cidrs": [
"192.168.0.0/24"
]
}
Unauthorized: Authentication failed
InternalServerError
update a ip address
API reference: PATCH /organizations/<organization_id>/security/cidrs/<cidr_id>
payload = {
"description": "Example CIDR",
"cidr": "192.168.0.0/24"
}
response = api_client.update_ip_address(organization_id='1111111111111', cidr_id='305',
payload=payload)
organization_id (str): organization_id
cidr_id (str): cidr identifier
description (str): description
cidr (str): cidr
dict
{
"id": "305",
"description": "Example CIDR",
"cidr": "192.168.0.0/24",
"created_at": "2017-04-27T07:49:30Z",
"updated_at": "2018-02-14T03:14:05Z"
}
NotFound: Ip address not found
Unauthorized: Authentication failed
InternalServerError