Skip to content

Latest commit

 

History

History
323 lines (246 loc) · 10.3 KB

SnippetApi.md

File metadata and controls

323 lines (246 loc) · 10.3 KB

Fastly::SnippetApi

require 'fastly'
api_instance = Fastly::SnippetApi.new

Methods

Note

All URIs are relative to https://api.fastly.com

Method HTTP request Description
create_snippet POST /service/{service_id}/version/{version_id}/snippet Create a snippet
delete_snippet DELETE /service/{service_id}/version/{version_id}/snippet/{snippet_name} Delete a snippet
get_snippet GET /service/{service_id}/version/{version_id}/snippet/{snippet_name} Get a versioned snippet
get_snippet_dynamic GET /service/{service_id}/snippet/{snippet_id} Get a dynamic snippet
list_snippets GET /service/{service_id}/version/{version_id}/snippet List snippets
update_snippet PUT /service/{service_id}/version/{version_id}/snippet/{snippet_name} Update a versioned snippet
update_snippet_dynamic PUT /service/{service_id}/snippet/{snippet_id} Update a dynamic snippet

create_snippet()

create_snippet(opts): <SnippetResponsePost> # Create a snippet

Create a snippet for a particular service and version.

Examples

api_instance = Fastly::SnippetApi.new
opts = {
    service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
    version_id: 56, # Integer | Integer identifying a service version.
    name: 'name_example', # String | The name for the snippet.
    type: 'init', # String | The location in generated VCL where the snippet should be placed.
    content: 'content_example', # String | The VCL code that specifies exactly what the snippet does.
    priority: 'priority_example', # String | Priority determines execution order. Lower numbers execute first.
    dynamic: '0', # String | Sets the snippet version.
}

begin
  # Create a snippet
  result = api_instance.create_snippet(opts)
  p result
rescue Fastly::ApiError => e
  puts "Error when calling SnippetApi->create_snippet: #{e}"
end

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Integer Integer identifying a service version.
name String The name for the snippet. [optional]
type String The location in generated VCL where the snippet should be placed. [optional]
content String The VCL code that specifies exactly what the snippet does. [optional]
priority String Priority determines execution order. Lower numbers execute first. [optional][default to '100']
dynamic String Sets the snippet version. [optional]

Return type

SnippetResponsePost

[Back to top] [Back to API list] [Back to README]

delete_snippet()

delete_snippet(opts): <InlineResponse200> # Delete a snippet

Delete a specific snippet for a particular service and version.

Examples

api_instance = Fastly::SnippetApi.new
opts = {
    service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
    version_id: 56, # Integer | Integer identifying a service version.
    snippet_name: 'snippet_name_example', # String | The name for the snippet.
}

begin
  # Delete a snippet
  result = api_instance.delete_snippet(opts)
  p result
rescue Fastly::ApiError => e
  puts "Error when calling SnippetApi->delete_snippet: #{e}"
end

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Integer Integer identifying a service version.
snippet_name String The name for the snippet.

Return type

InlineResponse200

[Back to top] [Back to API list] [Back to README]

get_snippet()

get_snippet(opts): <SnippetResponse> # Get a versioned snippet

Get a single snippet for a particular service and version.

Examples

api_instance = Fastly::SnippetApi.new
opts = {
    service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
    version_id: 56, # Integer | Integer identifying a service version.
    snippet_name: 'snippet_name_example', # String | The name for the snippet.
}

begin
  # Get a versioned snippet
  result = api_instance.get_snippet(opts)
  p result
rescue Fastly::ApiError => e
  puts "Error when calling SnippetApi->get_snippet: #{e}"
end

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Integer Integer identifying a service version.
snippet_name String The name for the snippet.

Return type

SnippetResponse

[Back to top] [Back to API list] [Back to README]

get_snippet_dynamic()

get_snippet_dynamic(opts): <SnippetResponse> # Get a dynamic snippet

Get a single dynamic snippet for a particular service.

Examples

api_instance = Fastly::SnippetApi.new
opts = {
    service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
    snippet_id: 'snippet_id_example', # String | Alphanumeric string identifying a VCL Snippet.
}

begin
  # Get a dynamic snippet
  result = api_instance.get_snippet_dynamic(opts)
  p result
rescue Fastly::ApiError => e
  puts "Error when calling SnippetApi->get_snippet_dynamic: #{e}"
end

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
snippet_id String Alphanumeric string identifying a VCL Snippet.

Return type

SnippetResponse

[Back to top] [Back to API list] [Back to README]

list_snippets()

list_snippets(opts): <Array<SnippetResponse>> # List snippets

List all snippets for a particular service and version.

Examples

api_instance = Fastly::SnippetApi.new
opts = {
    service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
    version_id: 56, # Integer | Integer identifying a service version.
}

begin
  # List snippets
  result = api_instance.list_snippets(opts)
  p result
rescue Fastly::ApiError => e
  puts "Error when calling SnippetApi->list_snippets: #{e}"
end

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Integer Integer identifying a service version.

Return type

Array<SnippetResponse>

[Back to top] [Back to API list] [Back to README]

update_snippet()

update_snippet(opts): <SnippetResponse> # Update a versioned snippet

Update a specific snippet for a particular service and version.

Examples

api_instance = Fastly::SnippetApi.new
opts = {
    service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
    version_id: 56, # Integer | Integer identifying a service version.
    snippet_name: 'snippet_name_example', # String | The name for the snippet.
}

begin
  # Update a versioned snippet
  result = api_instance.update_snippet(opts)
  p result
rescue Fastly::ApiError => e
  puts "Error when calling SnippetApi->update_snippet: #{e}"
end

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Integer Integer identifying a service version.
snippet_name String The name for the snippet.

Return type

SnippetResponse

[Back to top] [Back to API list] [Back to README]

update_snippet_dynamic()

update_snippet_dynamic(opts): <SnippetResponse> # Update a dynamic snippet

Update a dynamic snippet for a particular service.

Examples

api_instance = Fastly::SnippetApi.new
opts = {
    service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
    snippet_id: 'snippet_id_example', # String | Alphanumeric string identifying a VCL Snippet.
    name: 'name_example', # String | The name for the snippet.
    type: 'init', # String | The location in generated VCL where the snippet should be placed.
    content: 'content_example', # String | The VCL code that specifies exactly what the snippet does.
    priority: 'priority_example', # String | Priority determines execution order. Lower numbers execute first.
    dynamic: '0', # String | Sets the snippet version.
}

begin
  # Update a dynamic snippet
  result = api_instance.update_snippet_dynamic(opts)
  p result
rescue Fastly::ApiError => e
  puts "Error when calling SnippetApi->update_snippet_dynamic: #{e}"
end

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
snippet_id String Alphanumeric string identifying a VCL Snippet.
name String The name for the snippet. [optional]
type String The location in generated VCL where the snippet should be placed. [optional]
content String The VCL code that specifies exactly what the snippet does. [optional]
priority String Priority determines execution order. Lower numbers execute first. [optional][default to '100']
dynamic String Sets the snippet version. [optional]

Return type

SnippetResponse

[Back to top] [Back to API list] [Back to README]