-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudstack_sdk.rb
More file actions
121 lines (107 loc) · 3.6 KB
/
cloudstack_sdk.rb
File metadata and controls
121 lines (107 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
require 'rest_client'
require 'json'
require_relative 'utils/config'
require_relative 'api/config'
require_relative 'obsvr_helper/config'
require_relative 'model_helper/config'
require_relative 'model/config'
module CloudStack
class CloudStack
include AccountsApiHelper::Domain
include AccountsApiHelper::Account
include AccountsApiHelper::User
include InfraApiHelper::Zone
include InfraApiHelper::Pod
include InfraApiHelper::Cluster
include InfraApiHelper::Host
include InfraApiHelper::SystemVm
include InfraApiHelper::StoragePool
include NetworkApiHelper::Network
include NetworkApiHelper::TrafficType
include NetworkApiHelper::PhysicalNetwork
include ServiceOfferingApiHelper::DiskOffering
include ServiceOfferingApiHelper::ServiceOffering
include ServiceOfferingApiHelper::NetworkOffering
include Observable
include CloudStackObserver
include CloudStackMainHelper
include MainModelHelper
include AccountsObsvrHelper::Domain
include AccountsObsvrHelper::Account
include AccountsObsvrHelper::User
include InfraObsvrHelper::Zone
include InfraObsvrHelper::Network
include InfraObsvrHelper::Pod
include InfraObsvrHelper::Cluster
include InfraObsvrHelper::Host
# include NetworkObsvrHelper::Vlan
# include NetworkObsvrHelper::PhysicalNetwork
# include NetworkObsvrHelper::TrafficType
# include NetworkObsvrHelper::Network
# include NetworkObsvrHelper::NetworkServiceProvider
# include ServiceOfferingObsvrHelper::ServiceOffering
# include ServiceOfferingObsvrHelper::DiskOffering
# include ServiceOfferingObsvrHelper::NetworkOffering
# include InfraObsvrHelper::Zone
# include InfraObsvrHelper::Pod
# include InfraObsvrHelper::Cluster
# include InfraObsvrHelper::Host
# include InfraObsvrHelper::StoragePool
# include InfraObsvrHelper::SecondaryStorage
attr_reader :request_url,
:admin_request_url,
:root_admin,
:accounts,
:users,
:domains,
:network_offerings,
:disk_offerings,
:compute_offerings,
:system_offerings,
:zones,
:physical_networks,
:templates,
:pods,
:clusters,
:hosts,
:system_vms,
:networks,
:vlans,
:storage_pools,
:secondary_storages,
:cs_agent
def initialize(ip, port, i_port)
@agent = CloudStackAgent.instance
@logger = Logger.new('cloudstack.sdk.log')
@logger.level = Logger::WARN
@obsvr = EnvObserver.new(self)
@request_url = "http://#{ip}:#{port}/client/api"
@admin_request_url = "http://#{ip}:#{i_port}/client/api"
@domains = {}
@accounts = {}
@users = {}
@zones = {}
@pods = {}
@clusters = {}
@hosts = {}
@system_vms = {}
@networks = {}
@vlans = {}
@physical_networks = {}
@network_offerings = {}
@compute_offerings = {}
@system_offerings = {}
@storage_pools = {}
@secondary_storages = {}
@disk_offerings = {}
@storage_vlans = {}
@network_service_providers = {}
register_root_admin
self.add_observer @obsvr
@agent.api_url = "http://#{ip}:#{port}/client/api"
@agent.api_caller = @root_admin
@agent.response = "json"
update_env
end
end
end