class Fastly::VclApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/fastly/api/vcl_api.rb, line 17
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_custom_vcl(opts = {}) click to toggle source

Create a custom VCL file Upload a VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :content The VCL code to be included. @option opts [Boolean] :main Set to `true` when this is the main VCL, otherwise `false`. @option opts [String] :name The name of this VCL. @return [VclResponse]

# File lib/fastly/api/vcl_api.rb, line 28
def create_custom_vcl(opts = {})
  data, _status_code, _headers = create_custom_vcl_with_http_info(opts)
  data
end
create_custom_vcl_with_http_info(opts = {}) click to toggle source

Create a custom VCL file Upload a VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :content The VCL code to be included. @option opts [Boolean] :main Set to &#x60;true&#x60; when this is the main VCL, otherwise &#x60;false&#x60;. @option opts [String] :name The name of this VCL. @return [Array<(VclResponse, Integer, Hash)>] VclResponse data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 41
def create_custom_vcl_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.create_custom_vcl ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.create_custom_vcl"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.create_custom_vcl"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/vcl'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['content'] = opts[:'content'] if !opts[:'content'].nil?
  form_params['main'] = opts[:'main'] if !opts[:'main'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'VclResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.create_custom_vcl",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#create_custom_vcl\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_custom_vcl(opts = {}) click to toggle source

Delete a custom VCL file Delete the uploaded VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @return [InlineResponse200]

# File lib/fastly/api/vcl_api.rb, line 110
def delete_custom_vcl(opts = {})
  data, _status_code, _headers = delete_custom_vcl_with_http_info(opts)
  data
end
delete_custom_vcl_with_http_info(opts = {}) click to toggle source

Delete a custom VCL file Delete the uploaded VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 121
def delete_custom_vcl_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.delete_custom_vcl ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  vcl_name = opts[:'vcl_name']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.delete_custom_vcl"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.delete_custom_vcl"
  end
  # verify the required parameter 'vcl_name' is set
  if @api_client.config.client_side_validation && vcl_name.nil?
    fail ArgumentError, "Missing the required parameter 'vcl_name' when calling VclApi.delete_custom_vcl"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'vcl_name' + '}', CGI.escape(vcl_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse200'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.delete_custom_vcl",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#delete_custom_vcl\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_custom_vcl(opts = {}) click to toggle source

Get a custom VCL file Get the uploaded VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @option opts [String] :no_content Omit VCL content. (default to ‘0’) @return [VclResponse]

# File lib/fastly/api/vcl_api.rb, line 188
def get_custom_vcl(opts = {})
  data, _status_code, _headers = get_custom_vcl_with_http_info(opts)
  data
end
get_custom_vcl_boilerplate(opts = {}) click to toggle source

Get boilerplate VCL Return boilerplate VCL with the service’s TTL from the [settings](www.fastly.com/documentation/reference/api/vcl-services/settings/). @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @return [String]

# File lib/fastly/api/vcl_api.rb, line 266
def get_custom_vcl_boilerplate(opts = {})
  data, _status_code, _headers = get_custom_vcl_boilerplate_with_http_info(opts)
  data
end
get_custom_vcl_boilerplate_with_http_info(opts = {}) click to toggle source

Get boilerplate VCL Return boilerplate VCL with the service&#39;s TTL from the [settings](www.fastly.com/documentation/reference/api/vcl-services/settings/). @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 276
def get_custom_vcl_boilerplate_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.get_custom_vcl_boilerplate ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.get_custom_vcl_boilerplate"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.get_custom_vcl_boilerplate"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/boilerplate'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'String'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.get_custom_vcl_boilerplate",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#get_custom_vcl_boilerplate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_custom_vcl_generated(opts = {}) click to toggle source

Get the generated VCL for a service Display the generated VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @return [VclResponse]

# File lib/fastly/api/vcl_api.rb, line 336
def get_custom_vcl_generated(opts = {})
  data, _status_code, _headers = get_custom_vcl_generated_with_http_info(opts)
  data
end
get_custom_vcl_generated_highlighted(opts = {}) click to toggle source

Get the generated VCL with syntax highlighting Display the content of generated VCL with HTML syntax highlighting. Include line numbers by sending ‘lineno=true` as a request parameter. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @return [VclSyntaxHighlightingResponse]

# File lib/fastly/api/vcl_api.rb, line 406
def get_custom_vcl_generated_highlighted(opts = {})
  data, _status_code, _headers = get_custom_vcl_generated_highlighted_with_http_info(opts)
  data
end
get_custom_vcl_generated_highlighted_with_http_info(opts = {}) click to toggle source

Get the generated VCL with syntax highlighting Display the content of generated VCL with HTML syntax highlighting. Include line numbers by sending &#x60;lineno&#x3D;true&#x60; as a request parameter. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @return [Array<(VclSyntaxHighlightingResponse, Integer, Hash)>] VclSyntaxHighlightingResponse data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 416
def get_custom_vcl_generated_highlighted_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.get_custom_vcl_generated_highlighted ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.get_custom_vcl_generated_highlighted"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.get_custom_vcl_generated_highlighted"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/generated_vcl/content'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'VclSyntaxHighlightingResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.get_custom_vcl_generated_highlighted",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#get_custom_vcl_generated_highlighted\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_custom_vcl_generated_with_http_info(opts = {}) click to toggle source

Get the generated VCL for a service Display the generated VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @return [Array<(VclResponse, Integer, Hash)>] VclResponse data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 346
def get_custom_vcl_generated_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.get_custom_vcl_generated ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.get_custom_vcl_generated"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.get_custom_vcl_generated"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/generated_vcl'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'VclResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.get_custom_vcl_generated",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#get_custom_vcl_generated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_custom_vcl_highlighted(opts = {}) click to toggle source

Get a custom VCL file with syntax highlighting Get the uploaded VCL for a particular service and version with HTML syntax highlighting. Include line numbers by sending ‘lineno=true` as a request parameter. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @return [VclSyntaxHighlightingResponse]

# File lib/fastly/api/vcl_api.rb, line 477
def get_custom_vcl_highlighted(opts = {})
  data, _status_code, _headers = get_custom_vcl_highlighted_with_http_info(opts)
  data
end
get_custom_vcl_highlighted_with_http_info(opts = {}) click to toggle source

Get a custom VCL file with syntax highlighting Get the uploaded VCL for a particular service and version with HTML syntax highlighting. Include line numbers by sending &#x60;lineno&#x3D;true&#x60; as a request parameter. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @return [Array<(VclSyntaxHighlightingResponse, Integer, Hash)>] VclSyntaxHighlightingResponse data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 488
def get_custom_vcl_highlighted_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.get_custom_vcl_highlighted ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  vcl_name = opts[:'vcl_name']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.get_custom_vcl_highlighted"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.get_custom_vcl_highlighted"
  end
  # verify the required parameter 'vcl_name' is set
  if @api_client.config.client_side_validation && vcl_name.nil?
    fail ArgumentError, "Missing the required parameter 'vcl_name' when calling VclApi.get_custom_vcl_highlighted"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}/content'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'vcl_name' + '}', CGI.escape(vcl_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'VclSyntaxHighlightingResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.get_custom_vcl_highlighted",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#get_custom_vcl_highlighted\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_custom_vcl_raw(opts = {}) click to toggle source

