Pull zones are bunny.net's CDN distribution points. Each pull zone pulls content from your origin server and caches it across their global edge network.
Uses the main API client created with Bunnyx.new/1.
Usage
client = Bunnyx.new(api_key: "sk-...")
{:ok, zone} = Bunnyx.PullZone.create(client,
name: "my-zone",
origin_url: "https://example.com"
)
{:ok, zone} = Bunnyx.PullZone.get(client, zone.id)
{:ok, page} = Bunnyx.PullZone.list(client)
{:ok, zone} = Bunnyx.PullZone.update(client, zone.id, cache_control_max_age_override: 3600)
{:ok, nil} = Bunnyx.PullZone.delete(client, zone.id)
Summary
Functions
Adds a hostname to the pull zone's allowed referrer list.
Adds an IP address to the pull zone's block list.
Adds a hostname to the pull zone's blocked referrer list.
Uploads a custom SSL certificate for a hostname on a pull zone.
Adds a custom hostname to a pull zone.
Adds or updates an edge rule on a pull zone.
Checks if a pull zone name is available.
Creates a pull zone with the given attributes.
Deletes a pull zone.
Deletes an edge rule from a pull zone.
Fetches a pull zone by ID.
Lists pull zones.
Provisions a free Let's Encrypt certificate for a hostname.
Returns optimizer statistics for a pull zone.
Returns origin shield queue statistics for a pull zone.
Removes a hostname from the pull zone's allowed referrer list.
Removes an IP address from the pull zone's block list.
Removes a hostname from the pull zone's blocked referrer list.
Removes an SSL certificate from a hostname on a pull zone.
Removes a custom hostname from a pull zone.
Resets the token authentication security key for a pull zone.
Returns SafeHop statistics for a pull zone.
Enables or disables an edge rule on a pull zone.
Enables or disables forced SSL for a hostname on a pull zone.
Updates a pull zone.
Updates the SSL private key type for a hostname on a pull zone (0 = ECDSA, 1 = RSA).
Types
@type t() :: %Bunnyx.PullZone{ cache_control_max_age_override: integer() | nil, enabled: boolean() | nil, hostnames: [map()] | nil, id: pos_integer() | nil, ignore_query_strings: boolean() | nil, monthly_bandwidth_limit: integer() | nil, monthly_bandwidth_used: integer() | nil, name: String.t() | nil, origin_url: String.t() | nil, storage_zone_id: integer() | nil, suspended: boolean() | nil, type: integer() | nil }
Functions
@spec add_allowed_referrer(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Adds a hostname to the pull zone's allowed referrer list.
@spec add_blocked_ip(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Adds an IP address to the pull zone's block list.
@spec add_blocked_referrer(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Adds a hostname to the pull zone's blocked referrer list.
@spec add_certificate( Bunnyx.t() | keyword(), pos_integer(), String.t(), String.t(), String.t() ) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Uploads a custom SSL certificate for a hostname on a pull zone.
@spec add_hostname(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Adds a custom hostname to a pull zone.
@spec add_or_update_edge_rule( Bunnyx.t() | keyword(), pos_integer(), Bunnyx.Params.attrs() ) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Adds or updates an edge rule on a pull zone.
Attributes
:action_type— rule action type (integer):action_parameter_1— action parameter 1:action_parameter_2— action parameter 2:action_parameter_3— action parameter 3:triggers— list of trigger maps (PascalCase keys):extra_actions— list of extra action maps (PascalCase keys):trigger_matching_type— 0 = match any, 1 = match all, 2 = match none:description— rule description:enabled— whether the rule is active:guid— rule GUID (required for updates)
@spec check_availability(Bunnyx.t() | keyword(), String.t()) :: {:ok, boolean()} | {:error, Bunnyx.Error.t()}
Checks if a pull zone name is available.
@spec create(Bunnyx.t() | keyword(), Bunnyx.Params.attrs()) :: {:ok, t()} | {:error, Bunnyx.Error.t()}
Creates a pull zone with the given attributes.
@spec delete(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Deletes a pull zone.
@spec delete_edge_rule(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Deletes an edge rule from a pull zone.
@spec get(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, t()} | {:error, Bunnyx.Error.t()}
Fetches a pull zone by ID.
@spec list( Bunnyx.t() | keyword(), keyword() ) :: {:ok, %{ items: [t()], current_page: integer(), total_items: integer(), has_more_items: boolean() }} | {:error, Bunnyx.Error.t()}
Lists pull zones.
Options
:page— page number:per_page— items per page:search— search term
@spec load_free_certificate(Bunnyx.t() | keyword(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Provisions a free Let's Encrypt certificate for a hostname.
@spec optimizer_statistics(Bunnyx.t() | keyword(), pos_integer(), keyword()) :: {:ok, %{ requests_optimized_chart: map(), average_compression_chart: map(), traffic_saved_chart: map(), average_processing_time_chart: map(), total_requests_optimized: number(), total_traffic_saved: number(), average_processing_time: number(), average_compression_ratio: number() }} | {:error, Bunnyx.Error.t()}
Returns optimizer statistics for a pull zone.
Options
:date_from— start date (ISO 8601 string):date_to— end date (ISO 8601 string):hourly— group by hour instead of day
@spec origin_shield_statistics(Bunnyx.t() | keyword(), pos_integer(), keyword()) :: {:ok, %{concurrent_requests_chart: map(), queued_requests_chart: map()}} | {:error, Bunnyx.Error.t()}
Returns origin shield queue statistics for a pull zone.
Options
:date_from— start date (ISO 8601 string):date_to— end date (ISO 8601 string):hourly— group by hour instead of day
@spec remove_allowed_referrer(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Removes a hostname from the pull zone's allowed referrer list.
@spec remove_blocked_ip(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Removes an IP address from the pull zone's block list.
@spec remove_blocked_referrer(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Removes a hostname from the pull zone's blocked referrer list.
@spec remove_certificate(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Removes an SSL certificate from a hostname on a pull zone.
@spec remove_hostname(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Removes a custom hostname from a pull zone.
@spec reset_security_key(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Resets the token authentication security key for a pull zone.
@spec safehop_statistics(Bunnyx.t() | keyword(), pos_integer(), keyword()) :: {:ok, %{ requests_retried_chart: map(), requests_saved_chart: map(), total_requests_retried: number(), total_requests_saved: number() }} | {:error, Bunnyx.Error.t()}
Returns SafeHop statistics for a pull zone.
Options
:date_from— start date (ISO 8601 string):date_to— end date (ISO 8601 string):hourly— group by hour instead of day
@spec set_edge_rule_enabled( Bunnyx.t() | keyword(), pos_integer(), String.t(), boolean() ) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Enables or disables an edge rule on a pull zone.
@spec set_force_ssl(Bunnyx.t() | keyword(), pos_integer(), String.t(), boolean()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Enables or disables forced SSL for a hostname on a pull zone.
@spec update(Bunnyx.t() | keyword(), pos_integer(), Bunnyx.Params.attrs()) :: {:ok, t()} | {:error, Bunnyx.Error.t()}
Updates a pull zone.
@spec update_private_key_type( Bunnyx.t() | keyword(), pos_integer(), String.t(), integer() ) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Updates the SSL private key type for a hostname on a pull zone (0 = ECDSA, 1 = RSA).