LOG IN SIGN UP
Documentation

Creating and manipulating Edge ACL entries

Edge ACL entries contain IP addresses that can be used to whitelist or blacklist access to resources. ACL entries are versionless, and any changes will become effective immediately, regardless of version.

Parameters

Edge ACL entries have the following parameters:

Creating an ACL entry

To add an entry to an existing ACL, make the following API call in a terminal application:

curl -H "Fastly-Key: FASTLY_KEY" -X POST https://api.fastly.com/service/<service_id>/acl/<acl_id>/entry -d 'ip=127.0.0.1&subnet=16&negated=1&comment=do not allow'

The response will look like this:

{
    "acl_id": "<acl_id>",
    "comment": "do not allow",
    "created_at": "2016-04-22T19:14:02+00:00",
    "deleted_at": null,
    "id": "<acl_entry_id>",
    "ip": "127.0.0.1",
    "negated": "1",
    "service_id": "<service_id>",
    "subnet": 16,
    "updated_at": "2016-04-22T19:14:02+00:00"
}

Viewing ACL entries

To see information related to a single ACL entry, make the following API call in a terminal application:

curl -H "Fastly-Key: FASTLY_KEY" -H 'Content-Type: application/vnd.api+json' https://api.fastly.com/service/<service_id>/acl/<acl_id>/entry/<acl_entry_id>

The response will look like this:

{
    "acl_id": "<acl_id>",
    "comment": "do not allow",
    "created_at": "2016-04-22T19:18:42+00:00",
    "deleted_at": null,
    "id": "<acl_entry_id>",
    "ip": "127.0.0.5",
    "negated": "1",
    "service_id": "<service_id>",
    "subnet": 16,
    "updated_at": "2016-04-22T19:18:42+00:00"
}

To view a list of all ACL entries attached to a particular ACL, make the following API call in a terminal application:

curl -H "Fastly-Key: FASTLY_KEY" https://api.fastly.com/service/<service_id>/acl/<acl_id>/entries

The response will look like this:

[
    {
        "acl_id": "<acl_id>",
        "comment": "",
        "created_at": "2016-04-22T19:13:03+00:00",
        "deleted_at": null,
        "id": "<acl_entry_1_id>",
        "ip": "127.0.0.1",
        "negated": "0",
        "service_id": "<service_id>",
        "subnet": 16,
        "updated_at": "2016-04-22T19:13:03+00:00"
    },
    {
        "acl_id": "<acl_id>",
        "comment": "",
        "created_at": "2016-04-22T19:14:02+00:00",
        "deleted_at": null,
        "id": "<acl_entry_2_id>",
        "ip": "127.0.0.2",
        "negated": "1",
        "service_id": "<service_id>",
        "subnet": 16,
        "updated_at": "2016-04-22T19:14:02+00:00"
    }
]

Updating ACL entries

There are two ways to update ACL entries: you can update a single ACL entry, or you can update multiple ACL entries at the same time.

Updating a single ACL entry

To update an existing ACL entry, make the following API call in a terminal application:

curl -H "Fastly-Key: FASTLY_KEY" -H "Content-type: application/vnd.api+json" -X PATCH https://api.fastly.com/service/<service_id>/acl/<acl_id>/entry/<acl_entry_id> -d 'ip=127.0.0.2&subnet=32&negated=0&comment=allow'

The response will look like this:

{
    "acl_id": "<acl_id>",
    "comment": "allow",
    "created_at": "2016-04-22T19:18:42+00:00",
    "deleted_at": null,
    "id": "<acl_entry_id>",
    "ip": "127.0.0.2",
    "negated": "0",
    "service_id": "<service_id>",
    "subnet": 32,
    "updated_at": "2016-04-22T19:18:42+00:00"
}

Updating multiple ACL entries

You can also update multiple ACL entries at the same time. Include an entries array of changes in the API call and pass an operation (op) parameter for every change. Possible op values are create, update, and delete.

To update multiple ACL entries at the same time, make the following API call in a terminal application:

curl -H "Fastly-Key: FASTLY_KEY" -H "Content-type: application/json" -X PATCH https://api.fastly.com/service/<service_id>/acl/<acl_id>/entries -d '{"entries":[{"op": "create", "ip": "192.168.0.1","subnet": "8"},{"op": "update", "id": "<acl_entry_id>", "ip": "192.168.0.2", "subnet": "16"},{"op": "delete", "id": "<acl_entry_id>"}]}'

The response will look like this:

{
  "status":"ok"
}

Deleting an ACL entry

To permanently delete an ACL entry, make the following API call in a terminal application:

curl -H "Fastly-Key: FASTLY_KEY" -X DELETE https://api.fastly.com/service/<service_id>/acl/<acl_id>/entry/<acl_entry_id>

The response will look like this:

{
  "status":"ok"
}

Additional resources:


Back to Top