A Ruby client library for interacting with most facets of the Fastly API.
To install via RubyGems, add the following to your project's Gemfile
:
gem 'fastly', '~> 8.9.0'
Then run bundle install
.
# Load the gem
require 'fastly'
# Authorize the client with a Fastly API token.
Fastly.configure do |config|
# Configure API key authorization: token
config.api_token = 'YOUR API KEY'
end
api_instance = Fastly::AclApi.new
opts = {
service_id: 'SU1Z0isxPaozGVKXdv0eY', # String
version_id: 56, # Integer
name: 'my_acl', # String
}
begin
result = api_instance.create_acl(opts)
p result
rescue Fastly::ApiError => e
puts "Exception when calling AclApi->create_acl: #{e}"
end
Note
The Fastly API requires an API token for most operations.
Set up the API token in the Ruby client by assigning to api_token
of a configuration as shown:
# Authorize the client with a Fastly API token.
Fastly.configure do |config|
# Configure API key authorization: token
config.api_token = 'YOUR API KEY'
end
Alternatively, set the FASTLY_API_TOKEN
environment variable instead of setting api_token
.
The main documentation for the Fastly API can be found on our Developer Hub.
Table of API endpoints
The fastly-ruby API client currently does not support the following endpoints:
/alerts/definitions/{definition_id}
(DELETE, GET, PUT)/alerts/definitions
(GET, POST)/alerts/history
(GET)/dns/configurations/{dns_configuration_id}
(DELETE, GET, PATCH)/dns/configurations
(GET, POST)/domains/{domain_id}
(DELETE, GET, PATCH)/domains
(GET, POST)/notifications/integration-types
(GET)/notifications/integrations/{integration_id}/rotateSigningKey
(POST)/notifications/integrations/{integration_id}/signingKey
(GET)/notifications/integrations/{integration_id}
(DELETE, GET, PATCH)/notifications/integrations
(GET, POST)/notifications/mailinglist-confirmations
(POST)/resources/stores/kv/{store_id}/batch
(PUT)/security/workspaces/{workspace_id}/events/{event_id}
(GET, PATCH)/security/workspaces/{workspace_id}/events
(GET)/security/workspaces/{workspace_id}/redactions/{redaction_id}
(DELETE, GET, PATCH)/security/workspaces/{workspace_id}/redactions
(GET, POST)/security/workspaces/{workspace_id}/requests/{request_id}
(GET)/security/workspaces/{workspace_id}/requests
(GET)/security/workspaces/{workspace_id}/rules/{rule_id}
(DELETE, GET, PATCH)/security/workspaces/{workspace_id}/rules
(GET, POST)/security/workspaces/{workspace_id}/timeseries
(GET)/security/workspaces/{workspace_id}/virtual-patches/{virtual_patch_id}
(GET, PATCH)/security/workspaces/{workspace_id}/virtual-patches
(GET)/security/workspaces/{workspace_id}
(DELETE, GET, PATCH)/security/workspaces
(GET, POST)/tls/activations/{tls_activation_id}
(GET, PATCH)/tls/activations
(GET)/tls/configurations/{tls_configuration_id}
(DELETE, GET, PATCH)/tls/configurations
(GET, POST)/v1/channel/{service_id}/ts/h/limit/{max_entries}
(GET)/v1/channel/{service_id}/ts/h
(GET)/v1/channel/{service_id}/ts/{start_timestamp}
(GET)
If you encounter any non-security-related bug or unexpected behavior, please file an issue using the bug report template.
Please see our SECURITY.md for guidance on reporting security-related issues.
MIT.