Class: ThreeScaleToolbox::Commands::ServiceCommand::CreateSubcommand

Inherits:
Cri::CommandRunner
  • Object
show all
Includes:
ThreeScaleToolbox::Command
Defined in:
lib/3scale_toolbox/commands/service_command/create_command.rb

Defined Under Namespace

Classes: CustomPrinter

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

.commandObject



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/create_command.rb', line 17

def self.command
  Cri::Command.define do
    name        'create'
    usage       'create [options] <remote> <service-name>'
    summary     'Create a service'
    description 'Create a service'

    param   :remote
    param   :service_name

    ThreeScaleToolbox::CLI.output_flag(self)
    option :d, :'deployment-mode', "Specify the deployment mode of the service", argument: :required
    option :s, :'system-name', "Specify the system-name of the service", 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 CreateSubcommand
  end
end

Instance Method Details

#runObject



38
39
40
41
# File 'lib/3scale_toolbox/commands/service_command/create_command.rb', line 38

def run
  service = Entities::Service.create(remote: remote, service_params: create_params)
  printer.print_record service.attrs
end