Class: Fastly::BackendApi

Inherits:
Object
  • Object
show all
Defined in:
lib/fastly/api/backend_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BackendApi

Returns a new instance of BackendApi.



17
18
19
# File 'lib/fastly/api/backend_api.rb', line 17

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



15
16
17
# File 'lib/fastly/api/backend_api.rb', line 15

def api_client
  @api_client
end

Instance Method Details

#create_backend(opts = {}) ⇒ BackendResponse

Create a backend Create a backend for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :address (String)

    A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend.

  • :auto_loadbalance (Boolean)

    Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don't have a `request_condition` will be selected based on their `weight`.

  • :between_bytes_timeout (Integer)

    Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`.

  • :client_cert (String)

    Unused.

  • :comment (String)

    A freeform descriptive note.

  • :connect_timeout (Integer)

    Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`.

  • :first_byte_timeout (Integer)

    Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`.

  • :healthcheck (String)

    The name of the healthcheck to use with this backend.

  • :hostname (String)

    The hostname of the backend. May be used as an alternative to `address` to set the backend location.

  • :ipv4 (String)

    IPv4 address of the backend. May be used as an alternative to `address` to set the backend location.

  • :ipv6 (String)

    IPv6 address of the backend. May be used as an alternative to `address` to set the backend location.

  • :keepalive_time (Integer)

    How long in seconds to keep a persistent connection to the backend between requests.

  • :max_conn (Integer)

    Maximum number of concurrent connections this backend will accept.

  • :max_tls_version (String)

    Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.

  • :min_tls_version (String)

    Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.

  • :name (String)

    The name of the backend.

  • :override_host (String)

    If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL.

  • :port (Integer)

    Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request.

  • :request_condition (String)

    Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests.

  • :share_key (String)

    Value that when shared across backends will enable those backends to share the same health check.

  • :shield (String)

    Identifier of the POP to use as a [shield](docs.fastly.com/en/guides/shielding).

  • :ssl_ca_cert (String)

    CA certificate attached to origin.

  • :ssl_cert_hostname (String)

    Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all.

  • :ssl_check_cert (Boolean)

    Be strict on checking SSL certs. (default to true)

  • :ssl_ciphers (String)

    List of [OpenSSL ciphers](www.openssl.org/docs/manmaster/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.

  • :ssl_client_cert (String)

    Client certificate attached to origin.

  • :ssl_client_key (String)

    Client key attached to origin.

  • :ssl_hostname (String)

    Use `ssl_cert_hostname` and `ssl_sni_hostname` to configure certificate validation.

  • :ssl_sni_hostname (String)

    Overrides `ssl_hostname`, but only for SNI in the handshake. Does not affect cert validation at all.

  • :use_ssl (Boolean)

    Whether or not to require TLS for connections to this backend.

  • :weight (Integer)

    Weight used to load balance this backend against others. May be any positive integer. If `auto_loadbalance` is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have `auto_loadbalance` set to true.

Returns:



56
57
58
59
# File 'lib/fastly/api/backend_api.rb', line 56

def create_backend(opts = {})
  data, _status_code, _headers = create_backend_with_http_info(opts)
  data
end

#create_backend_with_http_info(opts = {}) ⇒ Array<(BackendResponse, Integer, Hash)>

Create a backend Create a backend for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :address (String)

    A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend.

  • :auto_loadbalance (Boolean)

    Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don&#39;t have a &#x60;request_condition&#x60; will be selected based on their &#x60;weight&#x60;.

  • :between_bytes_timeout (Integer)

    Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;.

  • :client_cert (String)

    Unused.

  • :comment (String)

    A freeform descriptive note.

  • :connect_timeout (Integer)

    Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic &#x60;503&#x60; response will be presented instead. May be set at runtime using &#x60;bereq.connect_timeout&#x60;.

  • :first_byte_timeout (Integer)

    Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic &#x60;503&#x60; response will be presented instead. May be set at runtime using &#x60;bereq.first_byte_timeout&#x60;.

  • :healthcheck (String)

    The name of the healthcheck to use with this backend.

  • :hostname (String)

    The hostname of the backend. May be used as an alternative to &#x60;address&#x60; to set the backend location.

  • :ipv4 (String)

    IPv4 address of the backend. May be used as an alternative to &#x60;address&#x60; to set the backend location.

  • :ipv6 (String)

    IPv6 address of the backend. May be used as an alternative to &#x60;address&#x60; to set the backend location.

  • :keepalive_time (Integer)

    How long in seconds to keep a persistent connection to the backend between requests.

  • :max_conn (Integer)

    Maximum number of concurrent connections this backend will accept.

  • :max_tls_version (String)

    Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic &#x60;503&#x60; error response will be generated.

  • :min_tls_version (String)

    Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic &#x60;503&#x60; error response will be generated.

  • :name (String)

    The name of the backend.

  • :override_host (String)

    If set, will replace the client-supplied HTTP &#x60;Host&#x60; header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing &#x60;bereq.http.Host&#x60; in VCL.

  • :port (Integer)

    Port on which the backend server is listening for connections from Fastly. Setting &#x60;port&#x60; to 80 or 443 will also set &#x60;use_ssl&#x60; automatically (to false and true respectively), unless explicitly overridden by setting &#x60;use_ssl&#x60; in the same request.

  • :request_condition (String)

    Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any &#x60;auto_loadbalance&#x60; setting. By default, the first backend added to a service is selected for all requests.

  • :share_key (String)

    Value that when shared across backends will enable those backends to share the same health check.

  • :shield (String)

    Identifier of the POP to use as a [shield](docs.fastly.com/en/guides/shielding).

  • :ssl_ca_cert (String)

    CA certificate attached to origin.

  • :ssl_cert_hostname (String)

    Overrides &#x60;ssl_hostname&#x60;, but only for cert verification. Does not affect SNI at all.

  • :ssl_check_cert (Boolean)

    Be strict on checking SSL certs. (default to true)

  • :ssl_ciphers (String)

    List of [OpenSSL ciphers](www.openssl.org/docs/manmaster/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic &#x60;503&#x60; error response will be generated.

  • :ssl_client_cert (String)

    Client certificate attached to origin.

  • :ssl_client_key (String)

    Client key attached to origin.

  • :ssl_hostname (String)

    Use &#x60;ssl_cert_hostname&#x60; and &#x60;ssl_sni_hostname&#x60; to configure certificate validation.

  • :ssl_sni_hostname (String)

    Overrides &#x60;ssl_hostname&#x60;, but only for SNI in the handshake. Does not affect cert validation at all.

  • :use_ssl (Boolean)

    Whether or not to require TLS for connections to this backend.

  • :weight (Integer)

    Weight used to load balance this backend against others. May be any positive integer. If &#x60;auto_loadbalance&#x60; is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have &#x60;auto_loadbalance&#x60; set to true.

Returns:

  • (Array<(BackendResponse, Integer, Hash)>)

    BackendResponse data, response status code and response headers



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/fastly/api/backend_api.rb', line 97

def create_backend_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BackendApi.create_backend ...'
  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 BackendApi.create_backend"
  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 BackendApi.create_backend"
  end
  pattern = Regexp.new(/^[A-Za-z0-9]+$/)
  if @api_client.config.client_side_validation && !opts[:'share_key'].nil? && opts[:'share_key'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"share_key\"]' when calling BackendApi.create_backend, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/backend'.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['address'] = opts[:'address'] if !opts[:'address'].nil?
  form_params['auto_loadbalance'] = opts[:'auto_loadbalance'] if !opts[:'auto_loadbalance'].nil?
  form_params['between_bytes_timeout'] = opts[:'between_bytes_timeout'] if !opts[:'between_bytes_timeout'].nil?
  form_params['client_cert'] = opts[:'client_cert'] if !opts[:'client_cert'].nil?
  form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?
  form_params['connect_timeout'] = opts[:'connect_timeout'] if !opts[:'connect_timeout'].nil?
  form_params['first_byte_timeout'] = opts[:'first_byte_timeout'] if !opts[:'first_byte_timeout'].nil?
  form_params['healthcheck'] = opts[:'healthcheck'] if !opts[:'healthcheck'].nil?
  form_params['hostname'] = opts[:'hostname'] if !opts[:'hostname'].nil?
  form_params['ipv4'] = opts[:'ipv4'] if !opts[:'ipv4'].nil?
  form_params['ipv6'] = opts[:'ipv6'] if !opts[:'ipv6'].nil?
  form_params['keepalive_time'] = opts[:'keepalive_time'] if !opts[:'keepalive_time'].nil?
  form_params['max_conn'] = opts[:'max_conn'] if !opts[:'max_conn'].nil?
  form_params['max_tls_version'] = opts[:'max_tls_version'] if !opts[:'max_tls_version'].nil?
  form_params['min_tls_version'] = opts[:'min_tls_version'] if !opts[:'min_tls_version'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
  form_params['override_host'] = opts[:'override_host'] if !opts[:'override_host'].nil?
  form_params['port'] = opts[:'port'] if !opts[:'port'].nil?
  form_params['request_condition'] = opts[:'request_condition'] if !opts[:'request_condition'].nil?
  form_params['share_key'] = opts[:'share_key'] if !opts[:'share_key'].nil?
  form_params['shield'] = opts[:'shield'] if !opts[:'shield'].nil?
  form_params['ssl_ca_cert'] = opts[:'ssl_ca_cert'] if !opts[:'ssl_ca_cert'].nil?
  form_params['ssl_cert_hostname'] = opts[:'ssl_cert_hostname'] if !opts[:'ssl_cert_hostname'].nil?
  form_params['ssl_check_cert'] = opts[:'ssl_check_cert'] if !opts[:'ssl_check_cert'].nil?
  form_params['ssl_ciphers'] = opts[:'ssl_ciphers'] if !opts[:'ssl_ciphers'].nil?
  form_params['ssl_client_cert'] = opts[:'ssl_client_cert'] if !opts[:'ssl_client_cert'].nil?
  form_params['ssl_client_key'] = opts[:'ssl_client_key'] if !opts[:'ssl_client_key'].nil?
  form_params['ssl_hostname'] = opts[:'ssl_hostname'] if !opts[:'ssl_hostname'].nil?
  form_params['ssl_sni_hostname'] = opts[:'ssl_sni_hostname'] if !opts[:'ssl_sni_hostname'].nil?
  form_params['use_ssl'] = opts[:'use_ssl'] if !opts[:'use_ssl'].nil?
  form_params['weight'] = opts[:'weight'] if !opts[:'weight'].nil?

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

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

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

  new_options = opts.merge(
    :operation => :"BackendApi.create_backend",
    :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: BackendApi#create_backend\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_backend(opts = {}) ⇒ InlineResponse200

Delete a backend Delete the backend for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :backend_name (String)

    The name of the backend. (required)

Returns:



199
200
201
202
# File 'lib/fastly/api/backend_api.rb', line 199

def delete_backend(opts = {})
  data, _status_code, _headers = delete_backend_with_http_info(opts)
  data
end

#delete_backend_with_http_info(opts = {}) ⇒ Array<(InlineResponse200, Integer, Hash)>

Delete a backend Delete the backend for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :backend_name (String)

    The name of the backend. (required)

Returns:

  • (Array<(InlineResponse200, Integer, Hash)>)

    InlineResponse200 data, response status code and response headers



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/fastly/api/backend_api.rb', line 210

def delete_backend_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BackendApi.delete_backend ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  backend_name = opts[:'backend_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 BackendApi.delete_backend"
  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 BackendApi.delete_backend"
  end
  # verify the required parameter 'backend_name' is set
  if @api_client.config.client_side_validation && backend_name.nil?
    fail ArgumentError, "Missing the required parameter 'backend_name' when calling BackendApi.delete_backend"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/backend/{backend_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'backend_name' + '}', CGI.escape(backend_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 => :"BackendApi.delete_backend",
    :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: BackendApi#delete_backend\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_backend(opts = {}) ⇒ BackendResponse

Describe a backend Get the backend for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :backend_name (String)

    The name of the backend. (required)

Returns:



276
277
278
279
# File 'lib/fastly/api/backend_api.rb', line 276

def get_backend(opts = {})
  data, _status_code, _headers = get_backend_with_http_info(opts)
  data
end

#get_backend_with_http_info(opts = {}) ⇒ Array<(BackendResponse, Integer, Hash)>

Describe a backend Get the backend for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :backend_name (String)

    The name of the backend. (required)

Returns:

  • (Array<(BackendResponse, Integer, Hash)>)

    BackendResponse data, response status code and response headers



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/fastly/api/backend_api.rb', line 287

def get_backend_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BackendApi.get_backend ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  backend_name = opts[:'backend_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 BackendApi.get_backend"
  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 BackendApi.get_backend"
  end
  # verify the required parameter 'backend_name' is set
  if @api_client.config.client_side_validation && backend_name.nil?
    fail ArgumentError, "Missing the required parameter 'backend_name' when calling BackendApi.get_backend"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/backend/{backend_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'backend_name' + '}', CGI.escape(backend_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] || 'BackendResponse'

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

  new_options = opts.merge(
    :operation => :"BackendApi.get_backend",
    :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: BackendApi#get_backend\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_backends(opts = {}) ⇒ Array<BackendResponse>

List backends List all backends for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

Returns:



352
353
354
355
# File 'lib/fastly/api/backend_api.rb', line 352

def list_backends(opts = {})
  data, _status_code, _headers = list_backends_with_http_info(opts)
  data
end

#list_backends_with_http_info(opts = {}) ⇒ Array<(Array<BackendResponse>, Integer, Hash)>

List backends List all backends for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

Returns:

  • (Array<(Array<BackendResponse>, Integer, Hash)>)

    Array<BackendResponse> data, response status code and response headers



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/fastly/api/backend_api.rb', line 362

def list_backends_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BackendApi.list_backends ...'
  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 BackendApi.list_backends"
  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 BackendApi.list_backends"
  end
  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/backend'.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<BackendResponse>'

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

  new_options = opts.merge(
    :operation => :"BackendApi.list_backends",
    :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: BackendApi#list_backends\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_backend(opts = {}) ⇒ BackendResponse

Update a backend Update the backend for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :backend_name (String)

    The name of the backend. (required)

  • :address (String)

    A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend.

  • :auto_loadbalance (Boolean)

    Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don&#39;t have a &#x60;request_condition&#x60; will be selected based on their &#x60;weight&#x60;.

  • :between_bytes_timeout (Integer)

    Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;.

  • :client_cert (String)

    Unused.

  • :comment (String)

    A freeform descriptive note.

  • :connect_timeout (Integer)

    Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic &#x60;503&#x60; response will be presented instead. May be set at runtime using &#x60;bereq.connect_timeout&#x60;.

  • :first_byte_timeout (Integer)

    Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic &#x60;503&#x60; response will be presented instead. May be set at runtime using &#x60;bereq.first_byte_timeout&#x60;.

  • :healthcheck (String)

    The name of the healthcheck to use with this backend.

  • :hostname (String)

    The hostname of the backend. May be used as an alternative to &#x60;address&#x60; to set the backend location.

  • :ipv4 (String)

    IPv4 address of the backend. May be used as an alternative to &#x60;address&#x60; to set the backend location.

  • :ipv6 (String)

    IPv6 address of the backend. May be used as an alternative to &#x60;address&#x60; to set the backend location.

  • :keepalive_time (Integer)

    How long in seconds to keep a persistent connection to the backend between requests.

  • :max_conn (Integer)

    Maximum number of concurrent connections this backend will accept.

  • :max_tls_version (String)

    Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic &#x60;503&#x60; error response will be generated.

  • :min_tls_version (String)

    Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic &#x60;503&#x60; error response will be generated.

  • :name (String)

    The name of the backend.

  • :override_host (String)

    If set, will replace the client-supplied HTTP &#x60;Host&#x60; header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing &#x60;bereq.http.Host&#x60; in VCL.

  • :port (Integer)

    Port on which the backend server is listening for connections from Fastly. Setting &#x60;port&#x60; to 80 or 443 will also set &#x60;use_ssl&#x60; automatically (to false and true respectively), unless explicitly overridden by setting &#x60;use_ssl&#x60; in the same request.

  • :request_condition (String)

    Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any &#x60;auto_loadbalance&#x60; setting. By default, the first backend added to a service is selected for all requests.

  • :share_key (String)

    Value that when shared across backends will enable those backends to share the same health check.

  • :shield (String)

    Identifier of the POP to use as a [shield](docs.fastly.com/en/guides/shielding).

  • :ssl_ca_cert (String)

    CA certificate attached to origin.

  • :ssl_cert_hostname (String)

    Overrides &#x60;ssl_hostname&#x60;, but only for cert verification. Does not affect SNI at all.

  • :ssl_check_cert (Boolean)

    Be strict on checking SSL certs. (default to true)

  • :ssl_ciphers (String)

    List of [OpenSSL ciphers](www.openssl.org/docs/manmaster/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic &#x60;503&#x60; error response will be generated.

  • :ssl_client_cert (String)

    Client certificate attached to origin.

  • :ssl_client_key (String)

    Client key attached to origin.

  • :ssl_hostname (String)

    Use &#x60;ssl_cert_hostname&#x60; and &#x60;ssl_sni_hostname&#x60; to configure certificate validation.

  • :ssl_sni_hostname (String)

    Overrides &#x60;ssl_hostname&#x60;, but only for SNI in the handshake. Does not affect cert validation at all.

  • :use_ssl (Boolean)

    Whether or not to require TLS for connections to this backend.

  • :weight (Integer)

    Weight used to load balance this backend against others. May be any positive integer. If &#x60;auto_loadbalance&#x60; is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have &#x60;auto_loadbalance&#x60; set to true.

Returns:



454
455
456
457
# File 'lib/fastly/api/backend_api.rb', line 454

def update_backend(opts = {})
  data, _status_code, _headers = update_backend_with_http_info(opts)
  data
end

#update_backend_with_http_info(opts = {}) ⇒ Array<(BackendResponse, Integer, Hash)>

Update a backend Update the backend for a particular service and version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :service_id (String)

    Alphanumeric string identifying the service. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :backend_name (String)

    The name of the backend. (required)

  • :address (String)

    A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend.

  • :auto_loadbalance (Boolean)

    Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don&#39;t have a &#x60;request_condition&#x60; will be selected based on their &#x60;weight&#x60;.

  • :between_bytes_timeout (Integer)

    Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using &#x60;bereq.between_bytes_timeout&#x60;.

  • :client_cert (String)

    Unused.

  • :comment (String)

    A freeform descriptive note.

  • :connect_timeout (Integer)

    Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic &#x60;503&#x60; response will be presented instead. May be set at runtime using &#x60;bereq.connect_timeout&#x60;.

  • :first_byte_timeout (Integer)

    Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic &#x60;503&#x60; response will be presented instead. May be set at runtime using &#x60;bereq.first_byte_timeout&#x60;.

  • :healthcheck (String)

    The name of the healthcheck to use with this backend.

  • :hostname (String)

    The hostname of the backend. May be used as an alternative to &#x60;address&#x60; to set the backend location.

  • :ipv4 (String)

    IPv4 address of the backend. May be used as an alternative to &#x60;address&#x60; to set the backend location.

  • :ipv6 (String)

    IPv6 address of the backend. May be used as an alternative to &#x60;address&#x60; to set the backend location.

  • :keepalive_time (Integer)

    How long in seconds to keep a persistent connection to the backend between requests.

  • :max_conn (Integer)

    Maximum number of concurrent connections this backend will accept.

  • :max_tls_version (String)

    Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic &#x60;503&#x60; error response will be generated.

  • :min_tls_version (String)

    Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic &#x60;503&#x60; error response will be generated.

  • :name (String)

    The name of the backend.

  • :override_host (String)

    If set, will replace the client-supplied HTTP &#x60;Host&#x60; header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing &#x60;bereq.http.Host&#x60; in VCL.

  • :port (Integer)

    Port on which the backend server is listening for connections from Fastly. Setting &#x60;port&#x60; to 80 or 443 will also set &#x60;use_ssl&#x60; automatically (to false and true respectively), unless explicitly overridden by setting &#x60;use_ssl&#x60; in the same request.

  • :request_condition (String)

    Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any &#x60;auto_loadbalance&#x60; setting. By default, the first backend added to a service is selected for all requests.

  • :share_key (String)

    Value that when shared across backends will enable those backends to share the same health check.

  • :shield (String)

    Identifier of the POP to use as a [shield](docs.fastly.com/en/guides/shielding).

  • :ssl_ca_cert (String)

    CA certificate attached to origin.

  • :ssl_cert_hostname (String)

    Overrides &#x60;ssl_hostname&#x60;, but only for cert verification. Does not affect SNI at all.

  • :ssl_check_cert (Boolean)

    Be strict on checking SSL certs. (default to true)

  • :ssl_ciphers (String)

    List of [OpenSSL ciphers](www.openssl.org/docs/manmaster/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic &#x60;503&#x60; error response will be generated.

  • :ssl_client_cert (String)

    Client certificate attached to origin.

  • :ssl_client_key (String)

    Client key attached to origin.

  • :ssl_hostname (String)

    Use &#x60;ssl_cert_hostname&#x60; and &#x60;ssl_sni_hostname&#x60; to configure certificate validation.

  • :ssl_sni_hostname (String)

    Overrides &#x60;ssl_hostname&#x60;, but only for SNI in the handshake. Does not affect cert validation at all.

  • :use_ssl (Boolean)

    Whether or not to require TLS for connections to this backend.

  • :weight (Integer)

    Weight used to load balance this backend against others. May be any positive integer. If &#x60;auto_loadbalance&#x60; is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have &#x60;auto_loadbalance&#x60; set to true.

Returns:

  • (Array<(BackendResponse, Integer, Hash)>)

    BackendResponse data, response status code and response headers



496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'lib/fastly/api/backend_api.rb', line 496

def update_backend_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BackendApi.update_backend ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  version_id = opts[:'version_id']
  backend_name = opts[:'backend_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 BackendApi.update_backend"
  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 BackendApi.update_backend"
  end
  # verify the required parameter 'backend_name' is set
  if @api_client.config.client_side_validation && backend_name.nil?
    fail ArgumentError, "Missing the required parameter 'backend_name' when calling BackendApi.update_backend"
  end
  pattern = Regexp.new(/^[A-Za-z0-9]+$/)
  if @api_client.config.client_side_validation && !opts[:'share_key'].nil? && opts[:'share_key'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"share_key\"]' when calling BackendApi.update_backend, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/service/{service_id}/version/{version_id}/backend/{backend_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'backend_name' + '}', CGI.escape(backend_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['address'] = opts[:'address'] if !opts[:'address'].nil?
  form_params['auto_loadbalance'] = opts[:'auto_loadbalance'] if !opts[:'auto_loadbalance'].nil?
  form_params['between_bytes_timeout'] = opts[:'between_bytes_timeout'] if !opts[:'between_bytes_timeout'].nil?
  form_params['client_cert'] = opts[:'client_cert'] if !opts[:'client_cert'].nil?
  form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?
  form_params['connect_timeout'] = opts[:'connect_timeout'] if !opts[:'connect_timeout'].nil?
  form_params['first_byte_timeout'] = opts[:'first_byte_timeout'] if !opts[:'first_byte_timeout'].nil?
  form_params['healthcheck'] = opts[:'healthcheck'] if !opts[:'healthcheck'].nil?
  form_params['hostname'] = opts[:'hostname'] if !opts[:'hostname'].nil?
  form_params['ipv4'] = opts[:'ipv4'] if !opts[:'ipv4'].nil?
  form_params['ipv6'] = opts[:'ipv6'] if !opts[:'ipv6'].nil?
  form_params['keepalive_time'] = opts[:'keepalive_time'] if !opts[:'keepalive_time'].nil?
  form_params['max_conn'] = opts[:'max_conn'] if !opts[:'max_conn'].nil?
  form_params['max_tls_version'] = opts[:'max_tls_version'] if !opts[:'max_tls_version'].nil?
  form_params['min_tls_version'] = opts[:'min_tls_version'] if !opts[:'min_tls_version'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
  form_params['override_host'] = opts[:'override_host'] if !opts[:'override_host'].nil?
  form_params['port'] = opts[:'port'] if !opts[:'port'].nil?
  form_params['request_condition'] = opts[:'request_condition'] if !opts[:'request_condition'].nil?
  form_params['share_key'] = opts[:'share_key'] if !opts[:'share_key'].nil?
  form_params['shield'] = opts[:'shield'] if !opts[:'shield'].nil?
  form_params['ssl_ca_cert'] = opts[:'ssl_ca_cert'] if !opts[:'ssl_ca_cert'].nil?
  form_params['ssl_cert_hostname'] = opts[:'ssl_cert_hostname'] if !opts[:'ssl_cert_hostname'].nil?
  form_params['ssl_check_cert'] = opts[:'ssl_check_cert'] if !opts[:'ssl_check_cert'].nil?
  form_params['ssl_ciphers'] = opts[:'ssl_ciphers'] if !opts[:'ssl_ciphers'].nil?
  form_params['ssl_client_cert'] = opts[:'ssl_client_cert'] if !opts[:'ssl_client_cert'].nil?
  form_params['ssl_client_key'] = opts[:'ssl_client_key'] if !opts[:'ssl_client_key'].nil?
  form_params['ssl_hostname'] = opts[:'ssl_hostname'] if !opts[:'ssl_hostname'].nil?
  form_params['ssl_sni_hostname'] = opts[:'ssl_sni_hostname'] if !opts[:'ssl_sni_hostname'].nil?
  form_params['use_ssl'] = opts[:'use_ssl'] if !opts[:'use_ssl'].nil?
  form_params['weight'] = opts[:'weight'] if !opts[:'weight'].nil?

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

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

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

  new_options = opts.merge(
    :operation => :"BackendApi.update_backend",
    :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: BackendApi#update_backend\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end