Top Level Namespace
Defined Under Namespace
Modules: Fog, Libvirt, VAppStatus, Vmfusion
Classes: AWS, Atmos, BareMetalCloud, Bluebox, Brightbox, Clodo, Cloudstack, DNSMadeEasy, DNSimple, Dreamhost, Dynect, Ecloud, Glesys, GoGrid, Google, HP, Hash, IBM, IPAddr, InternetArchive, Joyent, Linode, Local, Ninefold, OpenStack, Ovirt, Rackspace, RiakCS, Serverlove, StormOnDemand, String, Terremark, TerremarkParser, Vcloud, Voxel, Vsphere, XenServer, Zerigo
Constant Summary
collapse
- CDN =
FIXME: hacks until we can ‘include Fog` in bin
Fog::CDN
- Compute =
Fog::Compute
- DNS =
Fog::DNS
- Storage =
Fog::Storage
Instance Method Summary
collapse
Instance Method Details
8
9
10
11
|
# File 'lib/fog/rackspace/examples/storage/delete_file.rb', line 8
def get_user_input(prompt)
print "#{prompt}: "
gets.chomp
end
|
20
21
22
23
24
25
|
# File 'lib/fog/rackspace/examples/storage/storage_metadata.rb', line 20
def print_metadata(object)
object.metadata.each_pair do |key, value|
puts "\t#{key}: #{value}"
end
puts "\n"
end
|
#rackspace_api_key ⇒ Object
43
44
45
|
# File 'lib/fog/rackspace/examples/storage/delete_file.rb', line 43
def rackspace_api_key
Fog.credentials[:rackspace_api_key] || get_user_input("Enter Rackspace API key")
end
|
#rackspace_username ⇒ Object
37
38
39
|
# File 'lib/fog/rackspace/examples/storage/delete_file.rb', line 37
def rackspace_username
Fog.credentials[:rackspace_username] || get_user_input("Enter Rackspace Username")
end
|
#select_attachment(attachments) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/fog/rackspace/examples/compute_v2/detach_volume.rb', line 25
def select_attachment(attachments)
abort "\nThis server does not contain any volumes. Try running server_attachments.rb\n\n" if attachments.empty?
puts "\nSelect Volume To Detach:\n\n"
attachments.each_with_index do |attachment, i|
puts "\t #{i}. #{attachment.device}"
end
delete_str = get_user_input "\nEnter Volume Number"
attachments[delete_str.to_i]
end
|
#select_directory(directories) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/fog/rackspace/examples/storage/delete_file.rb', line 13
def select_directory(directories)
abort "\nThere are not any directories with files to delete. Try running create_file.rb\n\n" if directories.empty?
puts "\nSelect Directory:\n\n"
directories.each_with_index do |dir, i|
puts "\t #{i}. #{dir.key} [#{dir.count} objects]"
end
delete_str = get_user_input "\nEnter Directory Number"
directories[delete_str.to_i]
end
|
#select_file(files) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/fog/rackspace/examples/storage/delete_file.rb', line 25
def select_file(files)
puts "\nSelect File:\n\n"
files.each_with_index do |file, i|
puts "\t #{i}. #{file.key}"
end
delete_str = get_user_input "\nEnter File Number"
files[delete_str.to_i]
end
|
#select_flavor(flavors, server) ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/fog/rackspace/examples/compute_v2/resize_server.rb', line 13
def select_flavor(flavors, server)
puts "\nSelect New Flavor Size:\n\n"
flavors.each_with_index do |flavor, i|
next if server.flavor_id == flavor.id
puts "\t #{i}. #{flavor.name}"
end
selected_flavor_str = get_user_input "\nEnter Flavor Number"
flavors[selected_flavor_str.to_i]
end
|
#select_image(snapshot_images) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/fog/rackspace/examples/compute_v2/delete_image.rb', line 13
def select_image(snapshot_images)
abort "\nThere are not any images to delete. Try running create_image.rb\n\n" if snapshot_images.empty?
puts "\nSelect Image To Delete:\n\n"
snapshot_images.each_with_index do |image, i|
puts "\t #{i}. #{image.name}"
end
delete_str = get_user_input "\nEnter Image Number"
snapshot_images[delete_str.to_i]
end
|
#select_server(servers) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/fog/rackspace/examples/compute_v2/create_image.rb', line 13
def select_server(servers)
abort "\nThere are not any servers avaliable to image. Try running create_server.rb\n\n" if servers.empty?
puts "\nSelect Server To Image:\n\n"
servers.each_with_index do |server, i|
puts "\t #{i}. #{server.name} [#{server.public_ip_address}]"
end
selected_str = get_user_input "\nEnter Server Number"
servers[selected_str.to_i]
end
|
#select_volume(volumes) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/fog/rackspace/examples/block_storage/delete_volume.rb', line 13
def select_volume(volumes)
abort "\nThere are not any volumes to delete. Try running create_volume.rb\n\n" if volumes.empty?
puts "\nSelect Volume:\n\n"
volumes.each_with_index do |volume, i|
puts "\t #{i}. #{volume.display_name}"
end
selected_str = get_user_input "Enter Volume Type Number"
volumes[selected_str.to_i]
end
|
#select_volume_type(volume_types) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/fog/rackspace/examples/block_storage/create_volume.rb', line 13
def select_volume_type(volume_types)
puts "\nSelect Volume Type:\n\n"
volume_types.each_with_index do |volume_type, i|
puts "\t #{i}. #{volume_type.name}"
end
selected_str = get_user_input "Enter Volume Type Number"
volume_types[selected_str.to_i]
end
|