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', '~> 14.0.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}"
endNote
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'
endAlternatively, 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)/domain-management/v1/domains/{domain_id}(DELETE, GET, PATCH)/domain-management/v1/domains(GET, POST)/domains/v1/tools/status(GET)/domains/v1/tools/suggest(GET)/ngwaf/v1/lists/{listId}(DELETE, GET, PATCH)/ngwaf/v1/lists(GET, POST)/ngwaf/v1/signals/{signal_id}(DELETE, GET, PATCH)/ngwaf/v1/signals(GET, POST)/ngwaf/v1/timeseries(GET)/ngwaf/v1/workspaces/{workspaceId}/lists/{listId}(DELETE, GET, PATCH)/ngwaf/v1/workspaces/{workspaceId}/lists(GET, POST)/ngwaf/v1/workspaces/{workspace_id}/alerts/{alert_id}/signing-key(GET, POST)/ngwaf/v1/workspaces/{workspace_id}/alerts/{alert_id}(DELETE, GET, PATCH)/ngwaf/v1/workspaces/{workspace_id}/alerts(GET, POST)/ngwaf/v1/workspaces/{workspace_id}/events/{event_id}(GET, PATCH)/ngwaf/v1/workspaces/{workspace_id}/events(GET)/ngwaf/v1/workspaces/{workspace_id}/redactions/{redaction_id}(DELETE, GET, PATCH)/ngwaf/v1/workspaces/{workspace_id}/redactions(GET, POST)/ngwaf/v1/workspaces/{workspace_id}/requests/{request_id}(GET)/ngwaf/v1/workspaces/{workspace_id}/requests(GET)/ngwaf/v1/workspaces/{workspace_id}/rules/{rule_id}(DELETE, GET, PATCH)/ngwaf/v1/workspaces/{workspace_id}/rules(GET, POST)/ngwaf/v1/workspaces/{workspace_id}/timeseries(GET)/ngwaf/v1/workspaces/{workspace_id}/virtual-patches/{virtual_patch_id}(GET, PATCH)/ngwaf/v1/workspaces/{workspace_id}/virtual-patches(GET)/ngwaf/v1/workspaces/{workspace_id}(DELETE, GET, PATCH)/ngwaf/v1/workspaces(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)/observability/timeseries(GET)/observability/timeseries(GET)/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.