API Client

API Client represents a low level interface for Security API. All API operation can be performed using this.

class abeja.security.APIClient(credential: typing.Union[dict, NoneType] = None, timeout: typing.Union[int, NoneType] = None)

A low-level client for Security API

from abeja.security import APIClient

api_client = APIClient()
check_ip_address(organization_id: str, payload: typing.Union[dict, NoneType] = None) → dict

check a ip address

API reference: POST /organizations/<organization_id>/security/cidrs/check

Request Syntax:
organization_id = "1111111111111"

payload = {
    "ip_address": "33.222.111.44"
}
response = api_client.check_ip_address(organization_id, payload=payload)
Params:
  • organization_id (str): organization identifier
  • payload (dict): payload of ip address
    • ip_address (str): ip address
Return type:
dict
Returns:
Response Syntax:
{
    "accessible": true,
    "ip_address": "33.222.111.44"
}
Raises:
  • Unauthorized: Authentication failed
  • InternalServerError
create_ip_address(organization_id: str, payload: typing.Union[dict, NoneType] = None) → dict

create a ip address

API reference: POST /organizations/<organization_id>/security/cidrs

Request Syntax:
organization_id = "1111111111111"

payload = {
    "description": "Example CIDR",
    "cidr": "192.168.0.0/24"
}
response = api_client.create_ip_address(organization_id, payload=payload)
Params:
  • organization_id (str): organization identifier
  • payload (dict): payload of ip address
    • description (str): description
    • cidr (str): cidr
Return type:
dict
Returns:
Response Syntax:
{
    "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"
}
Raises:
  • Unauthorized: Authentication failed
  • InternalServerError
delete_ip_address(organization_id: str, cidr_id: str) → dict

delete a ip address

API reference: DELETE /organizations/<organization_id>/security/cidrs/<cidr_id>

Request syntax:
response = api_client.delete_ip_address(
    organization_id='1111111111111', cidr_id='305')
Params:
  • organization_id (str): organization_id
  • cidr_id (str): cidr identifier
Return type:
dict
Responses:
Response syntax:
{
    "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"
}
Raises:
  • NotFound: ip address not found
  • Unauthorized: Authentication failed
  • InternalServerError
get_ip_address(organization_id: str, cidr_id: str) → dict

get a ip address

API reference: GET /organizations/<organization_id>/security/cidrs/<cidr_id>

Request Syntax:
response = api_client.get_ip_address(organization_id='1111111111111', cidr_id='305')
Params:
  • organization_id (str): organization_id
  • cidr_id (str): cidr identifier
Return type:
dict
Returns:
Response Syntax:
{
    "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"
}
Raises:
  • NotFound: Ip address not found
  • Unauthorized: Authentication failed
  • InternalServerError
get_ip_addresses(organization_id: str) → dict

Get ip address entries

API reference: GET /organizations/<organization_id>/security/cidrs

Request syntax:
response = api_client.get_ip_addresses(organization_id='1111111111111')
Params:
  • organization_id (str): organization_id
Return type:
dict
Returns:
Return syntax:
{
    "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"
    ]
}
Raises:
  • Unauthorized: Authentication failed
  • InternalServerError
update_ip_address(organization_id: str, cidr_id: str, payload: typing.Union[dict, NoneType] = None) → dict

update a ip address

API reference: PATCH /organizations/<organization_id>/security/cidrs/<cidr_id>

Request Syntax:
payload = {
    "description": "Example CIDR",
    "cidr": "192.168.0.0/24"
}
response = api_client.update_ip_address(organization_id='1111111111111', cidr_id='305',
                                        payload=payload)
Params:
  • organization_id (str): organization_id
  • cidr_id (str): cidr identifier
  • payload (dict): payload of ip address
    • description (str): description
    • cidr (str): cidr
Return type:
dict
Returns:
Response Syntax:
{
    "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"
}
Raises:
  • NotFound: Ip address not found
  • Unauthorized: Authentication failed
  • InternalServerError