Cloudflare.RateLimit (Cloudflare v0.5.0)

Copy Markdown View Source

Rate limits for a zone

Create a rate limit

POST /zones/{zone_id}/rate_limits

Creates a new rate limit for a zone. Refer to the object definition for a list of required attributes.

Responses

200 Create a rate limit response.

Data is at body["result"]

{
  "action": {},
  "bypass": [
    {
      "name": "*string*",
      "value": "*string*"
    }
  ],
  "description": "*string*",
  "disabled": "*boolean*",
  "id": "*string*",
  "match": {},
  "period": "*number*",
  "threshold": "*number*"
}
4XX Create a rate limit response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

List rate limits

GET /zones/{zone_id}/rate_limits

Fetches the rate limits for a zone.

Responses

200 List rate limits response.

Data is at body["result"]

[
  {
    "action": {},
    "bypass": [
      {
        "name": null,
        "value": null
      }
    ],
    "description": "*string*",
    "disabled": "*boolean*",
    "id": "*string*",
    "match": {},
    "period": "*number*",
    "threshold": "*number*"
  }
]
4XX List rate limits response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "result_info": {
    "count": "*number*",
    "page": "*number*",
    "per_page": "*number*",
    "total_count": "*number*"
  },
  "success": "*boolean*"
}

Update a rate limit

PUT /zones/{zone_id}/rate_limits/{rate_limit_id}

Updates an existing rate limit.

Responses

200 Update a rate limit response.

Data is at body["result"]

{
  "action": {},
  "bypass": [
    {
      "name": "*string*",
      "value": "*string*"
    }
  ],
  "description": "*string*",
  "disabled": "*boolean*",
  "id": "*string*",
  "match": {},
  "period": "*number*",
  "threshold": "*number*"
}
4XX Update a rate limit response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Get a rate limit

GET /zones/{zone_id}/rate_limits/{rate_limit_id}

Fetches the details of a rate limit.

Responses

200 Get a rate limit response.

Data is at body["result"]

{
  "action": {},
  "bypass": [
    {
      "name": "*string*",
      "value": "*string*"
    }
  ],
  "description": "*string*",
  "disabled": "*boolean*",
  "id": "*string*",
  "match": {},
  "period": "*number*",
  "threshold": "*number*"
}
4XX Get a rate limit response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Delete a rate limit

DELETE /zones/{zone_id}/rate_limits/{rate_limit_id}

Deletes an existing rate limit.

Responses

200 Delete a rate limit response.

Data is at body["result"]

{
  "id": "*string*"
}
4XX Delete a rate limit response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Summary

Functions

client(opts \\ [])

create(body, opts \\ [])

@spec create(
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) ::
  {:ok, map()} | {:error, term()}

create!(body, opts \\ [])

@spec create!(
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) ::
  map() | no_return()

delete(id, opts \\ [])

@spec delete(id :: term(), opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

delete!(id, opts \\ [])

@spec delete!(id :: term(), opts :: Restlax.Resource.action_options()) ::
  map() | no_return()

index(opts \\ [])

@spec index(opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

index!(opts \\ [])

@spec index!(opts :: Restlax.Resource.action_options()) :: map() | no_return()

path_for(id, opts \\ [])

@spec path_for(term(), [{:action, String.t()}]) :: String.t()

show(id, opts \\ [])

@spec show(id :: term(), opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

show!(id, opts \\ [])

@spec show!(id :: term(), opts :: Restlax.Resource.action_options()) ::
  map() | no_return()

update(id, body, opts \\ [])

@spec update(
  id :: term(),
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) :: {:ok, map()} | {:error, term()}

update!(id, body, opts \\ [])

@spec update!(
  id :: term(),
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) :: map() | no_return()