Class: ProxyAPI::M2

Inherits:
Resource
  • Object
show all
Defined in:
app/lib/proxy_api/m2.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ M2

Returns a new instance of M2.



3
4
5
6
# File 'app/lib/proxy_api/m2.rb', line 3

def initialize(args)
  @url = args[:url] + '/m2'
  super args
end

Instance Method Details

#delete_iscsi_target(args) ⇒ Object



26
27
28
# File 'app/lib/proxy_api/m2.rb', line 26

def delete_iscsi_target(args)
  delete("iscsi_target?disk=#{args[:disk]}").body
end

#get_images(_args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/lib/proxy_api/m2.rb', line 8

def get_images(_args)
  # img_strings = parse(get("image_list?project=#{args[:project]}"))
  img_strings = parse(get('image_list'))

  id = 0
  imgs = []
  img_strings.each do |img|
    id += 1
    imgs << Image.new(:id => id, :uuid => id, :name => img)
  end

  imgs
end

#get_iscsi_target(args) ⇒ Object



22
23
24
# File 'app/lib/proxy_api/m2.rb', line 22

def get_iscsi_target(args)
  get("iscsi_target?disk=#{args[:disk]}&image=#{args[:image]}").body
end

#get_snapshots(_args) ⇒ Object



30
31
32
33
# File 'app/lib/proxy_api/m2.rb', line 30

def get_snapshots(_args)
  # snap_strings = parse(get("snapshot_list?project=#{args[:project]}"))
  parse(get('snapshot_list'))
end