Allow an IP Address
Note
A new version is available for this API. The current version will be deprecated soon. See Allow an IP Address using API version 2.
Allowing IP addresses lets users of an account log in only from certain (IPv4 or IPv6) addresses.
Note
Contact Qubole Support to enable allowing IP addresses for an account. Once enabled, users of the account can log in only from an allowed address.
Required Role
To make this API call you must:
Belong to the system-user or system-admin group.
Belong to a group associated with a role that allows editing an account. See Managing Groups and Managing Roles for more information.
Add an Allowed IP Address
- POST /api/v1.2/whitelist_ip
Parameter
Note
Parameters marked in bold below are mandatory. Others are optional and have default values.
Parameter |
Description |
---|---|
ip_cidr |
IP address to be allowed, in IPv4 or IPv6 format. |
description |
Add a description related to the IP address that you have allowed. The description can only contain a maximum of 255 characters. |
Example
Request:
curl -X POST -H "X-AUTH-TOKEN: $X_AUTH_TOKEN" -H "Content-Type:application/json" -H "Accept: application/json" \
-d '{"ip_cidr" : "103.252.24.87"}' "https://api.qubole.com/api/v1.2/whitelist_ip"
Note
The above example uses https://api.qubole.com as the endpoint. Qubole provides other endpoints to access QDS that are described in Supported Qubole Endpoints on Different Cloud Providers.
Response:
{"status":{"status_code":200,"message":"IP whitelisted successfully."}}
List Allowed IP Addresses
- GET /api/v1.2/whitelist_ip
Example
Request:
curl -X GET -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type:application/json" -H "Accept: application/json" \
"https://api.qubole.com/api/v1.2/whitelist_ip"
Note
The above example uses https://api.qubole.com as the endpoint. Qubole provides other endpoints to access QDS that are described in Supported Qubole Endpoints on Different Cloud Providers.
Response:
An array of hashes containing account ID and IP address info; for example:
{"account_whitelisted_ips":[{"account_id":1,"created_at":"2017-01-17T19:06:56Z","id":1,"ip_cidr":"103.252.24.92","updated_at":"2017-01-17T19:06:56Z"},{"account_id":1,"created_at":"2017-01-17T19:07:20Z","id":2,"ip_cidr":"103.252.24.91","updated_at":"2017-01-17T19:07:20Z"}]}
Delete One or More Allowed IP Addresses
- DELETE /api/v1.2/whitelist_ip/<id>
where <id>
is the ID of the allowed IP address. To delete multiple addresses, use
a comma-separated list of IDs.
Example
Request:
curl -X DELETE -H "X-AUTH-TOKEN: $X_AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
"https://api.qubole.com/api/v1.2/whitelist_ip/1,2"
Note
The above example uses https://api.qubole.com as the endpoint. Qubole provides other endpoints to access QDS that are described in Supported Qubole Endpoints on Different Cloud Providers.
Response
{"status":{"status_code":200,"message":"Deleted"}}