heybulldog 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/heybulldog.rb +106 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 391185c4dd92d2f9272020dda308f8f0238a6318
4
- data.tar.gz: d68b8049c0f155bde68646624a7137920d2bef86
3
+ metadata.gz: d47f5339890eb0eeae33e30a610653c4f04eba91
4
+ data.tar.gz: 1e87ebc8b29f0313ead30678a8991bb38f168a4d
5
5
  SHA512:
6
- metadata.gz: c7317091fc3617b3ce691f5e48bb4cce3fe21b04038154d1ef5f75b7df5945ffc30edda6d574081339223b5e2804386b1dcd860558222fc12d10bd3092f80fe3
7
- data.tar.gz: d846335195e2e165493ccd2b9eeaebe081b82b75cc56e2ec7c7f2bbf9c3e38efb988b7116d1e08fc655e925e5b017541c83939aa2f29756e6d3e953de1cc4553
6
+ metadata.gz: a72d3c048954665f20c0a215cb28c7c1b5a38a34992ead2f58d658f662dbd01502e537b4550752804c54228209ad49172969c3c43ed7c84c33fe0bc8d8df8ca3
7
+ data.tar.gz: 6132e0834b1e5975309f751ef0de9d95db1c8b5a25b209fce0d368e6ca2311199e61efa6b0599c096905c399c22e913d7b781ecd84f9573ea9c885e415612f38
data/lib/heybulldog.rb CHANGED
@@ -11,6 +11,74 @@ class Bulldog
11
11
  @base_url = base_url
12
12
  end
13
13
 
14
+ # Get all Clusters
15
+ #
16
+ # @return [JSON] returns a JSON collection of all Clusters HREF and Name information
17
+ # @author Craig J Smith
18
+ def get_clusters
19
+ JSON.parse(RestClient::Request.execute(method: :get,
20
+ url: "#{@base_url}/api/json/types/clusters",
21
+ headers: {
22
+ accept: :json
23
+ },
24
+ verify_ssl: @verify_cert,
25
+ user: @user_name,
26
+ password: @password
27
+ ))
28
+ end
29
+
30
+ # Get cluster deatils
31
+ #
32
+ # @return [JSON] returns a JSON collection of cluster details
33
+ # @author Craig J Smith
34
+ def get_cluster(cluster_href)
35
+ JSON.parse(RestClient::Request.execute(method: :get,
36
+ url: cluster_href,
37
+ headers: {
38
+ accept: :json
39
+ },
40
+ verify_ssl: @verify_cert,
41
+ user: @user_name,
42
+ password: @password
43
+ ))
44
+ end
45
+
46
+ # Get all X-Bricks
47
+ #
48
+ # @return [JSON] returns a JSON collection of all X-Bricks HREF and Name information
49
+ # @author Craig J Smith
50
+ def get_xbricks
51
+ JSON.parse(RestClient::Request.execute(method: :get,
52
+ url: "#{@base_url}/api/json/types/bricks",
53
+ headers: {
54
+ accept: :json
55
+ },
56
+ verify_ssl: @verify_cert,
57
+ user: @user_name,
58
+ password: @password
59
+ ))
60
+ end
61
+
62
+ # Get X-Brick deatils
63
+ #
64
+ # @return [JSON] returns a JSON collection of X-Brick details
65
+ # @author Craig J Smith
66
+ def get_xbrick(xbrick_href)
67
+ JSON.parse(RestClient::Request.execute(method: :get,
68
+ url: xbrick_href,
69
+ headers: {
70
+ accept: :json
71
+ },
72
+ verify_ssl: @verify_cert,
73
+ user: @user_name,
74
+ password: @password
75
+ ))
76
+ end
77
+
78
+ # Get all Volumes and Snapshots
79
+ #
80
+ # @return [JSON] returns a JSON collection of all Volume HREF and Name information
81
+ # @author Craig J Smith
14
82
  def get_volumes
15
83
  JSON.parse(RestClient::Request.execute(method: :get,
16
84
  url: "#{@base_url}/api/json/types/volumes",
@@ -23,6 +91,11 @@ class Bulldog
23
91
  ))
24
92
  end
25
93
 
94
+ # Get an individual volumes's details
95
+ #
96
+ # @param vol_href [STRING] HREF value of a volume
97
+ # @return [JSON] returns detailed volume information
98
+ # @author Craig J Smith
26
99
  def get_volume(vol_href)
27
100
  JSON.parse(RestClient::Request.execute(method: :get,
28
101
  url: vol_href,
@@ -71,12 +144,33 @@ class Bulldog
71
144
  ))
72
145
  end
73
146
 
74
- def create_snapshot(new_vol,anc_vol)
147
+ def create_snapshot(ancestor_vol_id,snap_vol_name,folder_id=nil)
75
148
 
76
- payload = {
77
- :'ancestor-vol-id' => anc_vol,
78
- :'snap-vol-name' => new_vol
79
- }
149
+ payload = {}
150
+ args = method(__method__).parameters.map { |arg| arg[1] }
151
+ args.map.each do |arg|
152
+ payload[arg.to_s.gsub(/_/,'-')] = eval arg.to_s unless (eval arg.to_s).nil?
153
+ end
154
+
155
+ JSON.parse(RestClient::Request.execute(method: :post,
156
+ url: "#{@base_url}/api/json/types/snapshots",
157
+ verify_ssl: @verify_cert,
158
+ payload: payload.to_json,
159
+ user: @user_name,
160
+ password: @password,
161
+ headers: {
162
+ content_type: 'application/json',
163
+ accept: :json
164
+ }))
165
+ end
166
+
167
+ def create_snapshot_from_folder(source_folder_id,suffix,folder_id=nil)
168
+
169
+ payload = {}
170
+ args = method(__method__).parameters.map { |arg| arg[1] }
171
+ args.map.each do |arg|
172
+ payload[arg.to_s.gsub(/_/,'-')] = eval arg.to_s unless (eval arg.to_s).nil?
173
+ end
80
174
 
81
175
  JSON.parse(RestClient::Request.execute(method: :post,
82
176
  url: "#{@base_url}/api/json/types/snapshots",
@@ -111,11 +205,13 @@ class Bulldog
111
205
  ))
112
206
  end
113
207
 
114
- def map_lun(vol_name,init_grp_name)
115
- payload = {
116
- :'vol-id' => vol_name,
117
- :'ig-id' => init_grp_name
118
- }
208
+ def map_lun(vol_id,ig_id,lun=nil,tg_id=nil)
209
+
210
+ payload = {}
211
+ args = method(__method__).parameters.map { |arg| arg[1] }
212
+ args.map.each do |arg|
213
+ payload[arg.to_s.gsub(/_/,'-')] = eval arg.to_s unless (eval arg.to_s).nil?
214
+ end
119
215
 
120
216
  JSON.parse(RestClient::Request.execute(method: :post,
121
217
  url: "#{@base_url}/api/json/types/lun-maps",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heybulldog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig J Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-27 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json