Sha256: 287e82ae1f60be94393bea0aba3a966326b4e5a9bc44e6ba596e54c2f1a453ba

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

#
# Author:: Alessio Rocchi (<alessio.rocchi@staff.aruba.it>)
# © Copyright ArubaCloud.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#

require 'rubygems'
require 'fog/arubacloud'
require 'securerandom'
require 'optparse'

options = {}
OptionParser.new do |opts|
  opts.banner = 'Usage: get_servers.rb [options]'
  opts.on('-uUSERNAME', '--username=USERNAME', 'ArubaCloud Username') { |n| options[:username] = n}
  opts.on('-pPASSWORD', '--password=PASSWORD', 'ArubaCloud Password') { |p| options[:password] = p}
end.parse!

# Fog.mock!
service = Fog::Compute.new({
                               :provider             => 'ArubaCloud',
                               :arubacloud_username  => options[:username],
                               :arubacloud_password  => options[:password]
                           })

## Generate random string to append to vm name
rnd_string = SecureRandom.hex(2)

# Create a Smart VM
server = service.servers.create({
                                    :name           => "testfog#{rnd_string}",
                                    :vm_type        => 'smart',
                                    :admin_passwd   => 'Prova123',
                                    :cpu            => 1,
                                    :memory         => 1,
                                    :template_id    => '415',
                                    :package_id     => 1
                                })

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-arubacloud-0.0.6 examples/create_smart_server.rb
fog-arubacloud-0.0.5 examples/create_smart_server.rb
fog-arubacloud-0.0.3 lib/fog/arubacloud/examples/create_smart_server.rb