Class: Bim::Action::VS

Inherits:
Object
  • Object
show all
Extended by:
Util
Defined in:
lib/bim/action/vs.rb

Overview

VS class used by Bim::Subcommands::VS

Constant Summary collapse

VS_PATH =
'/mgmt/tm/ltm/virtual'.freeze
VS_URI =
URI.join(Bim::BASE_URL, Bim::Action::VS::VS_PATH)

Class Method Summary collapse

Class Method Details

.change_nf(name, nf_name) ⇒ Object



30
31
32
33
# File 'lib/bim/action/vs.rb', line 30

def change_nf(name, nf_name)
  j = { 'fwEnforcedPolicy' => nf_name }.to_json
  self_patch(name, VS_URI, j)
end

.change_pool(name, pool_name) ⇒ Object



35
36
37
38
# File 'lib/bim/action/vs.rb', line 35

def change_pool(name, pool_name)
  j = { 'pool' => pool_name }.to_json
  self_patch(name, VS_URI, j)
end

.detail(name) ⇒ Object



21
22
23
# File 'lib/bim/action/vs.rb', line 21

def detail(name)
  specify(VS_URI) { |d| d['name'] == name }
end

.lsObject



11
12
13
14
15
16
17
18
19
# File 'lib/bim/action/vs.rb', line 11

def ls
  map(VS_URI) do |item|
    r = { name: item['name'] }
    r['profiles'] = JSON.parse(map(URI(sub_localhost(item['profilesReference']['link']))) do |in_item|
      in_item['fullPath']
    end)
    r
  end
end

.update_global_address(name, dnat_addr, port) ⇒ Object



25
26
27
28
# File 'lib/bim/action/vs.rb', line 25

def update_global_address(name, dnat_addr, port)
  j = { 'destination' => "#{dnat_addr}:#{port}" }.to_json
  self_patch(name, VS_URI, j)
end