heybulldog 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/heybulldog.rb +171 -0
- metadata +73 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 391185c4dd92d2f9272020dda308f8f0238a6318
|
|
4
|
+
data.tar.gz: d68b8049c0f155bde68646624a7137920d2bef86
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c7317091fc3617b3ce691f5e48bb4cce3fe21b04038154d1ef5f75b7df5945ffc30edda6d574081339223b5e2804386b1dcd860558222fc12d10bd3092f80fe3
|
|
7
|
+
data.tar.gz: d846335195e2e165493ccd2b9eeaebe081b82b75cc56e2ec7c7f2bbf9c3e38efb988b7116d1e08fc655e925e5b017541c83939aa2f29756e6d3e953de1cc4553
|
data/lib/heybulldog.rb
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'rest-client'
|
|
3
|
+
|
|
4
|
+
class Bulldog
|
|
5
|
+
attr_accessor :user_name, :password, :base_url, :verify_cert
|
|
6
|
+
|
|
7
|
+
def initialize(base_url,user_name,password,verify_cert)
|
|
8
|
+
@verify_cert = to_boolean(verify_cert)
|
|
9
|
+
@user_name = user_name
|
|
10
|
+
@password = password
|
|
11
|
+
@base_url = base_url
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def get_volumes
|
|
15
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
|
16
|
+
url: "#{@base_url}/api/json/types/volumes",
|
|
17
|
+
headers: {
|
|
18
|
+
accept: :json
|
|
19
|
+
},
|
|
20
|
+
verify_ssl: @verify_cert,
|
|
21
|
+
user: @user_name,
|
|
22
|
+
password: @password
|
|
23
|
+
))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def get_volume(vol_href)
|
|
27
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
|
28
|
+
url: vol_href,
|
|
29
|
+
headers: {
|
|
30
|
+
accept: :json
|
|
31
|
+
},
|
|
32
|
+
verify_ssl: @verify_cert,
|
|
33
|
+
user: @user_name,
|
|
34
|
+
password: @password
|
|
35
|
+
))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def get_volume_by_id(vol_id)
|
|
39
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
|
40
|
+
url: "#{@base_url}/api/json/types/volumes/#{vol_id}",
|
|
41
|
+
headers: {
|
|
42
|
+
accept: :json
|
|
43
|
+
},
|
|
44
|
+
verify_ssl: @verify_cert,
|
|
45
|
+
user: @user_name,
|
|
46
|
+
password: @password
|
|
47
|
+
))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def get_snapshot(snap_href)
|
|
51
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
|
52
|
+
url: snap_href,
|
|
53
|
+
headers: {
|
|
54
|
+
accept: :json
|
|
55
|
+
},
|
|
56
|
+
verify_ssl: @verify_cert,
|
|
57
|
+
user: @user_name,
|
|
58
|
+
password: @password
|
|
59
|
+
))
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def get_snapshots
|
|
63
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
|
64
|
+
url: "#{@base_url}/api/json/types/snapshots",
|
|
65
|
+
headers: {
|
|
66
|
+
accept: :json
|
|
67
|
+
},
|
|
68
|
+
verify_ssl: @verify_cert,
|
|
69
|
+
user: @user_name,
|
|
70
|
+
password: @password
|
|
71
|
+
))
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def create_snapshot(new_vol,anc_vol)
|
|
75
|
+
|
|
76
|
+
payload = {
|
|
77
|
+
:'ancestor-vol-id' => anc_vol,
|
|
78
|
+
:'snap-vol-name' => new_vol
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
|
82
|
+
url: "#{@base_url}/api/json/types/snapshots",
|
|
83
|
+
verify_ssl: @verify_cert,
|
|
84
|
+
payload: payload.to_json,
|
|
85
|
+
user: @user_name,
|
|
86
|
+
password: @password,
|
|
87
|
+
headers: {
|
|
88
|
+
content_type: 'application/json',
|
|
89
|
+
accept: :json
|
|
90
|
+
}))
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def delete_snapshot(snap_href)
|
|
94
|
+
RestClient::Request.execute(method: :delete,
|
|
95
|
+
url: snap_href,
|
|
96
|
+
verify_ssl: @verify_cert,
|
|
97
|
+
user: @user_name,
|
|
98
|
+
password: @password
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def get_initiator_groups
|
|
103
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
|
104
|
+
url: "#{@base_url}/api/json/types/initiator-groups",
|
|
105
|
+
headers: {
|
|
106
|
+
accept: :json
|
|
107
|
+
},
|
|
108
|
+
verify_ssl: @verify_cert,
|
|
109
|
+
user: @user_name,
|
|
110
|
+
password: @password
|
|
111
|
+
))
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def map_lun(vol_name,init_grp_name)
|
|
115
|
+
payload = {
|
|
116
|
+
:'vol-id' => vol_name,
|
|
117
|
+
:'ig-id' => init_grp_name
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
|
121
|
+
url: "#{@base_url}/api/json/types/lun-maps",
|
|
122
|
+
verify_ssl: @verify_cert,
|
|
123
|
+
payload: payload.to_json,
|
|
124
|
+
user: @user_name,
|
|
125
|
+
password: @password,
|
|
126
|
+
headers: {
|
|
127
|
+
content_type: 'application/json',
|
|
128
|
+
accept: :json
|
|
129
|
+
}))
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def get_target_groups
|
|
133
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
|
134
|
+
url: "#{@base_url}/api/json/types/target-groups",
|
|
135
|
+
headers: {
|
|
136
|
+
accept: :json
|
|
137
|
+
},
|
|
138
|
+
verify_ssl: @verify_cert,
|
|
139
|
+
user: @user_name,
|
|
140
|
+
password: @password
|
|
141
|
+
))
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def get_clusters
|
|
145
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
|
146
|
+
url: "#{@base_url}/api/json/types/clusters",
|
|
147
|
+
headers: {
|
|
148
|
+
accept: :json
|
|
149
|
+
},
|
|
150
|
+
verify_ssl: @verify_cert,
|
|
151
|
+
user: @user_name,
|
|
152
|
+
password: @password
|
|
153
|
+
))
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def get_cluster(cluster_href)
|
|
157
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
|
158
|
+
url: cluster_href,
|
|
159
|
+
headers: {
|
|
160
|
+
accept: :json
|
|
161
|
+
},
|
|
162
|
+
verify_ssl: @verify_cert,
|
|
163
|
+
user: @user_name,
|
|
164
|
+
password: @password
|
|
165
|
+
))
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def to_boolean(str)
|
|
169
|
+
str.to_s.downcase == "true"
|
|
170
|
+
end
|
|
171
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: heybulldog
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Craig J Smith
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-08-27 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: json
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.8'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.8'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rest-client
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 1.7.2
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 1.7.2
|
|
41
|
+
description: Abstraction of the XtremIO API
|
|
42
|
+
email: nctiggy@gmail.com
|
|
43
|
+
executables: []
|
|
44
|
+
extensions: []
|
|
45
|
+
extra_rdoc_files: []
|
|
46
|
+
files:
|
|
47
|
+
- lib/heybulldog.rb
|
|
48
|
+
homepage: https://github.com/nctiggy/bulldog
|
|
49
|
+
licenses:
|
|
50
|
+
- MIT
|
|
51
|
+
metadata: {}
|
|
52
|
+
post_install_message:
|
|
53
|
+
rdoc_options: []
|
|
54
|
+
require_paths:
|
|
55
|
+
- lib
|
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
|
+
requirements:
|
|
63
|
+
- - ">="
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '0'
|
|
66
|
+
requirements: []
|
|
67
|
+
rubyforge_project:
|
|
68
|
+
rubygems_version: 2.4.1
|
|
69
|
+
signing_key:
|
|
70
|
+
specification_version: 4
|
|
71
|
+
summary: A Ruby Library for EMC's XtremIO
|
|
72
|
+
test_files: []
|
|
73
|
+
has_rdoc:
|