Sha256: 5cb02780f54036832101b32a9929a48b1e852504256cb17245ef526dff387b02

Contents?: true

Size: 804 Bytes

Versions: 3

Compression:

Stored size: 804 Bytes

Contents

require 'net/http'
class NSXFirewall < Oxidized::Model
  using Refinements

  cmd "/api/4.0/edges/" do |cfg|
    edges = JSON.parse(cfg.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))["edgePage"]["data"]
    data = []
    edges.each do |edge|
      firewall_config = cmd "/api/4.0/edges/#{edge['id']}/firewall/config"
      json_config = {}
      json_config["#{edge['id']} #{edge['name']}"] = JSON.parse(firewall_config.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))
      data.push(json_config)
    end
    JSON.pretty_generate(data)
  end

  cfg :http do
    @username = @node.auth[:username]
    @password = @node.auth[:password]
    @headers['Content-Type'] = 'application/json'
    @headers['Accept'] = 'application/json'
    @secure = true
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oxidized-0.30.1 lib/oxidized/model/nsxfirewall.rb
oxidized-0.30.0 lib/oxidized/model/nsxfirewall.rb
oxidized-0.29.1 lib/oxidized/model/nsxfirewall.rb