Sha256: 78c7f9ab81b9824db8daa32d2192bfeb4ee9217a5d9a685a681bf25e552f5f57

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

module Simplenet
  module Client
    class Connection
      attr_reader :simplenet_url

      def initialize(config)
        url = config[:url]
        ver = config[:version] || "v1"

        @simplenet_url = "#{url}/#{ver}"
      end

      def firewalls
        @frwl ||= Simplenet::Client::Firewall.new(@simplenet_url)
      end

      def datacenters
        @dtct ||= Simplenet::Client::Datacenter.new(@simplenet_url)
      end

      def zones
        @zone ||= Simplenet::Client::Zone.new(@simplenet_url)
      end

      def ips
        @ip   ||= Simplenet::Client::Ip.new(@simplenet_url)
      end

      def subnets
        @sbnt ||= Simplenet::Client::Subnet.new(@simplenet_url)
      end

      def anycasts
        @anyc ||= Simplenet::Client::Anycast.new(@simplenet_url)
      end

      def anycastips
        @anyi ||= Simplenet::Client::AnycastIp.new(@simplenet_url)
      end

      def interfaces
        @ifac ||= Simplenet::Client::Interface.new(@simplenet_url)
      end

      def switches
        @swit ||= Simplenet::Client::Switch.new(@simplenet_url)
      end

      def vlans
        @vlan ||= Simplenet::Client::Vlan.new(@simplenet_url)
      end

      def policies(netapp, owner)
        @plcy ||= Simplenet::Client::Policy.new(@simplenet_url, netapp, owner)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simplenet-client-0.2.0 ./lib/simplenet/client/connection.rb