Sha256: e1cbf1ca4f1c2a8b5f8cf124a1141fc24ea41c0d1a6005cc1204ba8ac4c4d7bf

Contents?: true

Size: 773 Bytes

Versions: 2

Compression:

Stored size: 773 Bytes

Contents

require 'net/http'
class NSXConfig < Oxidized::Model
  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']}"
      json_config = JSON.parse(firewall_config.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))
      json_config["edgeInfo"] = "#{edge['id']} #{edge['name']}"
      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

2 entries across 2 versions & 1 rubygems

Version Path
oxidized-0.29.0 lib/oxidized/model/nsxconfig.rb
oxidized-0.28.0 lib/oxidized/model/nsxconfig.rb