Download a custom VCL file Download the specified VCL. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @return [String]

# File lib/fastly/api/vcl_api.rb, line 554
def get_custom_vcl_raw(opts = {})
  data, _status_code, _headers = get_custom_vcl_raw_with_http_info(opts)
  data
end
get_custom_vcl_raw_with_http_info(opts = {}) click to toggle source

Download a custom VCL file Download the specified VCL. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 565
def get_custom_vcl_raw_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.get_custom_vcl_raw ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  vcl_name = opts[:'vcl_name']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.get_custom_vcl_raw"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.get_custom_vcl_raw"
  end
  # verify the required parameter 'vcl_name' is set
  if @api_client.config.client_side_validation && vcl_name.nil?
    fail ArgumentError, "Missing the required parameter 'vcl_name' when calling VclApi.get_custom_vcl_raw"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}/download'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'vcl_name' + '}', CGI.escape(vcl_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'String'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.get_custom_vcl_raw",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#get_custom_vcl_raw\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_custom_vcl_with_http_info(opts = {}) click to toggle source

Get a custom VCL file Get the uploaded VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @option opts [String] :no_content Omit VCL content. (default to ‘0’) @return [Array<(VclResponse, Integer, Hash)>] VclResponse data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 200
def get_custom_vcl_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.get_custom_vcl ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  vcl_name = opts[:'vcl_name']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.get_custom_vcl"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.get_custom_vcl"
  end
  # verify the required parameter 'vcl_name' is set
  if @api_client.config.client_side_validation && vcl_name.nil?
    fail ArgumentError, "Missing the required parameter 'vcl_name' when calling VclApi.get_custom_vcl"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'vcl_name' + '}', CGI.escape(vcl_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'no_content'] = opts[:'no_content'] if !opts[:'no_content'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'VclResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.get_custom_vcl",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#get_custom_vcl\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
lint_vcl_default(opts = {}) click to toggle source

Lint (validate) VCL using a default set of flags. This endpoint validates the submitted VCL against a default set of enabled flags. Consider using the ‘/service/{service_id}/lint` operation to validate VCL in the context of a specific service. @option opts [InlineObject1] :inline_object1 (required) @return [ValidatorResult]

# File lib/fastly/api/vcl_api.rb, line 629
def lint_vcl_default(opts = {})
  data, _status_code, _headers = lint_vcl_default_with_http_info(opts)
  data
end
lint_vcl_default_with_http_info(opts = {}) click to toggle source

Lint (validate) VCL using a default set of flags. This endpoint validates the submitted VCL against a default set of enabled flags. Consider using the &#x60;/service/{service_id}/lint&#x60; operation to validate VCL in the context of a specific service. @option opts [InlineObject1] :inline_object1 (required) @return [Array<(ValidatorResult, Integer, Hash)>] ValidatorResult data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 638
def lint_vcl_default_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.lint_vcl_default ...'
  end
  # unbox the parameters from the hash
  inline_object1 = opts[:'inline_object1']
  # verify the required parameter 'inline_object1' is set
  if @api_client.config.client_side_validation && inline_object1.nil?
    fail ArgumentError, "Missing the required parameter 'inline_object1' when calling VclApi.lint_vcl_default"
  end
  # resource path
  local_var_path = '/vcl_lint'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(inline_object1)

  # return_type
  return_type = opts[:debug_return_type] || 'ValidatorResult'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.lint_vcl_default",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#lint_vcl_default\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
lint_vcl_for_service(opts = {}) click to toggle source

Lint (validate) VCL using flags set for the service. Services may have flags set by a Fastly employee or by the purchase of products as addons to the service, which modify the way VCL is interpreted by that service. This endpoint validates the submitted VCL in the context of the specified service. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [InlineObject] :inline_object (required) @return [ValidatorResult]

# File lib/fastly/api/vcl_api.rb, line 698
def lint_vcl_for_service(opts = {})
  data, _status_code, _headers = lint_vcl_for_service_with_http_info(opts)
  data
end
lint_vcl_for_service_with_http_info(opts = {}) click to toggle source

Lint (validate) VCL using flags set for the service. Services may have flags set by a Fastly employee or by the purchase of products as addons to the service, which modify the way VCL is interpreted by that service. This endpoint validates the submitted VCL in the context of the specified service. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [InlineObject] :inline_object (required) @return [Array<(ValidatorResult, Integer, Hash)>] ValidatorResult data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 708
def lint_vcl_for_service_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.lint_vcl_for_service ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  inline_object = opts[:'inline_object']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.lint_vcl_for_service"
  end
  # verify the required parameter 'inline_object' is set
  if @api_client.config.client_side_validation && inline_object.nil?
    fail ArgumentError, "Missing the required parameter 'inline_object' when calling VclApi.lint_vcl_for_service"
  end
  # resource path
  local_var_path = '/service/{service_id}/lint'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(inline_object)

  # return_type
  return_type = opts[:debug_return_type] || 'ValidatorResult'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.lint_vcl_for_service",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#lint_vcl_for_service\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_custom_vcl(opts = {}) click to toggle source

List custom VCL files List the uploaded VCLs for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @return [Array<VclResponse>]

# File lib/fastly/api/vcl_api.rb, line 773
def list_custom_vcl(opts = {})
  data, _status_code, _headers = list_custom_vcl_with_http_info(opts)
  data
end
list_custom_vcl_with_http_info(opts = {}) click to toggle source

List custom VCL files List the uploaded VCLs for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @return [Array<(Array<VclResponse>, Integer, Hash)>] Array<VclResponse> data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 783
def list_custom_vcl_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.list_custom_vcl ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.list_custom_vcl"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.list_custom_vcl"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/vcl'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<VclResponse>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.list_custom_vcl",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#list_custom_vcl\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
set_custom_vcl_main(opts = {}) click to toggle source

Set a custom VCL file as main Set the specified VCL as the main. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @return [VclResponse]

# File lib/fastly/api/vcl_api.rb, line 844
def set_custom_vcl_main(opts = {})
  data, _status_code, _headers = set_custom_vcl_main_with_http_info(opts)
  data
end
set_custom_vcl_main_with_http_info(opts = {}) click to toggle source

Set a custom VCL file as main Set the specified VCL as the main. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @return [Array<(VclResponse, Integer, Hash)>] VclResponse data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 855
def set_custom_vcl_main_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.set_custom_vcl_main ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  vcl_name = opts[:'vcl_name']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.set_custom_vcl_main"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.set_custom_vcl_main"
  end
  # verify the required parameter 'vcl_name' is set
  if @api_client.config.client_side_validation && vcl_name.nil?
    fail ArgumentError, "Missing the required parameter 'vcl_name' when calling VclApi.set_custom_vcl_main"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}/main'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'vcl_name' + '}', CGI.escape(vcl_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'VclResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.set_custom_vcl_main",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#set_custom_vcl_main\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_custom_vcl(opts = {}) click to toggle source

Update a custom VCL file Update the uploaded VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @option opts [String] :content The VCL code to be included. @option opts [Boolean] :main Set to &#x60;true&#x60; when this is the main VCL, otherwise &#x60;false&#x60;. @option opts [String] :name The name of this VCL. @return [VclResponse]

# File lib/fastly/api/vcl_api.rb, line 924
def update_custom_vcl(opts = {})
  data, _status_code, _headers = update_custom_vcl_with_http_info(opts)
  data
end
update_custom_vcl_with_http_info(opts = {}) click to toggle source

Update a custom VCL file Update the uploaded VCL for a particular service and version. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [Integer] :version_id Integer identifying a service version. (required) @option opts [String] :vcl_name The name of this VCL. (required) @option opts [String] :content The VCL code to be included. @option opts [Boolean] :main Set to &#x60;true&#x60; when this is the main VCL, otherwise &#x60;false&#x60;. @option opts [String] :name The name of this VCL. @return [Array<(VclResponse, Integer, Hash)>] VclResponse data, response status code and response headers

# File lib/fastly/api/vcl_api.rb, line 938
def update_custom_vcl_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VclApi.update_custom_vcl ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  vcl_name = opts[:'vcl_name']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling VclApi.update_custom_vcl"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VclApi.update_custom_vcl"
  end
  # verify the required parameter 'vcl_name' is set
  if @api_client.config.client_side_validation && vcl_name.nil?
    fail ArgumentError, "Missing the required parameter 'vcl_name' when calling VclApi.update_custom_vcl"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'vcl_name' + '}', CGI.escape(vcl_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['content'] = opts[:'content'] if !opts[:'content'].nil?
  form_params['main'] = opts[:'main'] if !opts[:'main'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'VclResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"VclApi.update_custom_vcl",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VclApi#update_custom_vcl\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end