rmc 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rmc.rb +18 -15
- data/lib/rmc/connection.rb +1 -1
- data/lib/rmc/item/backup_system.rb +43 -0
- data/lib/rmc/item/express_protect.rb +28 -0
- data/lib/rmc/item/recovery_set.rb +14 -0
- data/lib/rmc/item/snapshot_set.rb +38 -0
- data/lib/rmc/item/storage_system.rb +69 -0
- data/lib/rmc/item/task.rb +28 -0
- data/lib/rmc/tasks.rb +27 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab7a4e766a039b4755b8ddafcbbc5699289e6db8
|
4
|
+
data.tar.gz: fb72982aaf4c53a8bbab9a7d7f9b28c07437d5ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d262637508b8aa4de18e249b16bf01e800bb221d055823a0ce9b1b6dacc977e69c5808df723fb97bd02f9b98c6ef0b602008648790622555701f762ad661765a
|
7
|
+
data.tar.gz: c2908d56290b8ade0d749ebfa29a1575de06f75c264814a7d8b243d6ca7c9124eada57a6f6b6cd84c0079ef647b2d84bd2f55563a10605c8d5af4534b0ca3bf4
|
data/lib/rmc.rb
CHANGED
@@ -6,25 +6,28 @@ module RMC
|
|
6
6
|
require 'oj'
|
7
7
|
require 'timeout'
|
8
8
|
|
9
|
+
require 'rmc/item/backup_policy'
|
10
|
+
require 'rmc/item/backup_system'
|
11
|
+
require 'rmc/item/express_protect'
|
12
|
+
require 'rmc/item/host'
|
13
|
+
require 'rmc/item/recovery_set'
|
14
|
+
require 'rmc/item/schedule'
|
15
|
+
require 'rmc/item/snapshot_set'
|
16
|
+
require 'rmc/item/storage_pool'
|
17
|
+
require 'rmc/item/storage_system'
|
18
|
+
require 'rmc/item/task'
|
19
|
+
require 'rmc/item/volume'
|
20
|
+
|
21
|
+
require 'rmc/backup_policies'
|
22
|
+
require 'rmc/backup_systems'
|
9
23
|
require 'rmc/connection'
|
10
|
-
require 'rmc/
|
24
|
+
require 'rmc/express_protects'
|
11
25
|
require 'rmc/recovery_sets'
|
26
|
+
require 'rmc/scheduler'
|
12
27
|
require 'rmc/snapshot_sets'
|
13
|
-
require 'rmc/express_protects'
|
14
|
-
require 'rmc/volumes'
|
15
28
|
require 'rmc/storage_systems'
|
16
|
-
require 'rmc/
|
17
|
-
require 'rmc/
|
18
|
-
require 'rmc/item/schedule'
|
19
|
-
require 'rmc/item/recovery_set'
|
20
|
-
require 'rmc/item/express_protect'
|
21
|
-
require 'rmc/item/storage_pool'
|
22
|
-
require 'rmc/item/volume'
|
23
|
-
require 'rmc/item/storage_system'
|
24
|
-
require 'rmc/item/backup_system'
|
25
|
-
require 'rmc/item/snapshot_set'
|
26
|
-
require 'rmc/item/backup_policy'
|
27
|
-
require 'rmc/item/host'
|
29
|
+
require 'rmc/tasks'
|
30
|
+
require 'rmc/volumes'
|
28
31
|
|
29
32
|
class Exception < ::RuntimeError
|
30
33
|
end
|
data/lib/rmc/connection.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
module RMC::Item
|
3
|
+
|
4
|
+
class BackupSystem
|
5
|
+
|
6
|
+
attr_accessor :connection
|
7
|
+
|
8
|
+
attr_reader :id
|
9
|
+
attr_reader :name
|
10
|
+
attr_reader :status
|
11
|
+
|
12
|
+
attr_reader :serialNumber
|
13
|
+
attr_reader :firmwareVersion
|
14
|
+
attr_reader :deviceType
|
15
|
+
attr_reader :ipHostname
|
16
|
+
attr_reader :state
|
17
|
+
|
18
|
+
def initialize(connection, data)
|
19
|
+
|
20
|
+
@connection = connection
|
21
|
+
|
22
|
+
@id = data['id']
|
23
|
+
@name = data['name']
|
24
|
+
@status = data['status']
|
25
|
+
|
26
|
+
@serialNumber = data['serialNumber']
|
27
|
+
@firmwareVersion = data['firmwareVersion']
|
28
|
+
@deviceType = data['deviceType']
|
29
|
+
@ipHostname = data['ipHostname']
|
30
|
+
@state = data['state']
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def delete
|
35
|
+
@connection.request(
|
36
|
+
:url => "/backup-systems/#{@id}",
|
37
|
+
:method => :delete,
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -8,7 +8,9 @@ module RMC::Item
|
|
8
8
|
attr_reader :id
|
9
9
|
attr_reader :name
|
10
10
|
attr_reader :status
|
11
|
+
attr_reader :backups
|
11
12
|
attr_reader :createdAt
|
13
|
+
attr_reader :recoverySetId
|
12
14
|
|
13
15
|
def initialize(connection, data)
|
14
16
|
@connection = connection
|
@@ -16,10 +18,22 @@ module RMC::Item
|
|
16
18
|
@id = data['id']
|
17
19
|
@name = data['name']
|
18
20
|
@status = data['status']
|
21
|
+
@backups = data['backups']
|
19
22
|
@createdAt = data['createdAt']
|
23
|
+
@recoverySetId = data['recoverySetId']
|
20
24
|
|
21
25
|
end
|
22
26
|
|
27
|
+
def update(data)
|
28
|
+
@connection.request(
|
29
|
+
:url => "/backup-sets/#{@id}",
|
30
|
+
:method => :put,
|
31
|
+
:payload => {
|
32
|
+
backupSet: data
|
33
|
+
}
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
23
37
|
def delete
|
24
38
|
@connection.request(
|
25
39
|
:url => "/backup-sets/#{@id}",
|
@@ -36,6 +50,20 @@ module RMC::Item
|
|
36
50
|
@connection.wait_for_task(response['taskUri'].split('/').last)
|
37
51
|
end
|
38
52
|
|
53
|
+
def restore_to_recovery_set(id)
|
54
|
+
response = @connection.request(
|
55
|
+
:url => "/backup-sets/#{@id}/restore",
|
56
|
+
:payload => {
|
57
|
+
backupSet: {
|
58
|
+
restoreRecoverysetId: id
|
59
|
+
}
|
60
|
+
},
|
61
|
+
:method => :post
|
62
|
+
)
|
63
|
+
|
64
|
+
@connection.wait_for_task(response['taskUri'].split('/').last)
|
65
|
+
end
|
66
|
+
|
39
67
|
end
|
40
68
|
|
41
69
|
end
|
@@ -103,6 +103,20 @@ module RMC::Item
|
|
103
103
|
true
|
104
104
|
end
|
105
105
|
|
106
|
+
def refresh
|
107
|
+
response = @connection.request(
|
108
|
+
url: "/recovery-sets/#{@id}/refresh",
|
109
|
+
method: :put,
|
110
|
+
payload: {
|
111
|
+
recoverySet: {
|
112
|
+
fullRefresh: true
|
113
|
+
}
|
114
|
+
}
|
115
|
+
)
|
116
|
+
@connection.wait_for_task(response['taskUri'].split('/').last)
|
117
|
+
true
|
118
|
+
end
|
119
|
+
|
106
120
|
def update(data)
|
107
121
|
response = @connection.request(
|
108
122
|
url: "/recovery-sets/#{@id}",
|
@@ -31,6 +31,44 @@ module RMC::Item
|
|
31
31
|
@snapRetention = data['snapRetention']
|
32
32
|
end
|
33
33
|
|
34
|
+
def update(data)
|
35
|
+
@connection.request(
|
36
|
+
:url => "/snapshot-sets/#{@id}",
|
37
|
+
:method => :put,
|
38
|
+
:payload => {
|
39
|
+
snapshotSet: data
|
40
|
+
}
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def refresh
|
45
|
+
response = @connection.request(
|
46
|
+
url: "/snapshot-sets/#{@id}/refresh",
|
47
|
+
method: :put,
|
48
|
+
payload: {
|
49
|
+
snapshotSet: {}
|
50
|
+
}
|
51
|
+
)
|
52
|
+
@connection.wait_for_task(response['taskUri'].split('/').last)
|
53
|
+
true
|
54
|
+
end
|
55
|
+
|
56
|
+
def restore(volume_list)
|
57
|
+
response = @connection.request(
|
58
|
+
:url => "/snapshot-sets/#{@id}/restore",
|
59
|
+
:method => :post,
|
60
|
+
:payload => {
|
61
|
+
snapshotSet: {
|
62
|
+
online: true,
|
63
|
+
volumelist: [volume_list.join(", ")]
|
64
|
+
}
|
65
|
+
}
|
66
|
+
)
|
67
|
+
|
68
|
+
@connection.wait_for_task(response['taskUri'].split('/').last)
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
34
72
|
def delete
|
35
73
|
@connection.request(
|
36
74
|
:url => "/snapshot-sets/#{@id}",
|
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
module RMC::Item
|
3
|
+
|
4
|
+
class StorageSystem
|
5
|
+
|
6
|
+
attr_accessor :connection
|
7
|
+
|
8
|
+
attr_reader :id
|
9
|
+
attr_reader :name
|
10
|
+
attr_reader :status
|
11
|
+
|
12
|
+
attr_reader :serialNumber
|
13
|
+
attr_reader :firmwareVersion
|
14
|
+
attr_reader :deviceType
|
15
|
+
attr_reader :ipHostname
|
16
|
+
attr_reader :sytemId
|
17
|
+
|
18
|
+
def initialize(connection, data)
|
19
|
+
|
20
|
+
@connection = connection
|
21
|
+
|
22
|
+
@id = data['id']
|
23
|
+
@name = data['name']
|
24
|
+
@status = data['status']
|
25
|
+
|
26
|
+
@serialNumber = data['serialNumber']
|
27
|
+
@firmwareVersion = data['firmwareVersion']
|
28
|
+
@deviceType = data['deviceType']
|
29
|
+
@ipHostname = data['ipHostname']
|
30
|
+
@sytemId = data['systemId']
|
31
|
+
|
32
|
+
@configuredProtocols = data['configuredProtocols']
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_pools
|
36
|
+
pools = []
|
37
|
+
@configuredProtocols.each do |storage_pool|
|
38
|
+
response = @connection.request(
|
39
|
+
url: "/storage-pools/#{storage_pool['poolId']}"
|
40
|
+
)
|
41
|
+
pools << RMC::Item::StoragePool.new(@connection, response['storagePool'])
|
42
|
+
end
|
43
|
+
|
44
|
+
pools
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_volumes
|
48
|
+
response = @connection.request(
|
49
|
+
url: "/volume?query=\"storageSystemId EQ '#{@id}'\"",
|
50
|
+
)
|
51
|
+
|
52
|
+
volumes = []
|
53
|
+
response['storageSystem']['volumes']['members'].each do |_data|
|
54
|
+
volumes << RMC::Item::Volume.new(@connection, _data)
|
55
|
+
end
|
56
|
+
|
57
|
+
volumes
|
58
|
+
end
|
59
|
+
|
60
|
+
def delete
|
61
|
+
@connection.request(
|
62
|
+
:url => "/storage-systems/#{@id}",
|
63
|
+
:method => :delete,
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
module RMC::Item
|
3
|
+
|
4
|
+
class Task
|
5
|
+
|
6
|
+
attr_accessor :connection
|
7
|
+
|
8
|
+
attr_reader :id
|
9
|
+
attr_reader :name
|
10
|
+
|
11
|
+
def initialize(connection, data)
|
12
|
+
@connection = connection
|
13
|
+
|
14
|
+
@id = data['id']
|
15
|
+
@name = data['name']
|
16
|
+
end
|
17
|
+
|
18
|
+
def delete
|
19
|
+
@connection.version = 1
|
20
|
+
@connection.request(
|
21
|
+
:url => "/tasks/#{@id}",
|
22
|
+
:method => :delete,
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/lib/rmc/tasks.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module RMC
|
2
|
+
|
3
|
+
class Tasks
|
4
|
+
|
5
|
+
attr_reader :connection
|
6
|
+
|
7
|
+
def initialize(connection)
|
8
|
+
@connection = connection
|
9
|
+
end
|
10
|
+
|
11
|
+
def list_tasks(query=nil)
|
12
|
+
@connection.version = 2
|
13
|
+
response = @connection.request(
|
14
|
+
url: "/tasks#{query ? "?query=\"#{query}\"" : ''}"
|
15
|
+
)
|
16
|
+
|
17
|
+
tasks = []
|
18
|
+
response['tasks'].each do |_data|
|
19
|
+
tasks << RMC::Item::Task.new(@connection, _data)
|
20
|
+
end
|
21
|
+
|
22
|
+
tasks
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Birkner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mocha
|
@@ -97,17 +97,21 @@ files:
|
|
97
97
|
- lib/rmc/connection.rb
|
98
98
|
- lib/rmc/express_protects.rb
|
99
99
|
- lib/rmc/item/backup_policy.rb
|
100
|
+
- lib/rmc/item/backup_system.rb
|
100
101
|
- lib/rmc/item/express_protect.rb
|
101
102
|
- lib/rmc/item/host.rb
|
102
103
|
- lib/rmc/item/recovery_set.rb
|
103
104
|
- lib/rmc/item/schedule.rb
|
104
105
|
- lib/rmc/item/snapshot_set.rb
|
105
106
|
- lib/rmc/item/storage_pool.rb
|
107
|
+
- lib/rmc/item/storage_system.rb
|
108
|
+
- lib/rmc/item/task.rb
|
106
109
|
- lib/rmc/item/volume.rb
|
107
110
|
- lib/rmc/recovery_sets.rb
|
108
111
|
- lib/rmc/scheduler.rb
|
109
112
|
- lib/rmc/snapshot_sets.rb
|
110
113
|
- lib/rmc/storage_systems.rb
|
114
|
+
- lib/rmc/tasks.rb
|
111
115
|
- lib/rmc/volumes.rb
|
112
116
|
homepage: https://github.com/nitrado/ruby-rmc
|
113
117
|
licenses: []
|
@@ -128,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
132
|
version: '0'
|
129
133
|
requirements: []
|
130
134
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.6.
|
135
|
+
rubygems_version: 2.6.13
|
132
136
|
signing_key:
|
133
137
|
specification_version: 4
|
134
138
|
summary: HPE RMC Ruby API
|