Class: RMC::StorageSystems

Inherits:
Object
  • Object
show all
Defined in:
lib/rmc/storage_systems.rb

Constant Summary collapse

TYPE_STORESERV =
'STORESERV'
TYPE_STOREVIRTUAL =
'STOREVIRTUAL'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ StorageSystems

Returns a new instance of StorageSystems.



10
11
12
# File 'lib/rmc/storage_systems.rb', line 10

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



5
6
7
# File 'lib/rmc/storage_systems.rb', line 5

def connection
  @connection
end

Instance Method Details

#create_system(data) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rmc/storage_systems.rb', line 35

def create_system(data)
  response = @connection.request(
      url: "/storage-systems",
      method: :post,
      payload: {
          storageSystem: data
      }
  )

  get_system(response['storageSystem']['id'])
end

#get_system(id) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/rmc/storage_systems.rb', line 27

def get_system(id)
  response = @connection.request(
      url: "/storage-systems/#{id}",
  )

  RMC::Item::StorageSystem.new(@connection, response['storageSystem'])
end

#list_systemsObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rmc/storage_systems.rb', line 14

def list_systems
  response = @connection.request(
      url: "/storage-systems",
  )

  storage_systems = []
  response['storageSystems'].each do |_data|
    storage_systems << RMC::Item::StorageSystem.new(@connection, _data)
  end

  storage_systems
end