Removed all references to fog-cloudstack. Fog-cloudstack can be added back into lib/fog/bin.rb once we have a fog-cloudstack gem.
This commit is contained in:
parent
47b9522db3
commit
d27d9c5e19
3
Rakefile
3
Rakefile
|
@ -73,9 +73,6 @@ namespace :test do
|
|||
task :openvz do
|
||||
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/openvz")
|
||||
end
|
||||
task :cloudstack do
|
||||
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/cloudstack")
|
||||
end
|
||||
task :vcloud_director do
|
||||
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/vcloud_director")
|
||||
end
|
||||
|
|
|
@ -22,7 +22,6 @@ require 'fog/core/deprecated_connection_accessors'
|
|||
require 'fog/atmos'
|
||||
require 'fog/aws'
|
||||
require 'fog/brightbox'
|
||||
require 'fog/cloudstack'
|
||||
require 'fog/clodo'
|
||||
require 'fog/digitalocean'
|
||||
require 'fog/dnsimple'
|
||||
|
|
|
@ -54,7 +54,6 @@ end
|
|||
require 'fog/bin/atmos'
|
||||
require 'fog/bin/aws'
|
||||
require 'fog/bin/brightbox'
|
||||
require 'fog/bin/cloudstack'
|
||||
require 'fog/bin/clodo'
|
||||
require 'fog/bin/digitalocean'
|
||||
require 'fog/bin/dnsimple'
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
class Cloudstack < Fog::Bin
|
||||
class << self
|
||||
def class_for(key)
|
||||
case key
|
||||
when :compute
|
||||
Fog::Compute::Cloudstack
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{key}"
|
||||
end
|
||||
end
|
||||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Compute.new(:provider => 'Cloudstack')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
||||
def services
|
||||
Fog::Cloudstack.services
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
require 'fog/cloudstack/compute'
|
|
@ -1,996 +0,0 @@
|
|||
require 'fog/cloudstack/core'
|
||||
require 'digest/md5'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack < Fog::Service
|
||||
|
||||
class BadRequest < Fog::Compute::Cloudstack::Error; end
|
||||
class Unauthorized < Fog::Compute::Cloudstack::Error; end
|
||||
|
||||
requires :cloudstack_host
|
||||
|
||||
recognizes :cloudstack_api_key, :cloudstack_secret_access_key, :cloudstack_session_key, :cloudstack_session_id,
|
||||
:cloudstack_port, :cloudstack_path, :cloudstack_scheme, :cloudstack_persistent, :cloudstack_project_id
|
||||
|
||||
model_path 'fog/cloudstack/models/compute'
|
||||
request_path 'fog/cloudstack/requests/compute'
|
||||
|
||||
model :address
|
||||
model :disk_offering
|
||||
collection :disk_offerings
|
||||
model :egress_firewall_rule
|
||||
collection :egress_firewall_rules
|
||||
model :firewall_rule
|
||||
collection :firewall_rules
|
||||
model :flavor
|
||||
collection :flavors
|
||||
model :image
|
||||
collection :images
|
||||
model :job
|
||||
collection :jobs
|
||||
model :network
|
||||
collection :networks
|
||||
model :network_offering
|
||||
collection :network_offerings
|
||||
model :public_ip_address
|
||||
collection :public_ip_addresses
|
||||
model :port_forwarding_rule
|
||||
collection :port_forwarding_rules
|
||||
model :project
|
||||
collection :projects
|
||||
model :security_group
|
||||
collection :security_groups
|
||||
model :security_group_rule
|
||||
collection :security_group_rules
|
||||
model :server
|
||||
collection :servers
|
||||
model :volume
|
||||
collection :volumes
|
||||
model :snapshot
|
||||
collection :snapshots
|
||||
model :zone
|
||||
collection :zones
|
||||
|
||||
request :activate_project
|
||||
request :add_account_to_project
|
||||
request :add_baremetal_dhcp
|
||||
request :add_baremetal_host
|
||||
request :add_baremetal_pxe_kick_start_server
|
||||
request :add_baremetal_pxe_ping_server
|
||||
request :add_big_switch_vns_device
|
||||
request :add_cisco_asa1000v_resource
|
||||
request :add_cisco_vnmc_resource
|
||||
request :add_cluster
|
||||
request :add_external_firewall
|
||||
request :add_external_load_balancer
|
||||
request :add_f5_load_balancer
|
||||
request :add_guest_os
|
||||
request :add_guest_os_mapping
|
||||
request :add_host
|
||||
request :add_image_store
|
||||
request :add_ip_to_nic
|
||||
request :add_ldap_configuration
|
||||
request :add_netscaler_load_balancer
|
||||
request :add_network_device
|
||||
request :add_network_service_provider
|
||||
request :add_nic_to_virtual_machine
|
||||
request :add_nicira_nvp_device
|
||||
request :add_open_daylight_controller
|
||||
request :add_palo_alto_firewall
|
||||
request :add_region
|
||||
request :add_resource_detail
|
||||
request :add_s3
|
||||
request :add_secondary_storage
|
||||
request :add_srx_firewall
|
||||
request :add_stratosphere_ssp
|
||||
request :add_swift
|
||||
request :add_traffic_monitor
|
||||
request :add_traffic_type
|
||||
request :add_ucs_manager
|
||||
request :add_vmware_dc
|
||||
request :add_vpn_user
|
||||
request :archive_alerts
|
||||
request :archive_events
|
||||
request :assign_cert_to_load_balancer
|
||||
request :assign_to_global_load_balancer_rule
|
||||
request :assign_to_load_balancer_rule
|
||||
request :assign_virtual_machine
|
||||
request :associate_ip_address
|
||||
request :associate_ucs_profile_to_blade
|
||||
request :attach_iso
|
||||
request :attach_volume
|
||||
request :authorize_security_group_egress
|
||||
request :authorize_security_group_ingress
|
||||
request :cancel_host_maintenance
|
||||
request :cancel_storage_maintenance
|
||||
request :change_service_for_router
|
||||
request :change_service_for_system_vm
|
||||
request :change_service_for_virtual_machine
|
||||
request :clean_vmreservations
|
||||
request :configure_f5_load_balancer
|
||||
request :configure_internal_load_balancer_element
|
||||
request :configure_netscaler_load_balancer
|
||||
request :configure_ovs_element
|
||||
request :configure_palo_alto_firewall
|
||||
request :configure_srx_firewall
|
||||
request :configure_virtual_router_element
|
||||
request :copy_iso
|
||||
request :copy_template
|
||||
request :create_account
|
||||
request :create_affinity_group
|
||||
request :create_auto_scale_policy
|
||||
request :create_auto_scale_vm_group
|
||||
request :create_auto_scale_vm_profile
|
||||
request :create_condition
|
||||
request :create_counter
|
||||
request :create_disk_offering
|
||||
request :create_domain
|
||||
request :create_egress_firewall_rule
|
||||
request :create_firewall_rule
|
||||
request :create_global_load_balancer_rule
|
||||
request :create_instance_group
|
||||
request :create_internal_load_balancer_element
|
||||
request :create_ip_forwarding_rule
|
||||
request :create_lb_health_check_policy
|
||||
request :create_lb_stickiness_policy
|
||||
request :create_load_balancer
|
||||
request :create_load_balancer_rule
|
||||
request :create_network
|
||||
request :create_network_acl
|
||||
request :create_network_acl_list
|
||||
request :create_network_offering
|
||||
request :create_physical_network
|
||||
request :create_pod
|
||||
request :create_port_forwarding_rule
|
||||
request :create_portable_ip_range
|
||||
request :create_private_gateway
|
||||
request :create_project
|
||||
request :create_remote_access_vpn
|
||||
request :create_secondary_staging_store
|
||||
request :create_security_group
|
||||
request :create_service_instance
|
||||
request :create_service_offering
|
||||
request :create_snapshot
|
||||
request :create_snapshot_policy
|
||||
request :create_ssh_key_pair
|
||||
request :create_static_route
|
||||
request :create_storage_network_ip_range
|
||||
request :create_storage_pool
|
||||
request :create_tags
|
||||
request :create_template
|
||||
request :create_user
|
||||
request :create_virtual_router_element
|
||||
request :create_vlan_ip_range
|
||||
request :create_vm_snapshot
|
||||
request :create_volume
|
||||
request :create_vpc
|
||||
request :create_vpcoffering
|
||||
request :create_vpn_connection
|
||||
request :create_vpn_customer_gateway
|
||||
request :create_vpn_gateway
|
||||
request :create_zone
|
||||
request :dedicate_cluster
|
||||
request :dedicate_guest_vlan_range
|
||||
request :dedicate_host
|
||||
request :dedicate_pod
|
||||
request :dedicate_public_ip_range
|
||||
request :dedicate_zone
|
||||
request :delete_account
|
||||
request :delete_account_from_project
|
||||
request :delete_affinity_group
|
||||
request :delete_alerts
|
||||
request :delete_auto_scale_policy
|
||||
request :delete_auto_scale_vm_group
|
||||
request :delete_auto_scale_vm_profile
|
||||
request :delete_big_switch_vns_device
|
||||
request :delete_cisco_asa1000v_resource
|
||||
request :delete_cisco_nexus_vsm
|
||||
request :delete_cisco_vnmc_resource
|
||||
request :delete_cluster
|
||||
request :delete_condition
|
||||
request :delete_counter
|
||||
request :delete_disk_offering
|
||||
request :delete_domain
|
||||
request :delete_egress_firewall_rule
|
||||
request :delete_events
|
||||
request :delete_external_firewall
|
||||
request :delete_external_load_balancer
|
||||
request :delete_f5_load_balancer
|
||||
request :delete_firewall_rule
|
||||
request :delete_global_load_balancer_rule
|
||||
request :delete_host
|
||||
request :delete_image_store
|
||||
request :delete_instance_group
|
||||
request :delete_ip_forwarding_rule
|
||||
request :delete_iso
|
||||
request :delete_lb_health_check_policy
|
||||
request :delete_lb_stickiness_policy
|
||||
request :delete_ldap_configuration
|
||||
request :delete_load_balancer
|
||||
request :delete_load_balancer_rule
|
||||
request :delete_netscaler_load_balancer
|
||||
request :delete_network
|
||||
request :delete_network_acl
|
||||
request :delete_network_acl_list
|
||||
request :delete_network_device
|
||||
request :delete_network_offering
|
||||
request :delete_network_service_provider
|
||||
request :delete_nicira_nvp_device
|
||||
request :delete_open_daylight_controller
|
||||
request :delete_palo_alto_firewall
|
||||
request :delete_physical_network
|
||||
request :delete_pod
|
||||
request :delete_port_forwarding_rule
|
||||
request :delete_portable_ip_range
|
||||
request :delete_private_gateway
|
||||
request :delete_project
|
||||
request :delete_project_invitation
|
||||
request :delete_remote_access_vpn
|
||||
request :delete_secondary_staging_store
|
||||
request :delete_security_group
|
||||
request :delete_service_offering
|
||||
request :delete_snapshot
|
||||
request :delete_snapshot_policies
|
||||
request :delete_srx_firewall
|
||||
request :delete_ssh_key_pair
|
||||
request :delete_ssl_cert
|
||||
request :delete_static_route
|
||||
request :delete_storage_network_ip_range
|
||||
request :delete_storage_pool
|
||||
request :delete_tags
|
||||
request :delete_template
|
||||
request :delete_traffic_monitor
|
||||
request :delete_traffic_type
|
||||
request :delete_user
|
||||
request :delete_vlan_ip_range
|
||||
request :delete_vm_snapshot
|
||||
request :delete_volume
|
||||
request :delete_vpc
|
||||
request :delete_vpcoffering
|
||||
request :delete_vpn_connection
|
||||
request :delete_vpn_customer_gateway
|
||||
request :delete_vpn_gateway
|
||||
request :delete_zone
|
||||
request :deploy_virtual_machine
|
||||
request :destroy_router
|
||||
request :destroy_system_vm
|
||||
request :destroy_virtual_machine
|
||||
request :detach_iso
|
||||
request :detach_volume
|
||||
request :disable_account
|
||||
request :disable_auto_scale_vm_group
|
||||
request :disable_cisco_nexus_vsm
|
||||
request :disable_static_nat
|
||||
request :disable_user
|
||||
request :disassociate_ip_address
|
||||
request :enable_account
|
||||
request :enable_auto_scale_vm_group
|
||||
request :enable_cisco_nexus_vsm
|
||||
request :enable_static_nat
|
||||
request :enable_storage_maintenance
|
||||
request :enable_user
|
||||
request :expunge_virtual_machine
|
||||
request :extract_iso
|
||||
request :extract_template
|
||||
request :extract_volume
|
||||
request :find_hosts_for_migration
|
||||
request :find_storage_pools_for_migration
|
||||
request :generate_alert
|
||||
request :generate_usage_records
|
||||
request :get_api_limit
|
||||
request :get_cloud_identifier
|
||||
request :get_user
|
||||
request :get_virtual_machine_user_data
|
||||
request :get_vm_password
|
||||
request :import_ldap_users
|
||||
request :ldap_create_account
|
||||
request :list_accounts
|
||||
request :list_affinity_group_types
|
||||
request :list_affinity_groups
|
||||
request :list_alerts
|
||||
request :list_apis
|
||||
request :list_async_jobs
|
||||
request :list_auto_scale_policies
|
||||
request :list_auto_scale_vm_groups
|
||||
request :list_auto_scale_vm_profiles
|
||||
request :list_baremetal_dhcp
|
||||
request :list_baremetal_pxe_servers
|
||||
request :list_big_switch_vns_devices
|
||||
request :list_capabilities
|
||||
request :list_capacity
|
||||
request :list_cisco_asa1000v_resources
|
||||
request :list_cisco_nexus_vsms
|
||||
request :list_cisco_vnmc_resources
|
||||
request :list_clusters
|
||||
request :list_conditions
|
||||
request :list_configurations
|
||||
request :list_counters
|
||||
request :list_dedicated_clusters
|
||||
request :list_dedicated_guest_vlan_ranges
|
||||
request :list_dedicated_hosts
|
||||
request :list_dedicated_pods
|
||||
request :list_dedicated_zones
|
||||
request :list_deployment_planners
|
||||
request :list_disk_offerings
|
||||
request :list_domain_children
|
||||
request :list_domains
|
||||
request :list_egress_firewall_rules
|
||||
request :list_event_types
|
||||
request :list_events
|
||||
request :list_external_firewalls
|
||||
request :list_external_load_balancers
|
||||
request :list_f5_load_balancer_networks
|
||||
request :list_f5_load_balancers
|
||||
request :list_firewall_rules
|
||||
request :list_global_load_balancer_rules
|
||||
request :list_guest_os_mapping
|
||||
request :list_hosts
|
||||
request :list_hypervisor_capabilities
|
||||
request :list_hypervisors
|
||||
request :list_image_stores
|
||||
request :list_instance_groups
|
||||
request :list_internal_load_balancer_elements
|
||||
request :list_internal_load_balancer_vms
|
||||
request :list_ip_forwarding_rules
|
||||
request :list_iso_permissions
|
||||
request :list_isos
|
||||
request :list_lb_health_check_policies
|
||||
request :list_lb_stickiness_policies
|
||||
request :list_ldap_configurations
|
||||
request :list_ldap_users
|
||||
request :list_load_balancer_rule_instances
|
||||
request :list_load_balancer_rules
|
||||
request :list_load_balancers
|
||||
request :list_netscaler_load_balancer_networks
|
||||
request :list_netscaler_load_balancers
|
||||
request :list_network_acl_lists
|
||||
request :list_network_acls
|
||||
request :list_network_device
|
||||
request :list_network_isolation_methods
|
||||
request :list_network_offerings
|
||||
request :list_network_service_providers
|
||||
request :list_networks
|
||||
request :list_nicira_nvp_device_networks
|
||||
request :list_nicira_nvp_devices
|
||||
request :list_nics
|
||||
request :list_open_daylight_controllers
|
||||
request :list_os_categories
|
||||
request :list_os_types
|
||||
request :list_ovs_elements
|
||||
request :list_palo_alto_firewall_networks
|
||||
request :list_palo_alto_firewalls
|
||||
request :list_physical_networks
|
||||
request :list_pods
|
||||
request :list_port_forwarding_rules
|
||||
request :list_portable_ip_ranges
|
||||
request :list_private_gateways
|
||||
request :list_project_accounts
|
||||
request :list_project_invitations
|
||||
request :list_projects
|
||||
request :list_public_ip_addresses
|
||||
request :list_regions
|
||||
request :list_remote_access_vpns
|
||||
request :list_resource_details
|
||||
request :list_resource_limits
|
||||
request :list_routers
|
||||
request :list_s3s
|
||||
request :list_secondary_staging_stores
|
||||
request :list_security_groups
|
||||
request :list_service_offerings
|
||||
request :list_snapshot_policies
|
||||
request :list_snapshots
|
||||
request :list_srx_firewall_networks
|
||||
request :list_srx_firewalls
|
||||
request :list_ssh_key_pairs
|
||||
request :list_ssl_certs
|
||||
request :list_static_routes
|
||||
request :list_storage_network_ip_range
|
||||
request :list_storage_pools
|
||||
request :list_storage_providers
|
||||
request :list_supported_network_services
|
||||
request :list_swifts
|
||||
request :list_system_vms
|
||||
request :list_tags
|
||||
request :list_template_permissions
|
||||
request :list_templates
|
||||
request :list_traffic_monitors
|
||||
request :list_traffic_type_implementors
|
||||
request :list_traffic_types
|
||||
request :list_ucs_blades
|
||||
request :list_ucs_managers
|
||||
request :list_ucs_profiles
|
||||
request :list_usage_records
|
||||
request :list_usage_types
|
||||
request :list_users
|
||||
request :list_virtual_machines
|
||||
request :list_virtual_router_elements
|
||||
request :list_vlan_ip_ranges
|
||||
request :list_vm_snapshot
|
||||
request :list_vmware_dcs
|
||||
request :list_volumes
|
||||
request :list_vpc_offerings
|
||||
request :list_vpcs
|
||||
request :list_vpn_connections
|
||||
request :list_vpn_customer_gateways
|
||||
request :list_vpn_gateways
|
||||
request :list_vpn_users
|
||||
request :list_zones
|
||||
request :lock_account
|
||||
request :lock_user
|
||||
request :mark_default_zone_for_account
|
||||
request :migrate_system_vm
|
||||
request :migrate_virtual_machine
|
||||
request :migrate_virtual_machine_with_volume
|
||||
request :migrate_volume
|
||||
request :prepare_host_for_maintenance
|
||||
request :prepare_template
|
||||
request :query_async_job_result
|
||||
request :reboot_router
|
||||
request :reboot_system_vm
|
||||
request :reboot_virtual_machine
|
||||
request :reconnect_host
|
||||
request :recover_virtual_machine
|
||||
request :register_iso
|
||||
request :register_ssh_key_pair
|
||||
request :register_template
|
||||
request :register_user_keys
|
||||
request :release_dedicated_cluster
|
||||
request :release_dedicated_guest_vlan_range
|
||||
request :release_dedicated_host
|
||||
request :release_dedicated_pod
|
||||
request :release_dedicated_zone
|
||||
request :release_host_reservation
|
||||
request :release_public_ip_range
|
||||
request :remove_cert_from_load_balancer
|
||||
request :remove_from_global_load_balancer_rule
|
||||
request :remove_from_load_balancer_rule
|
||||
request :remove_guest_os
|
||||
request :remove_guest_os_mapping
|
||||
request :remove_ip_from_nic
|
||||
request :remove_nic_from_virtual_machine
|
||||
request :remove_region
|
||||
request :remove_resource_detail
|
||||
request :remove_vmware_dc
|
||||
request :remove_vpn_user
|
||||
request :replace_network_acl_list
|
||||
request :reset_api_limit
|
||||
request :reset_password_for_virtual_machine
|
||||
request :reset_ssh_key_for_virtual_machine
|
||||
request :reset_vpn_connection
|
||||
request :resize_volume
|
||||
request :restart_network
|
||||
request :restart_vpc
|
||||
request :restore_virtual_machine
|
||||
request :revert_snapshot
|
||||
request :revert_to_vm_snapshot
|
||||
request :revoke_security_group_egress
|
||||
request :revoke_security_group_ingress
|
||||
request :scale_system_vm
|
||||
request :scale_virtual_machine
|
||||
request :start_internal_load_balancer_vm
|
||||
request :start_router
|
||||
request :start_system_vm
|
||||
request :start_virtual_machine
|
||||
request :stop_internal_load_balancer_vm
|
||||
request :stop_router
|
||||
request :stop_system_vm
|
||||
request :stop_virtual_machine
|
||||
request :suspend_project
|
||||
request :update_account
|
||||
request :update_auto_scale_policy
|
||||
request :update_auto_scale_vm_group
|
||||
request :update_auto_scale_vm_profile
|
||||
request :update_cloud_to_use_object_store
|
||||
request :update_cluster
|
||||
request :update_configuration
|
||||
request :update_default_nic_for_virtual_machine
|
||||
request :update_disk_offering
|
||||
request :update_domain
|
||||
request :update_egress_firewall_rule
|
||||
request :update_firewall_rule
|
||||
request :update_global_load_balancer_rule
|
||||
request :update_guest_os
|
||||
request :update_guest_os_mapping
|
||||
request :update_host
|
||||
request :update_host_password
|
||||
request :update_hypervisor_capabilities
|
||||
request :update_instance_group
|
||||
request :update_ip_address
|
||||
request :update_iso
|
||||
request :update_iso_permissions
|
||||
request :update_lb_health_check_policy
|
||||
request :update_lb_stickiness_policy
|
||||
request :update_load_balancer
|
||||
request :update_load_balancer_rule
|
||||
request :update_network
|
||||
request :update_network_acl_item
|
||||
request :update_network_acl_list
|
||||
request :update_network_offering
|
||||
request :update_network_service_provider
|
||||
request :update_physical_network
|
||||
request :update_pod
|
||||
request :update_port_forwarding_rule
|
||||
request :update_project
|
||||
request :update_project_invitation
|
||||
request :update_region
|
||||
request :update_remote_access_vpn
|
||||
request :update_resource_count
|
||||
request :update_resource_limit
|
||||
request :update_service_offering
|
||||
request :update_storage_network_ip_range
|
||||
request :update_storage_pool
|
||||
request :update_template
|
||||
request :update_template_permissions
|
||||
request :update_traffic_type
|
||||
request :update_user
|
||||
request :update_virtual_machine
|
||||
request :update_vm_affinity_group
|
||||
request :update_volume
|
||||
request :update_vpc
|
||||
request :update_vpcoffering
|
||||
request :update_vpn_connection
|
||||
request :update_vpn_customer_gateway
|
||||
request :update_vpn_gateway
|
||||
request :update_zone
|
||||
request :upgrade_router_template
|
||||
request :upload_custom_certificate
|
||||
request :upload_ssl_cert
|
||||
request :upload_volume
|
||||
|
||||
|
||||
class Real
|
||||
|
||||
def initialize(options={})
|
||||
@cloudstack_api_key = options[:cloudstack_api_key]
|
||||
@cloudstack_secret_access_key = options[:cloudstack_secret_access_key]
|
||||
@cloudstack_session_id = options[:cloudstack_session_id]
|
||||
@cloudstack_session_key = options[:cloudstack_session_key]
|
||||
@cloudstack_project_id = options[:cloudstack_project_id]
|
||||
@host = options[:cloudstack_host]
|
||||
@path = options[:cloudstack_path] || '/client/api'
|
||||
@port = options[:cloudstack_port] || 443
|
||||
@scheme = options[:cloudstack_scheme] || 'https'
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:cloudstack_persistent], {:ssl_verify_peer => false})
|
||||
end
|
||||
|
||||
def reload
|
||||
@connection.reset
|
||||
end
|
||||
|
||||
def login(username,password,domain)
|
||||
response = issue_request({
|
||||
'response' => 'json',
|
||||
'command' => 'login',
|
||||
'username' => username,
|
||||
'password' => Digest::MD5.hexdigest(password),
|
||||
'domain' => domain
|
||||
})
|
||||
|
||||
# Parse response cookies to retrive JSESSIONID token
|
||||
cookies = CGI::Cookie.parse(response.headers['Set-Cookie'])
|
||||
sessionid = cookies['JSESSIONID'].first
|
||||
|
||||
# Decode the login response
|
||||
response = Fog::JSON.decode(response.body)
|
||||
|
||||
user = response['loginresponse']
|
||||
user.merge!('sessionid' => sessionid)
|
||||
|
||||
@cloudstack_session_id = user['sessionid']
|
||||
@cloudstack_session_key = user['sessionkey']
|
||||
|
||||
user
|
||||
end
|
||||
|
||||
def request(params)
|
||||
params.reject!{|k,v| v.nil?}
|
||||
|
||||
params.merge!('response' => 'json')
|
||||
|
||||
if has_session?
|
||||
params, headers = authorize_session(params)
|
||||
elsif has_keys?
|
||||
params, headers = authorize_api_keys(params)
|
||||
end
|
||||
|
||||
response = issue_request(params,headers)
|
||||
response = Fog::JSON.decode(response.body) unless response.body.empty?
|
||||
response
|
||||
end
|
||||
|
||||
private
|
||||
def has_session?
|
||||
@cloudstack_session_id && @cloudstack_session_key
|
||||
end
|
||||
|
||||
def has_keys?
|
||||
@cloudstack_api_key && @cloudstack_secret_access_key
|
||||
end
|
||||
|
||||
def authorize_session(params)
|
||||
# set the session id cookie for the request
|
||||
headers = {'Cookie' => "JSESSIONID=#{@cloudstack_session_id};"}
|
||||
# set the sesion key for the request, params are not signed using session auth
|
||||
params.merge!('sessionkey' => @cloudstack_session_key)
|
||||
|
||||
return params, headers
|
||||
end
|
||||
|
||||
def authorize_api_keys(params)
|
||||
headers = {}
|
||||
# merge the api key into the params
|
||||
params.merge!('apiKey' => @cloudstack_api_key)
|
||||
# sign the request parameters
|
||||
signature = Fog::Cloudstack.signed_params(@cloudstack_secret_access_key,params)
|
||||
# merge signature into request param
|
||||
params.merge!({'signature' => signature})
|
||||
|
||||
return params, headers
|
||||
end
|
||||
|
||||
def issue_request(params={},headers={},method='GET',expects=200)
|
||||
begin
|
||||
@connection.request({
|
||||
:query => params,
|
||||
:headers => headers,
|
||||
:method => method,
|
||||
:expects => expects
|
||||
})
|
||||
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
error_response = Fog::JSON.decode(error.response.body)
|
||||
|
||||
error_code = error_response.values.first['errorcode']
|
||||
error_text = error_response.values.first['errortext']
|
||||
|
||||
case error_code
|
||||
when 401
|
||||
raise Fog::Compute::Cloudstack::Unauthorized, error_text
|
||||
when 431
|
||||
raise Fog::Compute::Cloudstack::BadRequest, error_text
|
||||
else
|
||||
raise Fog::Compute::Cloudstack::Error, error_text
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end # Real
|
||||
|
||||
class Mock
|
||||
def initialize(options={})
|
||||
@cloudstack_api_key = options[:cloudstack_api_key]
|
||||
@cloudstack_project_id = Fog.credentials[:cloudstack_project_id] || Fog::Cloudstack.uuid
|
||||
end
|
||||
|
||||
def self.data
|
||||
@data ||= begin
|
||||
zone_id = Fog.credentials[:cloudstack_zone_id] || Fog::Cloudstack.uuid
|
||||
image_id = Fog.credentials[:cloudstack_template_id] || Fog::Cloudstack.uuid
|
||||
flavor_id = Fog.credentials[:cloudstack_service_offering_id] || Fog::Cloudstack.uuid
|
||||
network_id = (Array(Fog.credentials[:cloudstack_network_ids]) || [Fog::Cloudstack.uuid]).first
|
||||
domain_name = "exampleorg"
|
||||
account_id, user_id, domain_id = Fog::Cloudstack.uuid, Fog::Cloudstack.uuid, Fog::Cloudstack.uuid
|
||||
domain = {
|
||||
"id" => domain_id,
|
||||
"name" => domain_name,
|
||||
"level" => 1,
|
||||
"parentdomainid" => Fog::Cloudstack.uuid,
|
||||
"parentdomainname" => "ROOT",
|
||||
"haschild" => false,
|
||||
"path" => "ROOT/accountname"
|
||||
}
|
||||
user = {
|
||||
"id" => user_id,
|
||||
"username" => "username",
|
||||
"firstname" => "Bob",
|
||||
"lastname" => "Lastname",
|
||||
"email" => "email@example.com",
|
||||
"created" => "2012-05-14T16:25:17-0500",
|
||||
"state" => "enabled",
|
||||
"account" => "accountname",
|
||||
"accounttype" => 2,
|
||||
"domainid" => domain_id,
|
||||
"domain" => domain_name,
|
||||
"apikey" => Fog::Cloudstack.uuid,
|
||||
"secretkey" => Fog::Cloudstack.uuid
|
||||
}
|
||||
{
|
||||
:users => { user_id => user },
|
||||
:networks => { network_id => {
|
||||
"id" => network_id,
|
||||
"name" => "10.56.23.0/26",
|
||||
"displaytext" => "10.56.23.0/26",
|
||||
"broadcastdomaintype" => "Vlan",
|
||||
"traffictype" => "Guest",
|
||||
"gateway" => "10.56.23.1",
|
||||
"netmask" => "255.255.255.192",
|
||||
"cidr" => "10.56.23.0/26",
|
||||
"zoneid" => zone_id,
|
||||
"zonename" => "zone-00",
|
||||
"networkofferingid" => "af0c9bd5-a1b2-4ad0-bf4b-d6fa9b1b9d5b",
|
||||
"networkofferingname" => "DefaultSharedNetworkOffering",
|
||||
"networkofferingdisplaytext" => "Offering for Shared networks",
|
||||
"networkofferingavailability" => "Optional",
|
||||
"issystem" => false,
|
||||
"state" => "Setup",
|
||||
"related" => "86bbc9fc-d92e-49db-9fdc-296189090017",
|
||||
"broadcasturi" => "vlan://800",
|
||||
"dns1" => "10.0.80.11",
|
||||
"type" => "Shared",
|
||||
"vlan" => "800",
|
||||
"acltype" => "Domain",
|
||||
"subdomainaccess" => true,
|
||||
"domainid" => domain_id,
|
||||
"domain" => "ROOT",
|
||||
"service" => [
|
||||
{"name" => "UserData"},
|
||||
{"name" => "Dhcp"},
|
||||
{
|
||||
"name" => "Dns",
|
||||
"capability" => [
|
||||
{
|
||||
"name" => "AllowDnsSuffixModification",
|
||||
"value" => "true",
|
||||
"canchooseservicecapability" => false
|
||||
}
|
||||
]
|
||||
}],
|
||||
"networkdomain" => "cs1cloud.internal",
|
||||
"physicalnetworkid" => "8f4627c5-1fdd-4504-8a92-f61b4e9cb3e3",
|
||||
"restartrequired" => false,
|
||||
"specifyipranges" => true}
|
||||
},
|
||||
:public_ip_addresses => { "0e276270-7950-4483-bf21-3dc897dbe08a" => {
|
||||
"id" => "0e276270-7950-4483-bf21-3dc897dbe08a",
|
||||
"ipaddress" => "192.168.200.2",
|
||||
"allocated" => "2014-11-26T22:32:39+0000",
|
||||
"zoneid" => "0e276270-7950-4483-bf21-3dc897dbe08a",
|
||||
"zonename" => "Toronto",
|
||||
"issourcenat" => false,
|
||||
"projectid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"project" => "TestProject",
|
||||
"domainid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"domain" => "TestDomain",
|
||||
"forvirtualnetwork" => true,
|
||||
"isstaticnat" => false,
|
||||
"issystem" => false,
|
||||
"associatednetworkid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"associatednetworkname" => "TestNetwork",
|
||||
"networkid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"state" => "Allocated",
|
||||
"physicalnetworkid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"tags" => []
|
||||
}},
|
||||
:zones => { zone_id => {
|
||||
"id" => zone_id,
|
||||
"name" => "zone-00",
|
||||
"domainid" => 1,
|
||||
"domainname" => "ROOT",
|
||||
"networktype" => "Advanced",
|
||||
"securitygroupsenabled" => false,
|
||||
"allocationstate" => "Enabled",
|
||||
"zonetoken" => Fog::Cloudstack.uuid,
|
||||
"dhcpprovider" => "VirtualRouter"}},
|
||||
:images => { image_id => {
|
||||
"id" => image_id,
|
||||
"name" => "CentOS 5.6(64-bit) no GUI (XenServer)",
|
||||
"displaytext" => "CentOS 5.6(64-bit) no GUI (XenServer)",
|
||||
"ispublic" => true,
|
||||
"created" => "2012-05-09T15:29:33-0500",
|
||||
"isready" => true,
|
||||
"passwordenabled" => false,
|
||||
"format" => "VHD",
|
||||
"isfeatured" => true,
|
||||
"crossZones" => true,
|
||||
"ostypeid" => "a6a6694a-18f5-4765-8418-2b7a5f37cd0f",
|
||||
"ostypename" => "CentOS 5.3 (64-bit)",
|
||||
"account" => "system",
|
||||
"zoneid" => zone_id,
|
||||
"zonename" => "zone-00",
|
||||
"status" => "Download Complete",
|
||||
"size" => 21474836480,
|
||||
"templatetype" => "BUILTIN",
|
||||
"domain" => "ROOT",
|
||||
"domainid" => "6023b6fe-5bef-4358-bc76-9f4e75afa52f",
|
||||
"isextractable" => true,
|
||||
"checksum" => "905cec879afd9c9d22ecc8036131a180",
|
||||
"hypervisor" => "Xen"
|
||||
}},
|
||||
:flavors => { flavor_id => {
|
||||
"id" => flavor_id,
|
||||
"name" => "Medium Instance",
|
||||
"displaytext" => "Medium Instance",
|
||||
"cpunumber" => 1,
|
||||
"cpuspeed" => 1000,
|
||||
"memory" => 1024,
|
||||
"created" => "2012-05-09T14:48:36-0500",
|
||||
"storagetype" => "shared",
|
||||
"offerha" => false,
|
||||
"limitcpuuse" => false,
|
||||
"issystem" => false,
|
||||
"defaultuse" => false
|
||||
}},
|
||||
:accounts => { account_id => {
|
||||
"id" => account_id,
|
||||
"name" => "accountname",
|
||||
"accounttype" => 2,
|
||||
"domainid" => domain_id,
|
||||
"domain" => domain_name,
|
||||
"receivedbytes" => 0,
|
||||
"sentbytes" => 0,
|
||||
"vmlimit" => "Unlimited",
|
||||
"vmtotal" => 0,
|
||||
"vmavailable" => "Unlimited",
|
||||
"iplimit" => "Unlimited",
|
||||
"iptotal" => 0,
|
||||
"ipavailable" => "Unlimited",
|
||||
"volumelimit" => "Unlimited",
|
||||
"volumetotal" => 0,
|
||||
"volumeavailable" => "Unlimited",
|
||||
"snapshotlimit" => "Unlimited",
|
||||
"snapshottotal" => 0,
|
||||
"snapshotavailable" => "Unlimited",
|
||||
"templatelimit" => "Unlimited",
|
||||
"templatetotal" => 0,
|
||||
"templateavailable" => "Unlimited",
|
||||
"vmstopped" => 0,
|
||||
"vmrunning" => 0,
|
||||
"projectlimit" => "Unlimited",
|
||||
"projecttotal" => 1,
|
||||
"projectavailable" => "Unlimited",
|
||||
"networklimit" => "Unlimited",
|
||||
"networktotal" => 0,
|
||||
"networkavailable" => "Unlimited",
|
||||
"state" => "enabled",
|
||||
"user" => [user]}
|
||||
},
|
||||
:domains => {domain_id => domain},
|
||||
:servers => {},
|
||||
:jobs => {},
|
||||
:volumes => {
|
||||
"89198f7c-0245-aa1d-136a-c5f479ef9db7" => {
|
||||
"id"=> "89198f7c-0245-aa1d-136a-c5f479ef9db7",
|
||||
"name"=>"test volume",
|
||||
"zoneid"=> zone_id,
|
||||
"zonename"=>"zone-00",
|
||||
"type"=>"DATADISK",
|
||||
"deviceid"=>1,
|
||||
"virtualmachineid"=> "51dcffee-5f9f-29a4-acee-2717e1a3656b",
|
||||
"vmname"=>"i-2824-11621-VM",
|
||||
"vmdisplayname"=>"test vm",
|
||||
"vmstate"=>"Running",
|
||||
"size"=>17179869184,
|
||||
"created"=>"2013-04-16T12:33:41+0000",
|
||||
"state"=>"Ready",
|
||||
"account"=> 'accountname',
|
||||
"domainid"=> domain_id,
|
||||
"domain"=> domain_name,
|
||||
"storagetype"=>"shared",
|
||||
"hypervisor"=>"KVM",
|
||||
"diskofferingid"=> "cc4de87d-672d-4353-abb5-6a8a4c0abf59",
|
||||
"diskofferingname"=>"Small Disk",
|
||||
"diskofferingdisplaytext"=>"Small Disk [16GB Disk]",
|
||||
"storage"=>"ps1",
|
||||
"attached"=>"2013-04-16T12:34:07+0000",
|
||||
"destroyed"=>false,
|
||||
"isextractable"=>false
|
||||
},
|
||||
},
|
||||
:security_groups => {},
|
||||
:snapshots => {},
|
||||
:disk_offerings => {
|
||||
"cc4de87d-672d-4353-abb5-6a8a4c0abf59" => {
|
||||
"id" => "cc4de87d-672d-4353-abb5-6a8a4c0abf59",
|
||||
"domainid" => domain_id,
|
||||
"domain" => domain_name,
|
||||
"name" => "Small Disk",
|
||||
"displaytext" => "Small Disk [16GB Disk]",
|
||||
"disksize" => 16,
|
||||
"created" => "2013-02-21T03:12:520300",
|
||||
"iscustomized" => false,
|
||||
"storagetype" => "shared"
|
||||
},
|
||||
"d5deeb0c-de03-4ebf-820a-dc74221bcaeb" => {
|
||||
"id" => "d5deeb0c-de03-4ebf-820a-dc74221bcaeb",
|
||||
"domainid" => domain_id,
|
||||
"domain" => domain_name,
|
||||
"name" => "Medium Disk",
|
||||
"displaytext" => "Medium Disk [32GB Disk]",
|
||||
"disksize" => 32,
|
||||
"created" => "2013-02-21T03:12:520300",
|
||||
"iscustomized" => false,
|
||||
"storagetype" => "shared"
|
||||
}
|
||||
},
|
||||
:network_offerings => {
|
||||
"cc4de87d-672d-4353-abb5-6a8a4c0abf59" => {
|
||||
"id" => "cc4de87d-672d-4353-abb5-6a8a4c0abf59",
|
||||
"name" => "Shared Network With Security Groups",
|
||||
"displaytext" => "Shared Network With Security Groups",
|
||||
"traffictype" => "Guest",
|
||||
"isdefault" => true,
|
||||
"specifyvlan" => true,
|
||||
"conservemode" => true,
|
||||
"specifyipranges" => true,
|
||||
"availability" => "Optional",
|
||||
"networkrate" => 200,
|
||||
"state" => "Enabled",
|
||||
"guestiptype" => "Shared",
|
||||
"serviceofferingid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1"
|
||||
}
|
||||
},
|
||||
:firewall_rules => {
|
||||
"f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1" => {
|
||||
"id"=> "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"protocol"=> "tcp",
|
||||
"startport" => "443",
|
||||
"endport" => "443",
|
||||
"ipaddressid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"networkid"=> "31c4b26e-4be9-11e4-8304-00163e5b5f54",
|
||||
"ipaddress" => "192.168.200.1",
|
||||
"state" => "Active",
|
||||
"cidrlist" => "255.255.255.0/24",
|
||||
"tags" => []
|
||||
}
|
||||
},
|
||||
:egress_firewall_rules => {
|
||||
"f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1" => {
|
||||
"id"=>"f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"protocol"=>"tcp",
|
||||
"networkid"=> "31c4b26e-4be9-11e4-8304-00163e5b5f54",
|
||||
"state"=>"Active",
|
||||
"cidrlist"=>"10.2.1.0/24",
|
||||
"tags"=>[]
|
||||
}
|
||||
},
|
||||
:port_forwarding_rules => {
|
||||
"8f4627c5-1fdd-4504-8a92-f61b4e9cb3e3" => {
|
||||
'id' => "8f4627c5-1fdd-4504-8a92-f61b4e9cb3e3",
|
||||
'privateport' => "25",
|
||||
'privateendport' => "25",
|
||||
'protocol' => "tcp",
|
||||
'publicport' => "25",
|
||||
'publicendport' => "25",
|
||||
'virtualmachineid' => "8f4627c5-1fdd-4504-8a92-f61b4e9cb3e3",
|
||||
'virtualmachinename' => "LoadBalancer",
|
||||
'virtualmachinedisplayname' => "LoadBalancer",
|
||||
'ipaddressid' => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
'ipaddress' => "192.168.200.200",
|
||||
'state' => "Active",
|
||||
'cidrlist' => "",
|
||||
'tags' => []
|
||||
}
|
||||
},
|
||||
:os_types => {
|
||||
"51ef854d-279e-4e68-9059-74980fd7b29b" => {
|
||||
"id" => "51ef854d-279e-4e68-9059-74980fd7b29b",
|
||||
"oscategoryid" => "56f67279-e082-45c3-a01c-d290d6cd4ce2",
|
||||
"description" => "Asianux 3(32-bit)"
|
||||
},
|
||||
"daf124c8-95d8-4756-8e1c-1871b073babb" => {
|
||||
"id" => "daf124c8-95d8-4756-8e1c-1871b073babb",
|
||||
"oscategoryid" => "56f67279-e082-45c3-a01c-d290d6cd4ce2",
|
||||
"description" => "Asianux 3(64-bit)"
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def self.reset
|
||||
@data = nil
|
||||
end
|
||||
|
||||
def data
|
||||
self.class.data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@cloudstack_api_key)
|
||||
end
|
||||
|
||||
end
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,41 +0,0 @@
|
|||
require 'fog/core'
|
||||
require 'fog/json'
|
||||
require 'uri'
|
||||
|
||||
module Fog
|
||||
module Cloudstack
|
||||
extend Fog::Provider
|
||||
|
||||
service(:compute, 'Compute')
|
||||
|
||||
@@digest = OpenSSL::Digest.new('sha1')
|
||||
|
||||
def self.escape(string)
|
||||
string = CGI::escape(string)
|
||||
string = string.gsub("+","%20")
|
||||
# Escaped asterisk will cause malformed request
|
||||
string = string.gsub("%2A","*")
|
||||
string
|
||||
end
|
||||
|
||||
def self.signed_params(key,params)
|
||||
query = params.map{|k,v| [k.to_s, v]}.sort.map{|c| "#{c[0]}=#{escape(c[1].to_s)}"}.join('&').downcase
|
||||
|
||||
signed_string = Base64.encode64(OpenSSL::HMAC.digest(@@digest,key,query)).strip
|
||||
|
||||
signed_string
|
||||
end
|
||||
|
||||
def self.uuid
|
||||
[8,4,4,4,12].map{|i| Fog::Mock.random_hex(i)}.join("-")
|
||||
end
|
||||
|
||||
def self.ip_address
|
||||
4.times.map{ Fog::Mock.random_numbers(3) }.join(".")
|
||||
end
|
||||
|
||||
def self.mac_address
|
||||
6.times.map{ Fog::Mock.random_numbers(2) }.join(":")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Address < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :network_id, :aliases => 'networkid'
|
||||
attribute :ip_address, :aliases => 'ipaddress'
|
||||
attribute :traffic_type, :aliases => 'traffictype'
|
||||
attribute :is_default, :aliases => 'isdefault'
|
||||
attribute :mac_address, :aliases => 'macaddress'
|
||||
attribute :netmask
|
||||
attribute :gateway
|
||||
attribute :type
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,44 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class DiskOffering < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :created
|
||||
attribute :disk_size, :aliases => 'disk_size'
|
||||
attribute :display_text, :aliases => 'display_text'
|
||||
attribute :domain
|
||||
attribute :domain_id, :aliases => 'domainid'
|
||||
attribute :is_customized, :aliases => 'iscustomized'
|
||||
attribute :name
|
||||
attribute :storage_type, :aliases => 'storagetype'
|
||||
attribute :tags
|
||||
|
||||
def save
|
||||
requires :display_text, :name
|
||||
|
||||
options = {
|
||||
'displaytext' => display_text,
|
||||
'name' => name,
|
||||
'customized' => is_customized,
|
||||
'disksize' => disk_size,
|
||||
'domain_id' => domain_id,
|
||||
'storagetype' => storage_type,
|
||||
'tags' => tags
|
||||
}
|
||||
|
||||
response = service.create_disk_offering(options)
|
||||
merge_attributes(response['creatediskofferingresponse'])
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
|
||||
response = service.delete_disk_offering('id' => id )
|
||||
success_status = response['deletediskofferingresponse']['success']
|
||||
|
||||
success_status == 'true'
|
||||
end
|
||||
end # DiskOffering
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,24 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/disk_offering'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class DiskOfferings < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::DiskOffering
|
||||
|
||||
def all(options = {})
|
||||
response = service.list_disk_offerings(options)
|
||||
disk_offerings_data = response["listdiskofferingsresponse"]["diskoffering"] || []
|
||||
load(disk_offerings_data)
|
||||
end
|
||||
|
||||
def get(disk_offering_id)
|
||||
response = service.list_disk_offerings('id' => disk_offering_id)
|
||||
disk_offering_data = response["listdiskofferingsresponse"]["diskoffering"].first
|
||||
new(disk_offering_data)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,38 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class EgressFirewallRule < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :protocol, :aliases => 'protocol'
|
||||
attribute :network_id, :aliases => 'networkid'
|
||||
attribute :state, :aliases => 'state'
|
||||
attribute :cidr_list, :aliases => 'cidrlist'
|
||||
attribute :tags, :type => :array
|
||||
attribute :job_id, :aliases => 'jobid' # only on create
|
||||
|
||||
def save
|
||||
requires :protocol, :network_id
|
||||
|
||||
options = {
|
||||
'protocol' => protocol,
|
||||
'networkid' => network_id,
|
||||
'cidrlist' => cidr_list,
|
||||
}
|
||||
|
||||
response = service.create_egress_firewall_rule(options)
|
||||
merge_attributes(response['createegressfirewallruleresponse'])
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
|
||||
response = service.delete_egress_firewall_rule('id' => id )
|
||||
success_status = response['deleteegressfirewallruleresponse']['success']
|
||||
|
||||
success_status == 'true'
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/egress_firewall_rule'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class EgressFirewallRules < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::EgressFirewallRule
|
||||
|
||||
def all(options = {})
|
||||
response = service.list_egress_firewall_rules(options)
|
||||
egress_firewall_rules = response["listegressfirewallrulesresponse"]["firewallrule"] || []
|
||||
load(egress_firewall_rules)
|
||||
end
|
||||
|
||||
def get(address_id)
|
||||
options = { 'id' => address_id }
|
||||
response = service.list_egress_firewall_rules(options)
|
||||
egress_firewall_rules = response["listegressfirewallrulesresponse"]["firewallrule"].first
|
||||
new(egress_firewall_rules)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class FirewallRule < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :cidr_list, :aliases => 'cidrlist'
|
||||
attribute :start_port, :aliases => 'startport', :type => :integer
|
||||
attribute :end_port, :aliases => 'endport', :type => :integer
|
||||
attribute :icmp_code, :aliases => 'icmpcode'
|
||||
attribute :icmp_type, :aliases => 'icmptype'
|
||||
attribute :ip_address, :aliases => 'ipaddress'
|
||||
attribute :ip_address_id, :aliases => 'ipaddressid'
|
||||
attribute :network_id, :aliases => 'networkid'
|
||||
attribute :protocol
|
||||
attribute :state
|
||||
attribute :tags, :type => :array
|
||||
|
||||
# def save
|
||||
# end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/firewall_rule'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class FirewallRules < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::FirewallRule
|
||||
|
||||
def all(options = {})
|
||||
response = service.list_firewall_rules(options)
|
||||
firewall_rules = response["listfirewallrulesresponse"]["firewallrule"] || []
|
||||
load(firewall_rules)
|
||||
end
|
||||
|
||||
def get(address_id)
|
||||
options = { 'id' => address_id }
|
||||
response = service.list_firewall_rules(options)
|
||||
firewall_rules = response["listfirewallrulesresponse"]["firewallrule"].first
|
||||
new(firewall_rules)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Flavor < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :cpu_number, :aliases => 'cpunumber'
|
||||
attribute :cpu_speed, :aliases => 'cpuspeed'
|
||||
attribute :created, :type => :time
|
||||
attribute :default_use, :aliases => 'defaultuse'
|
||||
attribute :display_text, :aliases => 'display_text'
|
||||
attribute :domain
|
||||
attribute :host_tags, :aliases => 'host_tags'
|
||||
attribute :is_system, :aliases => 'issystem', :type => :boolean
|
||||
attribute :is_volatile, :aliases => 'isvolatile', :type => :boolean
|
||||
attribute :is_customized, :aliases => 'iscustomized', :type => :boolean
|
||||
attribute :limit_cpu_use, :aliases => 'limitcpuuse'
|
||||
attribute :tags
|
||||
attribute :system_vm_type, :aliases => 'systemvm'
|
||||
attribute :storage_type, :aliases => 'storagetype'
|
||||
attribute :offer_ha, :aliases => 'offerha'
|
||||
attribute :network_rate, :aliases => 'networkrate'
|
||||
attribute :name
|
||||
attribute :memory
|
||||
|
||||
def save
|
||||
raise Fog::Errors::Error.new('Creating a flavor is not supported')
|
||||
end
|
||||
|
||||
def destroy
|
||||
raise Fog::Errors::Error.new('Destroying a flavor is not supported')
|
||||
end
|
||||
|
||||
end # Flavor
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,25 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/flavor'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Flavors < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::Flavor
|
||||
|
||||
def all
|
||||
data = service.list_service_offerings["listserviceofferingsresponse"]["serviceoffering"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(flavor_id)
|
||||
if flavor = service.list_service_offerings('id' => flavor_id)["listserviceofferingsresponse"]["serviceoffering"].first
|
||||
new(flavor)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,72 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Image < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :account
|
||||
attribute :account_id, :aliases => 'accountid'
|
||||
attribute :bootable
|
||||
attribute :checksum
|
||||
attribute :created, :type => :time
|
||||
attribute :cross_zones, :aliases => 'crossZones'
|
||||
attribute :details
|
||||
attribute :display_text, :aliases => 'displaytext'
|
||||
attribute :domain
|
||||
attribute :domain_id, :aliases => 'domainid'
|
||||
attribute :format
|
||||
attribute :host_id, :aliases => 'hostid'
|
||||
attribute :host_name, :aliases => 'hostname'
|
||||
attribute :hypervisor
|
||||
attribute :job_id, :aliases => 'jobid'
|
||||
attribute :job_status, :aliases => 'jobstatus'
|
||||
attribute :is_extractable, :aliases => 'isextractable', :type => :boolean
|
||||
attribute :is_featured, :aliases => 'isfeatured', :type => :boolean
|
||||
attribute :is_public, :aliases => 'ispublic', :type => :boolean
|
||||
attribute :is_ready, :aliases => 'isready', :type => :boolean
|
||||
attribute :name
|
||||
attribute :os_type_id, :aliases => 'ostypeid'
|
||||
attribute :os_type_name, :aliases => 'ostypename'
|
||||
attribute :password_enabled, :aliases => 'passwordenabled'
|
||||
attribute :project
|
||||
attribute :project_id, :aliases => 'projectid'
|
||||
attribute :removed
|
||||
attribute :size
|
||||
attribute :source_template_id, :aliases => 'sourcetemplateid'
|
||||
attribute :status
|
||||
attribute :template_tag, :aliases => 'templatetag'
|
||||
attribute :template_type, :aliases => 'templatetype'
|
||||
attribute :zone_id, :aliases => 'zoneid'
|
||||
attribute :zone_name, :aliases => 'zonename'
|
||||
|
||||
attr_accessor :bits, :requires_hvm, :snapshot_id, :url, :virtual_machine_id, :volume_id
|
||||
|
||||
def save
|
||||
options = {
|
||||
'displaytext' => display_text,
|
||||
'name' => name,
|
||||
'ostypeid' => os_type_id,
|
||||
'bits' => bits,
|
||||
'details' => details,
|
||||
'isfeatured' => is_featured,
|
||||
'ispublic' => is_public,
|
||||
'passwordenabled' => password_enabled,
|
||||
'requireshvm' => requires_hvm,
|
||||
'snapshotid' => snapshot_id,
|
||||
'templatetag' => template_tag,
|
||||
'url' => url,
|
||||
'virtualmachineid' => virtual_machine_id,
|
||||
'volumeid' => volume_id
|
||||
}
|
||||
data = service.create_template(options)
|
||||
merge_attributes(data['createtemplateresponse'])
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
service.delete_template('id' => self.id)
|
||||
true
|
||||
end
|
||||
end # Server
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,37 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/image'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Images < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::Image
|
||||
|
||||
def all(filters={})
|
||||
options = get_filter_options(filters)
|
||||
data = service.list_templates(options)["listtemplatesresponse"]["template"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(template_id, filters={})
|
||||
filter_option = get_filter_options(filters)
|
||||
options = filter_option.merge('id' => template_id)
|
||||
if template = service.list_templates(options)["listtemplatesresponse"]["template"].first
|
||||
new(template)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_filter_options(filters)
|
||||
default_filter = {
|
||||
'templatefilter' => 'self'
|
||||
}
|
||||
default_filter.merge(filters)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,51 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Job < Fog::Model
|
||||
identity :id, :aliases => 'jobid'
|
||||
attribute :user_id, :aliases => 'userid'
|
||||
attribute :account_id, :aliases => 'accountid'
|
||||
attribute :cmd
|
||||
attribute :job_status, :aliases => 'jobstatus', :type => :integer
|
||||
attribute :job_result_type, :aliases => 'jobresulttype'
|
||||
attribute :job_result_code, :aliases => 'jobresultcode', :type => :integer
|
||||
attribute :job_proc_status, :aliases => 'jobprocstatus', :type => :integer
|
||||
|
||||
attribute :created_at, :aliases => 'created', :type => :time
|
||||
attribute :job_result, :aliases => 'jobresult'
|
||||
|
||||
def reload
|
||||
requires :id
|
||||
merge_attributes(service.query_async_job_result('jobid' => self.id)['queryasyncjobresultresponse'])
|
||||
end
|
||||
|
||||
def ready?
|
||||
self.job_status != 0
|
||||
end
|
||||
|
||||
def successful?
|
||||
self.job_result_code == 0
|
||||
end
|
||||
|
||||
# so dirty
|
||||
def result
|
||||
if successful? && model = Fog::Compute::Cloudstack.constants.find{|c| c.to_s.downcase == self.job_result.keys.first.to_s}.to_s
|
||||
collection = model.gsub(/.[A-Z]/){|w| "#{w[0,1]}_#{w[1,1].downcase}"}.downcase + "s" # cheap underscorize, assume simple pluralization
|
||||
service.send(collection).new(self.job_result.values.first)
|
||||
else self.job_result
|
||||
end
|
||||
end
|
||||
|
||||
def save
|
||||
raise Fog::Errors::Error.new('Creating a job is not supported')
|
||||
end
|
||||
|
||||
def destroy
|
||||
raise Fog::Errors::Error.new('Destroying a job is not supported')
|
||||
end
|
||||
|
||||
|
||||
end # Job
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,25 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/job'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Jobs < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::Job
|
||||
|
||||
def all
|
||||
data = service.list_async_jobs["listasyncjobsresponse"]["asyncjobs"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(job_id)
|
||||
if job = service.query_async_job_result('jobid' => job_id)["queryasyncjobresultresponse"]
|
||||
new(job)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,73 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Network < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :name, :aliases => 'name'
|
||||
attribute :display_text, :aliases => 'displaytext'
|
||||
|
||||
attribute :broadcast_domain_type, :aliases => 'broadcastdomaintype'
|
||||
attribute :traffic_type, :aliases => 'traffictype'
|
||||
attribute :gateway, :aliases => 'gateway'
|
||||
attribute :cidr, :aliases => 'cidr'
|
||||
attribute :zone_id, :aliases => 'zoneid'
|
||||
attribute :zone_name, :aliases => 'zonename'
|
||||
|
||||
attribute :network_offering_id, :aliases => 'networkofferingid'
|
||||
attribute :network_offering_name, :aliases => 'networkofferingname'
|
||||
attribute :network_offering_display_text, :aliases => 'networkofferingdisplaytext'
|
||||
attribute :network_offering_conserve_mode, :aliases => 'networkofferingconservemode'
|
||||
attribute :network_offering_availability, :aliases => 'networkofferingavailability'
|
||||
attribute :is_system, :aliases => 'issystem', :type => :boolean
|
||||
attribute :state, :aliases => 'state'
|
||||
|
||||
attribute :related, :aliases => 'related'
|
||||
attribute :dns1, :aliases => 'dns1'
|
||||
attribute :dns2, :aliases => 'dns2'
|
||||
attribute :type, :aliases => 'type'
|
||||
attribute :acl_type, :aliases => 'acltype'
|
||||
attribute :project_id, :aliases => 'projectid'
|
||||
attribute :domain_id, :aliases => 'domainid'
|
||||
attribute :domain, :aliases => 'domain'
|
||||
|
||||
# attribute :service, :aliases => 'service'
|
||||
attribute :network_domain, :aliases => 'domain'
|
||||
attribute :physical_network_id, :aliases => 'physicalnetworkid'
|
||||
attribute :restart_required, :aliases => 'restartrequired'
|
||||
attribute :specify_ip_ranges, :aliases => 'specifyipranges'
|
||||
attribute :canuse_for_deploy, :aliases => 'canusefordeploy'
|
||||
attribute :is_persistent, :aliases => 'ispersistent', :type => :boolean
|
||||
attribute :display_network, :aliases => 'displaynetwork'
|
||||
attribute :is_default, :aliases => 'isdefault', :type => :boolean
|
||||
|
||||
# restart network - will return a job
|
||||
def restart(options={})
|
||||
response = service.restart_network( options.merge({'id'=> self.id}))
|
||||
service.jobs.new(response['restartnetworkresponse'])
|
||||
end
|
||||
|
||||
# create a new network
|
||||
def save
|
||||
requires :display_text, :name, :network_offering_id, :zone_id
|
||||
|
||||
options = {
|
||||
'displaytext' => display_text,
|
||||
'name' => name,
|
||||
'zoneid' => zone_id,
|
||||
'networkofferingid' => network_offering_id
|
||||
}
|
||||
|
||||
response = service.create_network(options)
|
||||
merge_attributes(response['createnetworkresponse']['network'])
|
||||
end
|
||||
|
||||
# delete given network - will return a job
|
||||
def destroy(options={})
|
||||
response = service.delete_network(options.merge({'id'=> self.id}))
|
||||
service.jobs.new(response["deletenetworkresponse"])
|
||||
end
|
||||
|
||||
end # Network
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class NetworkOffering < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :name, :aliases => 'name'
|
||||
attribute :display_text, :aliases => 'displaytext'
|
||||
attribute :traffic_type, :aliases => 'traffictype'
|
||||
attribute :is_default, :aliases => 'isdefault', :type => :boolean
|
||||
attribute :specify_vlan, :aliases => 'specifyvlan'
|
||||
attribute :conserve_mode, :aliases => 'conservemode'
|
||||
attribute :specify_ip_ranges, :aliases => 'specifyipranges'
|
||||
attribute :availability, :aliases => 'availability'
|
||||
attribute :network_rate, :aliases => 'networkrate'
|
||||
attribute :state, :aliases => 'state'
|
||||
attribute :guest_ip_type, :aliases => 'guestiptype'
|
||||
attribute :service_offering_id, :aliases => 'serviceofferingid'
|
||||
attribute :service, :aliases => 'service'
|
||||
attribute :for_vpc, :aliases => 'forvpc'
|
||||
attribute :is_persistent, :aliases => 'ispersistent', :type => :boolean
|
||||
attribute :egress_default_policy, :aliases => 'egressdefaultpolicy'
|
||||
end # NetworkOffering
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
|
||||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/network_offering'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class NetworkOfferings < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::NetworkOffering
|
||||
|
||||
def all(filters={})
|
||||
options = get_filter_options(filters)
|
||||
data = service.list_network_offerings(options)["listnetworkofferingsresponse"]["networkoffering"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(network_offering_id, filters={})
|
||||
filter_option = get_filter_options(filters)
|
||||
options = filter_option.merge('id' => network_offering_id)
|
||||
if data = service.list_network_offerings(options)["listnetworkofferingsresponse"]["networkoffering"].first
|
||||
new(data)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_filter_options(filters)
|
||||
default_filter = {
|
||||
'projectfilter' => 'self'
|
||||
}
|
||||
default_filter.merge(filters)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,38 +0,0 @@
|
|||
|
||||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/network'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Networks < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::Network
|
||||
|
||||
def all(filters={})
|
||||
options = get_filter_options(filters)
|
||||
data = service.list_networks(options)["listnetworksresponse"]["network"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(network_id, filters={})
|
||||
filter_option = get_filter_options(filters)
|
||||
options = filter_option.merge('id' => network_id)
|
||||
if data = service.list_networks(options)["listnetworksresponse"]["network"].first
|
||||
new(data)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_filter_options(filters)
|
||||
default_filter = {
|
||||
'projectfilter' => 'self'
|
||||
}
|
||||
default_filter.merge(filters)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class PortForwardingRule < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
|
||||
attribute :private_port, :aliases => 'privateport'
|
||||
attribute :private_end_port, :aliases => 'privateendport'
|
||||
attribute :protocol, :aliases => 'protocol'
|
||||
attribute :public_port, :aliases => 'publicport'
|
||||
attribute :public_end_port, :aliases => 'publicendport'
|
||||
attribute :virtual_machine_id, :aliases => 'virtualmachineid'
|
||||
attribute :virtualmachinename, :aliases => 'virtualmachinename'
|
||||
attribute :virtualmachinedisplayname, :aliases => 'virtualmachinedisplayname'
|
||||
attribute :ipaddressid, :aliases => 'ipaddressid'
|
||||
attribute :ipaddress, :aliases => 'ipaddress'
|
||||
attribute :state, :aliases => 'state'
|
||||
attribute :cidrlist, :aliases => 'cidrlist'
|
||||
attribute :vmguestip, :aliases => 'vmguestip'
|
||||
attribute :networkid, :aliases => 'networkid'
|
||||
attribute :tags, :type => :array
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/port_forwarding_rule'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class PortForwardingRules < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::PortForwardingRule
|
||||
|
||||
def all(options = {})
|
||||
response = service.list_port_forwarding_rules(options)
|
||||
port_forwarding_rules = response["listportforwardingrulesresponse"]["portforwardingrule"] || []
|
||||
load(port_forwarding_rules)
|
||||
end
|
||||
|
||||
def get(address_id)
|
||||
options = { 'id' => address_id }
|
||||
response = service.list_port_forwarding_rules(options)
|
||||
port_forwarding_rules = response["listportforwardingrulesresponse"]["portforwardingrule"].first
|
||||
new(port_forwarding_rules)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,58 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Project < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :name, :aliases => 'name'
|
||||
attribute :display_text, :aliases => 'displaytext'
|
||||
attribute :domain_id, :aliases => 'domainid'
|
||||
attribute :domain, :aliases => 'domain'
|
||||
attribute :account, :aliases => 'account'
|
||||
attribute :state, :aliases => 'state'
|
||||
attribute :tags, :aliases => 'tags'
|
||||
attribute :network_limit, :aliases => 'networklimit'
|
||||
attribute :network_total, :aliases => 'networktotal', :type => :integer
|
||||
attribute :network_available, :aliases => 'networkavailable'
|
||||
attribute :vpc_limit, :aliases => 'vpclimit'
|
||||
attribute :vpc_total, :aliases => 'vpctotal', :type => :integer
|
||||
attribute :vpc_available, :aliases => 'vpcavailable'
|
||||
attribute :cpu_limit, :aliases => 'cpulimit'
|
||||
attribute :cpu_total, :aliases => 'cputotal', :type => :integer
|
||||
attribute :cpu_available, :aliases => 'cpuavailable'
|
||||
attribute :memory_limit, :aliases => 'memorylimit'
|
||||
attribute :memory_total, :aliases => 'memorytotal', :type => :integer
|
||||
attribute :memory_available, :aliases => 'memoryavailable'
|
||||
attribute :primary_storage_limit, :aliases => 'primarystoragelimit'
|
||||
attribute :primary_storage_total, :aliases => 'primarystoragetotal', :type => :integer
|
||||
attribute :primary_storage_available, :aliases => 'primarystorageavailable'
|
||||
attribute :secondary_storage_limit, :aliases => 'secondarystoragelimit'
|
||||
attribute :secondary_storage_total, :aliases => 'secondarystoragetotal', :type => :integer
|
||||
attribute :secondary_storage_available, :aliases => 'secondarystorageavailable'
|
||||
attribute :vm_limit, :aliases => 'vmlimit'
|
||||
attribute :vm_total, :aliases => 'vmtotal', :type => :integer
|
||||
attribute :vm_available, :aliases => 'vmavailable'
|
||||
attribute :ip_limit, :aliases => 'iplimit'
|
||||
attribute :ip_total, :aliases => 'iptotal', :type => :integer
|
||||
attribute :ip_available, :aliases => 'ipavailable'
|
||||
attribute :volume_limit, :aliases => 'volumelimit'
|
||||
attribute :volume_total, :aliases => 'volumetotal', :type => :integer
|
||||
attribute :volume_available, :aliases => 'volumeavailable'
|
||||
attribute :snapshot_limit, :aliases => 'snapshotlimit'
|
||||
attribute :snapshot_total, :aliases => 'snapshottotal', :type => :integer
|
||||
attribute :snapshot_available, :aliases => 'snapshotavailable'
|
||||
attribute :template_limit, :aliases => 'templatelimit'
|
||||
attribute :template_total, :aliases => 'templatetotal', :type => :integer
|
||||
attribute :template_available, :aliases => 'templateavailable'
|
||||
|
||||
def save
|
||||
raise Fog::Errors::Error.new('Creating a project is not supported')
|
||||
end
|
||||
|
||||
def destroy
|
||||
raise Fog::Errors::Error.new('Destroying a project is not supported')
|
||||
end
|
||||
|
||||
end # Project
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,39 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/project'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Projects < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::Project
|
||||
|
||||
def all(filters={})
|
||||
options = get_filter_options(filters)
|
||||
|
||||
data = service.list_projects(options)["listprojectsresponse"]["project"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(project_id, filters={})
|
||||
filter_option = get_filter_options(filters)
|
||||
options = filter_option.merge('id' => project_id)
|
||||
|
||||
if template = service.list_projects(options)["listprojectsresponse"]["project"].first
|
||||
new(template)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_filter_options(filters)
|
||||
default_filter = {
|
||||
'projectfilter' => 'self'
|
||||
}
|
||||
default_filter.merge(filters)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,96 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class PublicIpAddress < Fog::Model
|
||||
identity :id
|
||||
|
||||
attribute :account
|
||||
attribute :allocated, :type => :time
|
||||
attribute :associated_network_id, :aliases => 'associatednetworkid'
|
||||
attribute :associated_network_name, :aliases => 'associatednetworkname'
|
||||
attribute :domain
|
||||
attribute :domain_id, :aliases => 'domainid'
|
||||
attribute :for_virtual_network, :type => :boolean, :aliases => 'forvirtualnetwork'
|
||||
attribute :ip_address, :aliases => 'ipaddress'
|
||||
attribute :is_portable, :type => :boolean, :aliases => 'isportable'
|
||||
attribute :is_source_nat, :type => :boolean, :aliases => 'issourcenat'
|
||||
attribute :is_static_nat, :type => :boolean, :aliases => 'isstaticnat'
|
||||
attribute :is_system, :type => :boolean, :aliases => 'issystem'
|
||||
attribute :network_id, :type => :boolean, :aliases => 'networkid'
|
||||
attribute :physical_network_id, :aliases => 'physicalnetworkid'
|
||||
attribute :project
|
||||
attribute :project_id, :aliases => 'projectid'
|
||||
attribute :purpose
|
||||
attribute :state
|
||||
attribute :server_display_name, :aliases => 'virtualmachinedisplayname'
|
||||
attribute :server_id, :aliases => 'virtualmachineid'
|
||||
attribute :server_name, :aliases => 'virtualmachinename'
|
||||
attribute :vlan_id, :aliases => 'vlanid'
|
||||
attribute :vlan_name, :aliases => 'vlanname'
|
||||
attribute :server_ip_address, :aliases => 'vmipaddress'
|
||||
attribute :vpc_id, :aliases => 'vpcid'
|
||||
attribute :zone_id, :aliases => 'zoneid'
|
||||
attribute :zone_name, :aliases => 'zonename'
|
||||
attribute :tags, :type => :array
|
||||
attribute :job_id, :aliases => 'jobid' # only on associate
|
||||
|
||||
def initialize(attributes = {})
|
||||
# assign server first to prevent race condition with persisted?
|
||||
self.server = attributes.delete(:server)
|
||||
super
|
||||
end
|
||||
|
||||
def ready?
|
||||
state == 'Allocated'
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :identity
|
||||
service.disassociate_ip_address('id' => id)
|
||||
true
|
||||
end
|
||||
|
||||
def server=(new_server)
|
||||
@server = new_server
|
||||
if persisted?
|
||||
if !server_id.nil? && (new_server.nil? || server_id != new_server.id)
|
||||
service.disable_static_nat('ipaddressid' => id)
|
||||
self.server_display_name = nil
|
||||
self.server_id = nil
|
||||
self.server_name = nil
|
||||
self.server_ip_address = nil
|
||||
self.is_static_nat = false
|
||||
end
|
||||
unless new_server.nil?
|
||||
service.enable_static_nat(
|
||||
'ipaddressid' => id, 'virtualmachineid' => new_server.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def server
|
||||
service.servers.get(server_id)
|
||||
end
|
||||
|
||||
def save
|
||||
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
||||
options = {
|
||||
'account' => account,
|
||||
'domainid' => domain_id,
|
||||
'isportable' => is_portable,
|
||||
'networkid' => network_id,
|
||||
'projectid' => project_id,
|
||||
'vpcid' => vpc_id,
|
||||
'zoneid' => zone_id,
|
||||
}
|
||||
response = service.associate_ip_address(options)
|
||||
merge_attributes(response['associateipaddressresponse'])
|
||||
if @server
|
||||
self.server = @server
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/public_ip_address'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class PublicIpAddresses < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::PublicIpAddress
|
||||
|
||||
def all(options = {})
|
||||
response = service.list_public_ip_addresses(options)
|
||||
public_ip_addresses = response["listpublicipaddressesresponse"]["publicipaddress"] || []
|
||||
load(public_ip_addresses)
|
||||
end
|
||||
|
||||
def get(address_id)
|
||||
response = service.list_public_ip_addresses('id' => address_id)
|
||||
if public_ip_address = response["listpublicipaddressesresponse"]["publicipaddress"].first
|
||||
new(public_ip_address)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,50 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class SecurityGroup < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :name, :type => :string
|
||||
attribute :description, :type => :string
|
||||
attribute :account, :type => :string
|
||||
attribute :domain_id, :aliases => "domainid", :type => :string
|
||||
attribute :domain_name, :aliases => "domain", :type => :string
|
||||
attribute :project_id, :aliases => "projectid", :type => :string
|
||||
attribute :project_name, :aliases => "project", :type => :string
|
||||
attribute :ingress_rules, :aliases => "ingressrule", :type => :array
|
||||
attribute :egress_rules, :aliases => "egressrule", :type => :array
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
service.delete_security_group('id' => self.id)
|
||||
true
|
||||
end
|
||||
|
||||
def egress_rules
|
||||
attributes[:egress_rules] || []
|
||||
end
|
||||
|
||||
def ingress_rules
|
||||
attributes[:ingress_rules] || []
|
||||
end
|
||||
|
||||
def save
|
||||
requires :name
|
||||
|
||||
options = {
|
||||
'name' => self.name,
|
||||
'account' => self.account,
|
||||
'description' => self.description,
|
||||
'projectid' => self.project_id,
|
||||
'domainid' => self.domain_id,
|
||||
}
|
||||
data = service.create_security_group(options)
|
||||
merge_attributes(data['createsecuritygroupresponse']['securitygroup'])
|
||||
end
|
||||
|
||||
def rules
|
||||
service.security_group_rules.all("security_group_id" => self.id)
|
||||
end
|
||||
end # SecurityGroup
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,60 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class SecurityGroupRule < Fog::Model
|
||||
identity :id, :aliases => 'ruleid'
|
||||
|
||||
attribute :security_group_id, :type => :string
|
||||
attribute :protocol, :type => :string
|
||||
attribute :start_port, :type => :integer, :aliases => 'startport'
|
||||
attribute :end_port, :type => :integer, :aliases => 'endport'
|
||||
attribute :cidr, :type => :string
|
||||
attribute :direction, :type => :string
|
||||
|
||||
def destroy
|
||||
data = service.send("revoke_security_group_#{self.direction}", "id" => self.id)
|
||||
job = service.jobs.new(data["revokesecuritygroup#{self.direction}"])
|
||||
job.wait_for { ready? }
|
||||
job.successful?
|
||||
end
|
||||
|
||||
def port_range
|
||||
(self.start_port..self.end_port)
|
||||
end
|
||||
|
||||
def save
|
||||
requires :security_group_id, :cidr, :direction
|
||||
|
||||
data = service.send("authorize_security_group_#{self.direction}".to_sym, params)
|
||||
job = service.jobs.new(data["authorizesecuritygroup#{self.direction}response"])
|
||||
job.wait_for { ready? }
|
||||
# durty
|
||||
merge_attributes(job.result.send("#{self.direction}_rules").last)
|
||||
self
|
||||
end
|
||||
|
||||
def security_group
|
||||
service.security_groups.get(self.security_group_id)
|
||||
end
|
||||
|
||||
def reload
|
||||
requires :id, :security_group_id, :cidr
|
||||
|
||||
merge_attributes(security_group.rules.get(self.id))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def params
|
||||
options = {
|
||||
"securitygroupid" => self.security_group_id,
|
||||
"protocol" => self.protocol,
|
||||
"cidrlist" => self.cidr
|
||||
}
|
||||
options.merge!("startport" => self.start_port) unless self.start_port.nil?
|
||||
options.merge("endport" => self.end_port) unless self.end_port.nil?
|
||||
end
|
||||
end # SecurityGroupRule
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,35 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/security_group_rule'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class SecurityGroupRules < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::SecurityGroupRule
|
||||
|
||||
attribute :security_group_id, :type => :string
|
||||
|
||||
def security_group
|
||||
service.security_groups.get(self.security_group_id)
|
||||
end
|
||||
|
||||
def create(attributes)
|
||||
model = self.new(attributes.merge(:security_group_id => self.security_group_id))
|
||||
model.save
|
||||
end
|
||||
|
||||
def all(options={})
|
||||
merge_attributes(options)
|
||||
security_group = self.security_group
|
||||
rules = security_group.ingress_rules.map{|r| r.merge("direction" => "ingress", "security_group_id" => security_group_id)}
|
||||
rules += security_group.egress_rules.map{|r| r.merge("direction" => "egress", "security_group_id" => security_group_id)}
|
||||
load(rules)
|
||||
end
|
||||
|
||||
def get(rule_id)
|
||||
all.find{|r| r.id == rule_id}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/security_group'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class SecurityGroups < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::SecurityGroup
|
||||
|
||||
def all(options={})
|
||||
data = service.list_security_groups(options)["listsecuritygroupsresponse"]["securitygroup"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(security_group_id)
|
||||
if security_group = service.list_security_groups('id' => security_group_id)["listsecuritygroupsresponse"]["securitygroup"].first
|
||||
new(security_group)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,162 +0,0 @@
|
|||
require 'fog/compute/models/server'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Server < Fog::Compute::Server
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :name
|
||||
attribute :account_name, :aliases => 'account'
|
||||
attribute :domain_name, :aliases => 'domain'
|
||||
attribute :created, :type => :time
|
||||
attribute :state
|
||||
attribute :haenable
|
||||
attribute :memory
|
||||
attribute :display_name, :aliases => 'displayname'
|
||||
attribute :domain_id, :aliases => 'domainid'
|
||||
attribute :host_id, :aliases => 'hostid'
|
||||
attribute :host_name, :aliases => 'hostname'
|
||||
attribute :project_id, :aliases => 'projectid'
|
||||
attribute :zone_id, :aliases => 'zoneid'
|
||||
attribute :zone_name, :aliases => 'zonename'
|
||||
attribute :image_id, :aliases => ['templateid', :template_id]
|
||||
attribute :image_name, :aliases => ['templatename', :template_name]
|
||||
attribute :templated_display_text, :aliases => 'templatedisplaytext'
|
||||
attribute :password_enabled, :aliases => 'passwordenabled'
|
||||
attribute :flavor_id, :aliases => ['serviceofferingid', :service_offering_id]
|
||||
attribute :flavor_name, :aliases => ['serviceofferingname', :service_offering_name]
|
||||
attribute :cpu_number, :aliases => 'cpunumber'
|
||||
attribute :cpu_speed, :aliases => 'cpuspeed'
|
||||
attribute :cpu_used, :aliases => 'cpuused'
|
||||
attribute :network_kbs_read, :aliases => 'networkkbsread'
|
||||
attribute :network_kbs_write, :aliases => 'networkkbswrite'
|
||||
attribute :guest_os_id, :aliases => 'guestosid'
|
||||
attribute :root_device_id, :aliases => 'rootdeviceid'
|
||||
attribute :root_device_type, :aliases => 'rootdevicetype'
|
||||
attribute :group
|
||||
attribute :key_name, :aliases => 'keypair'
|
||||
attribute :user_data, :aliases => 'userdata'
|
||||
attribute :security_group_list, :type => :array, :aliases => 'securitygroup'
|
||||
attribute :nics, :type => :array, :aliases => 'nic'
|
||||
attribute :job_id, :aliases => 'jobid' # only on create
|
||||
attribute :size, :type => :integer
|
||||
attribute :root_disk_size, :type => :integer
|
||||
|
||||
attr_accessor :network_ids, :disk_offering_id, :ip_address, :ip_to_network_list
|
||||
attr_writer :security_group_ids
|
||||
|
||||
alias_method :public_ip_address, :ip_address
|
||||
alias_method :public_ip_address=, :ip_address=
|
||||
|
||||
def addresses
|
||||
nics.map{|nic| Address.new(nic)}
|
||||
end
|
||||
|
||||
def ip_addresses
|
||||
addresses.map(&:ip_address)
|
||||
end
|
||||
|
||||
def volumes
|
||||
requires :id
|
||||
service.volumes.all('virtualmachineid' => id)
|
||||
end
|
||||
|
||||
def reset_password
|
||||
requires :id
|
||||
data = service.reset_password_for_virtual_machine(id)
|
||||
service.jobs.new(data['resetpasswordforvirtualmachineresponse'])
|
||||
end
|
||||
|
||||
def public_ip_addresses
|
||||
if public_ip_address.nil? then [public_ip_address] else [] end
|
||||
end
|
||||
|
||||
def private_ip_addresses
|
||||
ip_addresses - public_ip_addresses
|
||||
end
|
||||
|
||||
def private_ip_address
|
||||
private_ip_addresses.first
|
||||
end
|
||||
|
||||
def destroy(options={})
|
||||
requires :id
|
||||
data = service.destroy_virtual_machine(options.merge({'id'=> self.id}))
|
||||
service.jobs.new(data["destroyvirtualmachineresponse"])
|
||||
end
|
||||
|
||||
def flavor
|
||||
service.flavors.get(self.flavor_id)
|
||||
end
|
||||
|
||||
def ready?
|
||||
state == 'Running'
|
||||
end
|
||||
|
||||
def reboot
|
||||
requires :id
|
||||
data = service.reboot_virtual_machine('id' => self.id) # FIXME: does this ever fail?
|
||||
service.jobs.new(data["rebootvirtualmachineresponse"])
|
||||
end
|
||||
|
||||
def security_groups=(security_groups)
|
||||
self.security_group_ids= Array(security_groups).map(&:id)
|
||||
end
|
||||
|
||||
def security_group_ids
|
||||
@security_group_ids || (self.security_group_list || []).map{|sg| sg["id"]}
|
||||
end
|
||||
|
||||
def security_groups
|
||||
security_group_ids.map{|id| service.security_groups.get(id)}
|
||||
end
|
||||
|
||||
def save
|
||||
requires :image_id, :flavor_id, :zone_id
|
||||
|
||||
options = {
|
||||
'templateid' => image_id,
|
||||
'serviceofferingid' => flavor_id,
|
||||
'zoneid' => zone_id,
|
||||
'networkids' => network_ids,
|
||||
'diskofferingid' => disk_offering_id,
|
||||
'name' => name,
|
||||
'displayname' => display_name,
|
||||
'group' => group,
|
||||
'domainid' => domain_id,
|
||||
'hostid' => host_id,
|
||||
'ipaddress' => ip_address,
|
||||
'iptonetworklist' => ip_to_network_list,
|
||||
'projectid' => project_id,
|
||||
'keypair' => key_name,
|
||||
'userdata' => user_data,
|
||||
'size' => size,
|
||||
}
|
||||
|
||||
options.merge!('rootdisksize' => root_disk_size) if root_disk_size
|
||||
options.merge!('networkids' => network_ids) if network_ids
|
||||
options.merge!('securitygroupids' => security_group_ids) unless security_group_ids.empty?
|
||||
|
||||
data = service.deploy_virtual_machine(options)
|
||||
merge_attributes(data['deployvirtualmachineresponse'])
|
||||
end
|
||||
|
||||
def start
|
||||
requires :id
|
||||
data = service.start_virtual_machine("id" => self.id)
|
||||
service.jobs.new(data["startvirtualmachineresponse"])
|
||||
end
|
||||
|
||||
def stop(options={})
|
||||
requires :id
|
||||
unless options.is_a?(Hash)
|
||||
Fog::Logger.deprecation("Passing force as a boolean option has been deprecated. Please pass a hash with 'force' => (true|false)")
|
||||
options = {'force' => options}
|
||||
end
|
||||
data = service.stop_virtual_machine(options.merge({'id' => self.id}))
|
||||
service.jobs.new(data["stopvirtualmachineresponse"])
|
||||
end
|
||||
end # Server
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,39 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/server'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Servers < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::Server
|
||||
|
||||
def all(attributes={})
|
||||
# add project id if we have one
|
||||
response = service.list_virtual_machines(attributes)
|
||||
data = response["listvirtualmachinesresponse"]["virtualmachine"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def bootstrap(new_attributes = {})
|
||||
server = create(new_attributes)
|
||||
server.wait_for { ready? }
|
||||
server
|
||||
end
|
||||
|
||||
def get(server_id)
|
||||
attributes = {'id' => server_id}
|
||||
# add project id if we have one
|
||||
servers = service.list_virtual_machines(attributes)["listvirtualmachinesresponse"]["virtualmachine"]
|
||||
if servers.nil? || servers.empty?
|
||||
servers = service.list_virtual_machines('id' => server_id, 'projectid' => '-1')["listvirtualmachinesresponse"]["virtualmachine"]
|
||||
end
|
||||
unless servers.nil? || servers.empty?
|
||||
new(servers.first)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,46 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Snapshot < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
|
||||
attribute :name, :aliases => 'name'
|
||||
attribute :volume_type, :aliases => 'volumetype'
|
||||
attribute :volume_name, :aliases => 'volumename'
|
||||
attribute :volume_id, :aliases => 'volumeid'
|
||||
attribute :created, :aliases => 'created'
|
||||
attribute :state, :aliases => 'state'
|
||||
attribute :account, :aliases => 'account'
|
||||
attribute :domain_id, :aliases => 'domainid'
|
||||
attribute :domain, :aliases => 'domain'
|
||||
attribute :snapshot_type, :aliases => 'snapshot_type'
|
||||
attribute :interval_type, :aliases => 'interval_type'
|
||||
|
||||
def save
|
||||
requires :volume_id
|
||||
|
||||
options = {
|
||||
'volumeid' => volume_id,
|
||||
'domainid' => domain_id
|
||||
}
|
||||
data = service.create_snapshot(options)
|
||||
merge_attributes(data['createsnapshotresponse'])
|
||||
end
|
||||
|
||||
def ready?
|
||||
state == 'BackedUp'
|
||||
end
|
||||
|
||||
def volume
|
||||
service.volumes.get(volume_id) if volume_id
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
service.delete_snapshot('id' => id)
|
||||
true
|
||||
end
|
||||
end # Snapshot
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,23 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/snapshot'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Snapshots < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::Snapshot
|
||||
|
||||
def all(attributes = {})
|
||||
response = service.list_snapshots(attributes)
|
||||
data = response["listsnapshotsresponse"]["snapshot"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(snapshot_id)
|
||||
snapshot = service.list_snapshots('id' => snapshot_id)["listsnapshotsresponse"]["snapshot"].first
|
||||
new(snapshot) if snapshot
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,121 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Volume < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
|
||||
attribute :name, :aliases => 'name'
|
||||
attribute :zone_id, :aliases => 'zoneid'
|
||||
attribute :zone_name, :aliases => 'zonename'
|
||||
attribute :type, :aliases => 'type'
|
||||
attribute :size, :aliases => 'size'
|
||||
attribute :created, :aliases => 'created'
|
||||
attribute :state, :aliases => 'state'
|
||||
attribute :account, :aliases => 'account'
|
||||
attribute :domain_id, :aliases => 'domainid'
|
||||
attribute :domain, :aliases => 'domain'
|
||||
attribute :storage_type, :aliases => 'storagetype'
|
||||
attribute :hypervisor, :aliases => 'hypervisor'
|
||||
attribute :disk_offering_id, :aliases => 'diskofferingid'
|
||||
attribute :disk_offering_name, :aliases => 'diskofferingname'
|
||||
attribute :disk_offering_display_text, :aliases => 'diskofferingdisplaytext'
|
||||
attribute :storage, :aliases => 'storage'
|
||||
attribute :destroyed, :aliases => 'destroyed'
|
||||
attribute :is_extractable, :aliases => 'isextractable', :type => :boolean
|
||||
attribute :server_id, :aliases => 'virtualmachineid'
|
||||
attribute :server_name, :aliases => 'vmname'
|
||||
attribute :server_display_name, :aliases => 'vmdisplayname'
|
||||
attribute :job_id, :aliases => 'jobid' # only on create
|
||||
|
||||
attr_accessor :snapshot_id, :project_id
|
||||
|
||||
def save
|
||||
requires :name, :disk_offering_id, :zone_id
|
||||
|
||||
options = {
|
||||
'size' => size,
|
||||
'name' => name,
|
||||
'diskofferingid' => disk_offering_id,
|
||||
'zoneid' => zone_id,
|
||||
'snapshotid' => snapshot_id,
|
||||
'projectid' => project_id
|
||||
}
|
||||
|
||||
data = service.create_volume(options)
|
||||
merge_attributes(data['createvolumeresponse'])
|
||||
end
|
||||
|
||||
def ready?
|
||||
state == 'Allocated' || state == 'Ready'
|
||||
end
|
||||
|
||||
def flavor
|
||||
service.disk_offerings.get(self.disk_offering_id)
|
||||
end
|
||||
alias_method :disk_offering, :flavor
|
||||
|
||||
def server
|
||||
if server_id
|
||||
service.servers.get(server_id)
|
||||
end
|
||||
end
|
||||
|
||||
def snapshots
|
||||
requires :id
|
||||
service.snapshots.all('volumeid' => id)
|
||||
end
|
||||
|
||||
def reload
|
||||
requires :identity
|
||||
|
||||
return unless data = begin
|
||||
collection.get(identity)
|
||||
rescue Excon::Errors::SocketError
|
||||
nil
|
||||
end
|
||||
|
||||
new_attributes = {
|
||||
'virtualmachineid' => nil,
|
||||
'vmname' => nil,
|
||||
'vmdisplayname' => nil
|
||||
}.merge(data.attributes)
|
||||
|
||||
merge_attributes(new_attributes)
|
||||
self
|
||||
end
|
||||
|
||||
def attach(instance_or_id, mountpoint=nil)
|
||||
requires :id
|
||||
instance_id = instance_or_id.is_a?(Server) ? instance_or_id.id : instance_or_id
|
||||
unless instance_id
|
||||
raise ArgumentError, "Missing required argument: instance_or_id"
|
||||
end
|
||||
|
||||
options = {
|
||||
'id' => id,
|
||||
'virtualmachineid' => instance_id,
|
||||
}
|
||||
options.merge!('deviceid' => mountpoint) if mountpoint
|
||||
|
||||
data = service.attach_volume(options)
|
||||
|
||||
service.jobs.new(data["attachvolumeresponse"])
|
||||
end
|
||||
|
||||
def detach
|
||||
requires :id
|
||||
|
||||
data = service.detach_volume('id' => id)
|
||||
|
||||
service.jobs.new(data["detachvolumeresponse"])
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
service.delete_volume('id' => id)
|
||||
true
|
||||
end
|
||||
end # Volume
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,26 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/volume'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Volumes < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::Volume
|
||||
|
||||
def all(attributes = {})
|
||||
response = service.list_volumes(attributes)
|
||||
data = response["listvolumesresponse"]["volume"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(volume_id)
|
||||
if volume = service.list_volumes('id' => volume_id)["listvolumesresponse"]["volume"].first
|
||||
new(volume)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,38 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Zone < Fog::Model
|
||||
identity :id, :aliases => 'id'
|
||||
attribute :name
|
||||
attribute :domain_id, :aliases => 'domainid'
|
||||
attribute :domain_name, :aliases => ['domainname', 'domain']
|
||||
attribute :network_type, :aliases => 'networktype'
|
||||
attribute :security_groups_enabled, :aliases => ['securitygroupsenabled', 'securitygroupenabled']
|
||||
attribute :allocation_state, :aliases => 'allocationstate'
|
||||
attribute :zone_token, :aliases => 'zonetoken'
|
||||
attribute :dhcp_provider, :aliases => 'dhcpprovider'
|
||||
|
||||
attr_accessor :dns1, :dns2, :internaldns1, :internaldns2, :guest_cidr_address
|
||||
|
||||
def save
|
||||
options = {
|
||||
'dns1' => dns1,
|
||||
'internaldns1' => internaldns1,
|
||||
'name' => name,
|
||||
'networktype' => network_type,
|
||||
'allocationstate' => allocation_state,
|
||||
'dns2' => dns2,
|
||||
'domain' => domain_name,
|
||||
'domainid' => domain_id,
|
||||
'guestcidraddress' => guest_cidr_address,
|
||||
'internaldns2' => internaldns2,
|
||||
'securitygroupenabled' => security_groups_enabled,
|
||||
}
|
||||
data = service.create_zone(options)
|
||||
merge_attributes(data['createzoneresponse'])
|
||||
end
|
||||
|
||||
end # Zone
|
||||
end # Cloudstack
|
||||
end # Compute
|
||||
end # Fog
|
|
@ -1,29 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudstack/models/compute/zone'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Zones < Fog::Collection
|
||||
model Fog::Compute::Cloudstack::Zone
|
||||
|
||||
def all(filters={})
|
||||
options = {
|
||||
'templatefilter' => 'self'
|
||||
}.merge(filters)
|
||||
|
||||
data = service.list_zones(options)["listzonesresponse"]["zone"] || []
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(zone_id)
|
||||
if zone = service.list_zones('id' => zone_id)["listzonesresponse"]["zone"].first
|
||||
new(zone)
|
||||
end
|
||||
rescue Fog::Compute::Cloudstack::BadRequest
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
class Real
|
||||
# Creates an account.
|
||||
#
|
||||
# {CloudStack API Reference}[http://download.cloud.com/releases/2.2.0/api_2.2.4/global_admin/associateIpAddress.html]
|
||||
def acquire_ip_address(options={})
|
||||
options.merge!(
|
||||
'command' => 'associateIpAddress'
|
||||
)
|
||||
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Activates a project
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/activateProject.html]
|
||||
def activate_project(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'activateProject')
|
||||
else
|
||||
options.merge!('command' => 'activateProject',
|
||||
'id' => args[0])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds acoount to a project
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addAccountToProject.html]
|
||||
def add_account_to_project(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addAccountToProject')
|
||||
else
|
||||
options.merge!('command' => 'addAccountToProject',
|
||||
'projectid' => args[0])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# adds a baremetal dhcp server
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addBaremetalDhcp.html]
|
||||
def add_baremetal_dhcp(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addBaremetalDhcp')
|
||||
else
|
||||
options.merge!('command' => 'addBaremetalDhcp',
|
||||
'dhcpservertype' => args[0],
|
||||
'username' => args[1],
|
||||
'url' => args[2],
|
||||
'physicalnetworkid' => args[3],
|
||||
'password' => args[4])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# add a baremetal host
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addBaremetalHost.html]
|
||||
def add_baremetal_host(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addBaremetalHost')
|
||||
else
|
||||
options.merge!('command' => 'addBaremetalHost',
|
||||
'podid' => args[0],
|
||||
'url' => args[1],
|
||||
'hypervisor' => args[2],
|
||||
'username' => args[3],
|
||||
'zoneid' => args[4],
|
||||
'password' => args[5])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# add a baremetal pxe server
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addBaremetalPxeKickStartServer.html]
|
||||
def add_baremetal_pxe_kick_start_server(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addBaremetalPxeKickStartServer')
|
||||
else
|
||||
options.merge!('command' => 'addBaremetalPxeKickStartServer',
|
||||
'url' => args[0],
|
||||
'username' => args[1],
|
||||
'tftpdir' => args[2],
|
||||
'pxeservertype' => args[3],
|
||||
'password' => args[4],
|
||||
'physicalnetworkid' => args[5])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# add a baremetal ping pxe server
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addBaremetalPxePingServer.html]
|
||||
def add_baremetal_pxe_ping_server(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addBaremetalPxePingServer')
|
||||
else
|
||||
options.merge!('command' => 'addBaremetalPxePingServer',
|
||||
'physicalnetworkid' => args[0],
|
||||
'pxeservertype' => args[1],
|
||||
'pingstorageserverip' => args[2],
|
||||
'url' => args[3],
|
||||
'tftpdir' => args[4],
|
||||
'password' => args[5],
|
||||
'pingdir' => args[6],
|
||||
'username' => args[7])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a BigSwitch VNS device
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addBigSwitchVnsDevice.html]
|
||||
def add_big_switch_vns_device(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addBigSwitchVnsDevice')
|
||||
else
|
||||
options.merge!('command' => 'addBigSwitchVnsDevice',
|
||||
'hostname' => args[0],
|
||||
'physicalnetworkid' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a Cisco Asa 1000v appliance
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addCiscoAsa1000vResource.html]
|
||||
def add_cisco_asa1000v_resource(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addCiscoAsa1000vResource')
|
||||
else
|
||||
options.merge!('command' => 'addCiscoAsa1000vResource',
|
||||
'hostname' => args[0],
|
||||
'physicalnetworkid' => args[1],
|
||||
'insideportprofile' => args[2],
|
||||
'clusterid' => args[3])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a Cisco Vnmc Controller
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addCiscoVnmcResource.html]
|
||||
def add_cisco_vnmc_resource(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addCiscoVnmcResource')
|
||||
else
|
||||
options.merge!('command' => 'addCiscoVnmcResource',
|
||||
'username' => args[0],
|
||||
'hostname' => args[1],
|
||||
'password' => args[2],
|
||||
'physicalnetworkid' => args[3])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a new cluster
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addCluster.html]
|
||||
def add_cluster(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addCluster')
|
||||
else
|
||||
options.merge!('command' => 'addCluster',
|
||||
'clustertype' => args[0],
|
||||
'hypervisor' => args[1],
|
||||
'clustername' => args[2],
|
||||
'podid' => args[3],
|
||||
'zoneid' => args[4])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds an external firewall appliance
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addExternalFirewall.html]
|
||||
def add_external_firewall(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addExternalFirewall')
|
||||
else
|
||||
options.merge!('command' => 'addExternalFirewall',
|
||||
'url' => args[0],
|
||||
'username' => args[1],
|
||||
'password' => args[2],
|
||||
'zoneid' => args[3])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds F5 external load balancer appliance.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addExternalLoadBalancer.html]
|
||||
def add_external_load_balancer(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addExternalLoadBalancer')
|
||||
else
|
||||
options.merge!('command' => 'addExternalLoadBalancer',
|
||||
'zoneid' => args[0],
|
||||
'url' => args[1],
|
||||
'password' => args[2],
|
||||
'username' => args[3])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a F5 BigIP load balancer device
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addF5LoadBalancer.html]
|
||||
def add_f5_load_balancer(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addF5LoadBalancer')
|
||||
else
|
||||
options.merge!('command' => 'addF5LoadBalancer',
|
||||
'password' => args[0],
|
||||
'physicalnetworkid' => args[1],
|
||||
'networkdevicetype' => args[2],
|
||||
'username' => args[3],
|
||||
'url' => args[4])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Add a new guest OS type
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addGuestOs.html]
|
||||
def add_guest_os(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addGuestOs')
|
||||
else
|
||||
options.merge!('command' => 'addGuestOs',
|
||||
'osdisplayname' => args[0],
|
||||
'oscategoryid' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a guest OS name to hypervisor OS name mapping
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addGuestOsMapping.html]
|
||||
def add_guest_os_mapping(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addGuestOsMapping')
|
||||
else
|
||||
options.merge!('command' => 'addGuestOsMapping',
|
||||
'hypervisor' => args[0],
|
||||
'osnameforhypervisor' => args[1],
|
||||
'hypervisorversion' => args[2])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a new host.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addHost.html]
|
||||
def add_host(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addHost')
|
||||
else
|
||||
options.merge!('command' => 'addHost',
|
||||
'url' => args[0],
|
||||
'zoneid' => args[1],
|
||||
'username' => args[2],
|
||||
'password' => args[3],
|
||||
'hypervisor' => args[4],
|
||||
'podid' => args[5])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds backup image store.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addImageStore.html]
|
||||
def add_image_store(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addImageStore')
|
||||
else
|
||||
options.merge!('command' => 'addImageStore',
|
||||
'provider' => args[0])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Assigns secondary IP to NIC
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addIpToNic.html]
|
||||
def add_ip_to_nic(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addIpToNic')
|
||||
else
|
||||
options.merge!('command' => 'addIpToNic',
|
||||
'nicid' => args[0])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Add a new Ldap Configuration
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addLdapConfiguration.html]
|
||||
def add_ldap_configuration(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addLdapConfiguration')
|
||||
else
|
||||
options.merge!('command' => 'addLdapConfiguration',
|
||||
'port' => args[0],
|
||||
'hostname' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a netscaler load balancer device
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addNetscalerLoadBalancer.html]
|
||||
def add_netscaler_load_balancer(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addNetscalerLoadBalancer')
|
||||
else
|
||||
options.merge!('command' => 'addNetscalerLoadBalancer',
|
||||
'username' => args[0],
|
||||
'networkdevicetype' => args[1],
|
||||
'password' => args[2],
|
||||
'physicalnetworkid' => args[3],
|
||||
'url' => args[4])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addNetworkDevice.html]
|
||||
def add_network_device(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addNetworkDevice')
|
||||
else
|
||||
options.merge!('command' => 'addNetworkDevice')
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a network serviceProvider to a physical network
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addNetworkServiceProvider.html]
|
||||
def add_network_service_provider(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addNetworkServiceProvider')
|
||||
else
|
||||
options.merge!('command' => 'addNetworkServiceProvider',
|
||||
'name' => args[0],
|
||||
'physicalnetworkid' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds VM to specified network by creating a NIC
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addNicToVirtualMachine.html]
|
||||
def add_nic_to_virtual_machine(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addNicToVirtualMachine')
|
||||
else
|
||||
options.merge!('command' => 'addNicToVirtualMachine',
|
||||
'virtualmachineid' => args[0],
|
||||
'networkid' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a Nicira NVP device
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addNiciraNvpDevice.html]
|
||||
def add_nicira_nvp_device(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addNiciraNvpDevice')
|
||||
else
|
||||
options.merge!('command' => 'addNiciraNvpDevice',
|
||||
'physicalnetworkid' => args[0],
|
||||
'transportzoneuuid' => args[1],
|
||||
'username' => args[2],
|
||||
'password' => args[3],
|
||||
'hostname' => args[4])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds an OpenDyalight controler
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addOpenDaylightController.html]
|
||||
def add_open_daylight_controller(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addOpenDaylightController')
|
||||
else
|
||||
options.merge!('command' => 'addOpenDaylightController',
|
||||
'physicalnetworkid' => args[0],
|
||||
'url' => args[1],
|
||||
'password' => args[2],
|
||||
'username' => args[3])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a Palo Alto firewall device
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addPaloAltoFirewall.html]
|
||||
def add_palo_alto_firewall(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addPaloAltoFirewall')
|
||||
else
|
||||
options.merge!('command' => 'addPaloAltoFirewall',
|
||||
'username' => args[0],
|
||||
'networkdevicetype' => args[1],
|
||||
'password' => args[2],
|
||||
'physicalnetworkid' => args[3],
|
||||
'url' => args[4])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a Region
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addRegion.html]
|
||||
def add_region(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addRegion')
|
||||
else
|
||||
options.merge!('command' => 'addRegion',
|
||||
'id' => args[0],
|
||||
'name' => args[1],
|
||||
'endpoint' => args[2])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds detail for the Resource.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addResourceDetail.html]
|
||||
def add_resource_detail(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addResourceDetail')
|
||||
else
|
||||
options.merge!('command' => 'addResourceDetail',
|
||||
'resourcetype' => args[0],
|
||||
'details' => args[1],
|
||||
'resourceid' => args[2])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds S3
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addS3.html]
|
||||
def add_s3(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addS3')
|
||||
else
|
||||
options.merge!('command' => 'addS3',
|
||||
'accesskey' => args[0],
|
||||
'bucket' => args[1],
|
||||
'secretkey' => args[2])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds secondary storage.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addSecondaryStorage.html]
|
||||
def add_secondary_storage(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addSecondaryStorage')
|
||||
else
|
||||
options.merge!('command' => 'addSecondaryStorage',
|
||||
'url' => args[0])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a SRX firewall device
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addSrxFirewall.html]
|
||||
def add_srx_firewall(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addSrxFirewall')
|
||||
else
|
||||
options.merge!('command' => 'addSrxFirewall',
|
||||
'username' => args[0],
|
||||
'networkdevicetype' => args[1],
|
||||
'physicalnetworkid' => args[2],
|
||||
'password' => args[3],
|
||||
'url' => args[4])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds stratosphere ssp server
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addStratosphereSsp.html]
|
||||
def add_stratosphere_ssp(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addStratosphereSsp')
|
||||
else
|
||||
options.merge!('command' => 'addStratosphereSsp',
|
||||
'url' => args[0],
|
||||
'zoneid' => args[1],
|
||||
'name' => args[2])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds Swift.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addSwift.html]
|
||||
def add_swift(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addSwift')
|
||||
else
|
||||
options.merge!('command' => 'addSwift',
|
||||
'url' => args[0])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds Traffic Monitor Host for Direct Network Usage
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addTrafficMonitor.html]
|
||||
def add_traffic_monitor(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addTrafficMonitor')
|
||||
else
|
||||
options.merge!('command' => 'addTrafficMonitor',
|
||||
'zoneid' => args[0],
|
||||
'url' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds traffic type to a physical network
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addTrafficType.html]
|
||||
def add_traffic_type(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addTrafficType')
|
||||
else
|
||||
options.merge!('command' => 'addTrafficType',
|
||||
'traffictype' => args[0],
|
||||
'physicalnetworkid' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a Ucs manager
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addUcsManager.html]
|
||||
def add_ucs_manager(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addUcsManager')
|
||||
else
|
||||
options.merge!('command' => 'addUcsManager',
|
||||
'url' => args[0],
|
||||
'password' => args[1],
|
||||
'username' => args[2],
|
||||
'zoneid' => args[3])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds a VMware datacenter to specified zone
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addVmwareDc.html]
|
||||
def add_vmware_dc(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addVmwareDc')
|
||||
else
|
||||
options.merge!('command' => 'addVmwareDc',
|
||||
'zoneid' => args[0],
|
||||
'vcenter' => args[1],
|
||||
'name' => args[2])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Adds vpn users
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/addVpnUser.html]
|
||||
def add_vpn_user(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'addVpnUser')
|
||||
else
|
||||
options.merge!('command' => 'addVpnUser',
|
||||
'password' => args[0],
|
||||
'username' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Archive one or more alerts.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/archiveAlerts.html]
|
||||
def archive_alerts(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'archiveAlerts')
|
||||
else
|
||||
options.merge!('command' => 'archiveAlerts')
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Archive one or more events.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/archiveEvents.html]
|
||||
def archive_events(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'archiveEvents')
|
||||
else
|
||||
options.merge!('command' => 'archiveEvents')
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Assigns a certificate to a Load Balancer Rule
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/assignCertToLoadBalancer.html]
|
||||
def assign_cert_to_load_balancer(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'assignCertToLoadBalancer')
|
||||
else
|
||||
options.merge!('command' => 'assignCertToLoadBalancer',
|
||||
'lbruleid' => args[0],
|
||||
'certid' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Assign load balancer rule or list of load balancer rules to a global load balancer rules.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/assignToGlobalLoadBalancerRule.html]
|
||||
def assign_to_global_load_balancer_rule(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'assignToGlobalLoadBalancerRule')
|
||||
else
|
||||
options.merge!('command' => 'assignToGlobalLoadBalancerRule',
|
||||
'id' => args[0],
|
||||
'loadbalancerrulelist' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Assigns virtual machine or a list of virtual machines to a load balancer rule.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/assignToLoadBalancerRule.html]
|
||||
def assign_to_load_balancer_rule(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'assignToLoadBalancerRule')
|
||||
else
|
||||
options.merge!('command' => 'assignToLoadBalancerRule',
|
||||
'id' => args[0])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Change ownership of a VM from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign a VM from any account to any other account in any domain. A domain administrator can reassign a VM to any account in the same domain.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/assignVirtualMachine.html]
|
||||
def assign_virtual_machine(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'assignVirtualMachine')
|
||||
else
|
||||
options.merge!('command' => 'assignVirtualMachine',
|
||||
'account' => args[0],
|
||||
'virtualmachineid' => args[1],
|
||||
'domainid' => args[2])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Acquires and associates a public IP to an account.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/associateIpAddress.html]
|
||||
def associate_ip_address(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'associateIpAddress')
|
||||
else
|
||||
options.merge!('command' => 'associateIpAddress')
|
||||
end
|
||||
# add project id if we have one
|
||||
@cloudstack_project_id ? options.merge!('projectid' => @cloudstack_project_id) : nil
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def associate_ip_address(*args)
|
||||
public_ip_address_id = Fog::Cloudstack.uuid
|
||||
public_ip_address = {
|
||||
"id" => public_ip_address_id,
|
||||
"ipaddress" => "192.168.200.3",
|
||||
"allocated" => "2014-12-22T22:32:39+0000",
|
||||
"zoneid" => "0e276270-7950-4483-bf21-3dc897dbe08a",
|
||||
"zonename" => "Toronto",
|
||||
"issourcenat" => false,
|
||||
"projectid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"project" => "TestProject",
|
||||
"domainid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"domain" => "TestDomain",
|
||||
"forvirtualnetwork" => true,
|
||||
"isstaticnat" => false,
|
||||
"issystem" => false,
|
||||
"associatednetworkid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"associatednetworkname" => "TestNetwork",
|
||||
"networkid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"state" => "Allocated",
|
||||
"physicalnetworkid" => "f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"tags" => []
|
||||
|
||||
}
|
||||
self.data[:public_ip_addresses][public_ip_address_id]= public_ip_address
|
||||
{'associateipaddressresponse' => public_ip_address}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Associate a LUN with a guest IQN
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.3/root_admin/associateLun.html]
|
||||
def associate_lun(iqn, name, options={})
|
||||
options.merge!(
|
||||
'command' => 'associateLun',
|
||||
'iqn' => iqn,
|
||||
'name' => name
|
||||
)
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# associate a profile to a blade
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/associateUcsProfileToBlade.html]
|
||||
def associate_ucs_profile_to_blade(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'associateUcsProfileToBlade')
|
||||
else
|
||||
options.merge!('command' => 'associateUcsProfileToBlade',
|
||||
'profiledn' => args[0],
|
||||
'ucsmanagerid' => args[1],
|
||||
'bladeid' => args[2])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Attaches an ISO to a virtual machine.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/attachIso.html]
|
||||
def attach_iso(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'attachIso')
|
||||
else
|
||||
options.merge!('command' => 'attachIso',
|
||||
'virtualmachineid' => args[0],
|
||||
'id' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Attaches a disk volume to a virtual machine.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/attachVolume.html]
|
||||
def attach_volume(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'attachVolume')
|
||||
else
|
||||
options.merge!('command' => 'attachVolume',
|
||||
'virtualmachineid' => args[0],
|
||||
'id' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def attach_volume(options={})
|
||||
volume_id = options['id']
|
||||
server_id = options['virtualmachineid']
|
||||
|
||||
volume = self.data[:volumes][volume_id]
|
||||
unless volume
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new("Unable to execute API command attachvolume due to invalid value. Object volumes(uuid: #{volume_id}) does not exist.")
|
||||
end
|
||||
|
||||
server = self.data[:servers][server_id]
|
||||
unless server
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new("Unable to execute API command attachvolume due to invalid value. Object vm_instance(uuid: #{server_id}) does not exist.")
|
||||
end
|
||||
|
||||
volume['virtualmachineid']= server['id']
|
||||
volume['vmname']= server['name']
|
||||
volume['vmdisplayname']= server['displayname']
|
||||
|
||||
job_id = Fog::Cloudstack.uuid
|
||||
|
||||
# FIXME: need to determine current user
|
||||
account_id = self.data[:accounts].first
|
||||
user_id = self.data[:users].first
|
||||
|
||||
job = {
|
||||
"accountid" => account_id,
|
||||
"userid" => user_id,
|
||||
"cmd" => "com.cloud.api.commands.AttachVolumeCmd",
|
||||
"created" => Time.now.iso8601,
|
||||
"jobid" => job_id,
|
||||
"jobstatus" => 1,
|
||||
"jobprocstatus" => 0,
|
||||
"jobresultcode" => 0,
|
||||
"jobresulttype" => "object",
|
||||
"jobresult" =>
|
||||
{"volume" => volume}
|
||||
}
|
||||
|
||||
self.data[:jobs][job_id]= job
|
||||
|
||||
{
|
||||
"attachvolumeresponse" => {
|
||||
"jobid" => job_id
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Authorizes a particular egress rule for this security group
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/authorizeSecurityGroupEgress.html]
|
||||
def authorize_security_group_egress(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'authorizeSecurityGroupEgress')
|
||||
else
|
||||
options.merge!('command' => 'authorizeSecurityGroupEgress')
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def authorize_security_group_egress(options={})
|
||||
security_group_id = options['securitygroupid']
|
||||
security_group_rule_id = Fog::Cloudstack.uuid
|
||||
|
||||
unless cidr = options['cidrlist']
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter cidr')
|
||||
end
|
||||
|
||||
unless start_port = options['startport']
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter start_port')
|
||||
end
|
||||
|
||||
unless end_port = options['endport']
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter end_port')
|
||||
end
|
||||
|
||||
unless protocol = options['protocol']
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter protocol')
|
||||
end
|
||||
|
||||
rule = {
|
||||
"ruleid" => security_group_rule_id,
|
||||
"cidr" => cidr,
|
||||
"startport" => start_port,
|
||||
"endport" => end_port,
|
||||
"protocol" => protocol
|
||||
}
|
||||
|
||||
unless security_group = self.data[:security_groups][security_group_id]
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new("Security group id #{security_group_id} does not exist")
|
||||
end
|
||||
|
||||
security_group["egressrule"] ||= []
|
||||
security_group["egressrule"] << rule
|
||||
|
||||
job_id = Fog::Cloudstack.uuid
|
||||
job = {
|
||||
"cmd" => "com.cloud.api.commands.authorizeSecurityGroupEgress",
|
||||
"created" => Time.now.iso8601,
|
||||
"jobid" => job_id,
|
||||
"jobstatus" => 1,
|
||||
"jobprocstatus" => 0,
|
||||
"jobresultcode" => 0,
|
||||
"jobresulttype" => "object",
|
||||
"jobresult" => { "securitygroup" => security_group }
|
||||
}
|
||||
|
||||
self.data[:jobs][job_id]= job
|
||||
|
||||
{ "authorizesecuritygroupegressresponse" => { "jobid" => job_id } }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Authorizes a particular ingress rule for this security group
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/authorizeSecurityGroupIngress.html]
|
||||
def authorize_security_group_ingress(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'authorizeSecurityGroupIngress')
|
||||
else
|
||||
options.merge!('command' => 'authorizeSecurityGroupIngress')
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def authorize_security_group_ingress(options={})
|
||||
security_group_id = options['securitygroupid']
|
||||
security_group_rule_id = Fog::Cloudstack.uuid
|
||||
|
||||
unless cidr = options['cidrlist']
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter cidr')
|
||||
end
|
||||
|
||||
unless start_port = options['startport']
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter start_port')
|
||||
end
|
||||
|
||||
unless end_port = options['endport']
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter end_port')
|
||||
end
|
||||
|
||||
unless protocol = options['protocol']
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter protocol')
|
||||
end
|
||||
|
||||
rule = {
|
||||
"ruleid" => security_group_rule_id,
|
||||
"cidr" => cidr,
|
||||
"startport" => start_port,
|
||||
"endport" => end_port,
|
||||
"protocol" => protocol
|
||||
}
|
||||
|
||||
unless security_group = self.data[:security_groups][security_group_id]
|
||||
raise Fog::Compute::Cloudstack::BadRequest.new("Security group id #{security_group_id} does not exist")
|
||||
end
|
||||
|
||||
security_group["ingressrule"] ||= []
|
||||
security_group["ingressrule"] << rule
|
||||
|
||||
job_id = Fog::Cloudstack.uuid
|
||||
job = {
|
||||
"cmd" => "com.cloud.api.commands.authorizeSecurityGroupIngress",
|
||||
"created" => Time.now.iso8601,
|
||||
"jobid" => job_id,
|
||||
"jobstatus" => 1,
|
||||
"jobprocstatus" => 0,
|
||||
"jobresultcode" => 0,
|
||||
"jobresulttype" => "object",
|
||||
"jobresult" => { "securitygroup" => security_group }
|
||||
}
|
||||
|
||||
self.data[:jobs][job_id]= job
|
||||
|
||||
{ "authorizesecuritygroupingressresponse" => { "jobid" => job_id } }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Cancels host maintenance.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/cancelHostMaintenance.html]
|
||||
def cancel_host_maintenance(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'cancelHostMaintenance')
|
||||
else
|
||||
options.merge!('command' => 'cancelHostMaintenance',
|
||||
'id' => args[0])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Cancels maintenance for primary storage
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/cancelStorageMaintenance.html]
|
||||
def cancel_storage_maintenance(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'cancelStorageMaintenance')
|
||||
else
|
||||
options.merge!('command' => 'cancelStorageMaintenance',
|
||||
'id' => args[0])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Upgrades domain router to a new service offering
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/changeServiceForRouter.html]
|
||||
def change_service_for_router(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'changeServiceForRouter')
|
||||
else
|
||||
options.merge!('command' => 'changeServiceForRouter',
|
||||
'serviceofferingid' => args[0],
|
||||
'id' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Changes the service offering for a system vm (console proxy or secondary storage). The system vm must be in a "Stopped" state for this command to take effect.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/changeServiceForSystemVm.html]
|
||||
def change_service_for_system_vm(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'changeServiceForSystemVm')
|
||||
else
|
||||
options.merge!('command' => 'changeServiceForSystemVm',
|
||||
'id' => args[0],
|
||||
'serviceofferingid' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/changeServiceForVirtualMachine.html]
|
||||
def change_service_for_virtual_machine(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'changeServiceForVirtualMachine')
|
||||
else
|
||||
options.merge!('command' => 'changeServiceForVirtualMachine',
|
||||
'serviceofferingid' => args[0],
|
||||
'id' => args[1])
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Cloudstack
|
||||
|
||||
class Real
|
||||
# Cleanups VM reservations in the database.
|
||||
#
|
||||
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/cleanVMReservations.html]
|
||||
def clean_vmreservations(*args)
|
||||
options = {}
|
||||
if args[0].is_a? Hash
|
||||
options = args[0]
|
||||
options.merge!('command' => 'cleanVMReservations')
|
||||
else
|
||||
options.merge!('command' => 'cleanVMReservations')
|
||||
end
|
||||
request(options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue