Class: Kontena::Plugin::Azure::Master::CreateCommand
- Inherits:
-
Command
- Object
- Command
- Kontena::Plugin::Azure::Master::CreateCommand
- Includes:
- Cli::Common, Common
- Defined in:
- lib/kontena/plugin/azure/master/create_command.rb
Constant Summary
Constants included from Common
Common::LOCATIONS, Common::SIZES
Instance Method Summary collapse
- #default_location ⇒ Object
- #default_size ⇒ Object
- #execute ⇒ Object
- #provisioner(subscription_id, certificate) ⇒ Kontena::Machine::Azure::MasterProvisioner
Methods included from Common
Instance Method Details
#default_location ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/kontena/plugin/azure/master/create_command.rb', line 47 def default_location prompt.select("Choose location: ") do || locations.each do |l| .choice l end end end |
#default_size ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/kontena/plugin/azure/master/create_command.rb', line 55 def default_size size = prompt.select("Choose virtual machine size: ") do || .default 2 sizes.each do |s| .choice s end .choice 'Other' end if size == 'Other' size = prompt.ask("Virtual machine size? (see https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-sizes#size-tables)") end size end |
#execute ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/kontena/plugin/azure/master/create_command.rb', line 22 def execute require_relative '../../../machine/azure' provisioner = provisioner(subscription_id, certificate) provisioner.run!( name: name, ssh_key: ssh_key, ssl_cert: ssl_cert, size: size, virtual_network: network, subnet: subnet, location: location, version: version, vault_secret: vault_secret || SecureRandom.hex(24), vault_iv: vault_iv || SecureRandom.hex(24), initial_admin_code: SecureRandom.hex(16) ) end |
#provisioner(subscription_id, certificate) ⇒ Kontena::Machine::Azure::MasterProvisioner
43 44 45 |
# File 'lib/kontena/plugin/azure/master/create_command.rb', line 43 def provisioner(subscription_id, certificate) Kontena::Machine::Azure::MasterProvisioner.new subscription_id, certificate end |