Class: ThreeScaleToolbox::Commands::ServiceCommand::ApplySubcommand
- Inherits:
-
Cri::CommandRunner
- Object
- Cri::CommandRunner
- ThreeScaleToolbox::Commands::ServiceCommand::ApplySubcommand
- Includes:
- ThreeScaleToolbox::Command
- Defined in:
- lib/3scale_toolbox/commands/service_command/apply_command.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ThreeScaleToolbox::Command
#config, #config_file, #exit_with_message, #fetch_required_option, included, #remotes, #threescale_client, #verbose, #verify_ssl
Class Method Details
.command ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/3scale_toolbox/commands/service_command/apply_command.rb', line 17 def self.command Cri::Command.define do name 'apply' usage 'apply <remote> <service-id_or_system-name>' summary 'Update service' description "Update (create if it does not exist) service" param :remote param :service_id_or_system_name ThreeScaleToolbox::CLI.output_flag(self) option :d, :'deployment-mode', "Specify the deployment mode of the service", argument: :required option :n, :name, "Specify the name of the metric", argument: :required option :a, :'authentication-mode', "Specify authentication mode of the service ('1' for API key, '2' for App Id / App Key, 'oauth' for OAuth mode, 'oidc' for OpenID Connect)", argument: :required option nil, :description, "Specify the description of the service", argument: :required option nil, :'support-email', "Specify the support email of the service", argument: :required runner ApplySubcommand end end |
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/3scale_toolbox/commands/service_command/apply_command.rb', line 38 def run service = Entities::Service.find(remote: remote, ref: ref) if service.nil? service = Entities::Service.create(remote: remote, service_params: create_attrs) else service.update(update_attrs) unless update_attrs.empty? end printer.print_record service.attrs end |