Module: Idcf::Ilb::ClientExtensions::Config

Included in:
Idcf::Ilb::Client
Defined in:
lib/idcf/ilb/client_extensions/config.rb

Overview

SDK APIs for config resource

Instance Method Summary collapse

Instance Method Details

#configs(lb_id, headers = {}) ⇒ Array<Resources::Config>

Get an array of existing config objects.

Parameters:

  • lb_id (String)

    ID of loadbalancer

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

    HTTP request headers

Returns:



89
90
91
92
93
# File 'lib/idcf/ilb/client_extensions/config.rb', line 89

def configs(lb_id, headers = {})
  list_configs(lb_id, headers).resources.map do |config|
    Resources::Config.new(self, config)
  end
end

#create_config(lb_id, attributes, headers = {}) ⇒ Response

Create a new loadbalancer config.

Parameters:

  • attributes (Hash)

    request attributes

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

    HTTP request headers

Options Hash (attributes):

  • :frontend_protocol (String) — default: required
  • :port (String) — default: required
  • :servers (String) — default: required
  • :backend_protocol (String) — default: required
  • :sslcert_id (String) — default: optional
  • :sslpolicy_id (String) — default: optional
  • :connection_timeout (String) — default: required
  • :stickiness_policy (String) — default: optional
  • :servers (String) — default: required
  • :algorithm (String) — default: required
  • :healthcheck (String) — default: required
  • :backupserver (String) — default: optional

Returns:



23
24
25
26
27
# File 'lib/idcf/ilb/client_extensions/config.rb', line 23

def create_config(lb_id, attributes, headers = {})
  Validators::Config.validate_attributes!(attributes, :create)
  res = post!("loadbalancers/#{lb_id}/configs", attributes, headers)
  check_job(res.body["job_id"], headers, ["get_config", lb_id])
end

#delete_config(lb_id, id, headers = {}) ⇒ Boolean

Delete a config

Parameters:

  • lb_id (String)

    ID of loadbalancer

  • id (String)

    ID of target config

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

    HTTP request headers

Returns:

  • (Boolean)

    delete success = true



79
80
81
82
# File 'lib/idcf/ilb/client_extensions/config.rb', line 79

def delete_config(lb_id, id, headers = {})
  res = delete!("loadbalancers/#{lb_id}/configs/#{id}", {}, headers)
  check_job(res.body["job_id"], headers)
end

#get_config(lb_id, id, headers = {}) ⇒ Response

Get a config

Parameters:

  • lb_id (String)

    ID of loadbalancer

  • id (String)

    ID of target config

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

    HTTP request headers

Returns:



44
45
46
# File 'lib/idcf/ilb/client_extensions/config.rb', line 44

def get_config(lb_id, id, headers = {})
  get!("loadbalancers/#{lb_id}/configs/#{id}", {}, headers)
end

#list_configs(lb_id, headers = {}) ⇒ Response

Get list of existing configs

Parameters:

  • lb_id (String)

    ID of loadbalancer

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

    HTTP request headers

Returns:



34
35
36
# File 'lib/idcf/ilb/client_extensions/config.rb', line 34

def list_configs(lb_id, headers = {})
  get!("loadbalancers/#{lb_id}/configs", {}, headers)
end

#patch_config(lb_id, id, attributes, headers = {}) ⇒ Response

Patch a config

Parameters:

  • lb_id (String)

    ID of loadbalancer

  • id (String)

    ID of target config

  • attributes (Hash)

    request attributes

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

    HTTP request headers

Options Hash (attributes):

  • :frontend_protocol (String) — default: optional
  • :port (String) — default: optional
  • :servers (String) — default: optional
  • :backend_protocol (String) — default: optional
  • :sslcert_id (String) — default: optional
  • :sslpolicy_id (String) — default: optional
  • :connection_timeout (String) — default: optional
  • :stickiness_policy (String) — default: optional
  • :servers (String) — default: optional
  • :algorithm (String) — default: optional
  • :healthcheck (String) — default: optional
  • :backupserver (String) — default: optional

Returns:



67
68
69
70
71
# File 'lib/idcf/ilb/client_extensions/config.rb', line 67

def patch_config(lb_id, id, attributes, headers = {})
  Validators::Config.validate_attributes!(attributes, :patch)
  res = patch!("loadbalancers/#{lb_id}/configs/#{id}", attributes, headers)
  check_job(res.body["job_id"], headers, ["get_config", lb_id])
end