Class: Idcf::Cli::Service::Ilb::BaseServerForProtocol

Inherits:
Base
  • Object
show all
Defined in:
lib/idcf/cli/service/ilb/base_server_for_protocol.rb

Overview

add/delete

server for protocol

Constant Summary

Constants inherited from Base

Base::ARG_TYPE_OPT, Base::ARG_TYPE_REQ, Base::ARG_TYPE_REST, Base::HELP_FORMAT

Instance Attribute Summary collapse

Attributes inherited from Base

#last_command, #last_command_args

Instance Method Summary collapse

Methods inherited from Base

#between_param?, #cli_error, description, #initialize, make_param_s, #method_option_cnt, #method_rest?, option, reset, valid_params

Methods included from Lib::Include::RecurringCalling

#recurring_calling

Constructor Details

This class inherits a constructor from Idcf::Cli::Service::Base

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



9
10
11
# File 'lib/idcf/cli/service/ilb/base_server_for_protocol.rb', line 9

def api
  @api
end

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/idcf/cli/service/ilb/base_server_for_protocol.rb', line 9

def options
  @options
end

Instance Method Details

#do(api, o, lb_id, protocol, protocol_port, params) ⇒ Object

do

Parameters:

  • api (Idcf::Ilb::Lib::Api)
  • o (Hash)

    options

  • lb_id (String)
  • protocol (Stirng)

    http

  • protocol_port (int)

    80

  • params (Hash)

    ‘0.0.0.0’, port: 80



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/idcf/cli/service/ilb/base_server_for_protocol.rb', line 19

def do(api, o, lb_id, protocol, protocol_port, params)
  @api     = api
  @options = o
  lb       = search_lb(lbs, lb_id)
  config   = search_config(lb['configs'], protocol, protocol_port)

  if config.nil?
    not_param = o[:protocol].nil? ? 'conf_id' : 'protocol'
    cli_error "A target isn't found(#{not_param})"
  end

  set_last_command(lb_id, config, params)
  config['servers']
end