Sha256: ce26135cafb1826225d95dc81ed4c09d940dc5689323653177cf9f0a3b15bd95

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# -*- encoding: utf-8 -*-
module Simplenet
  module Client
    class Policy < Base
      def initialize(url, netapp, owner)
        @netapp  = netapp
        @owner   = owner
        @url     = url
        @fullurl = "#{url}/#{netapp}/policies/#{owner}"
      end

      def create(owner_uuid, src, dst_port, proto="tcp", dst=nil, src_port=nil, policy="ACCEPT", table="FORWARD", out_iface=nil, in_iface=nil)
        full_url = "#{@fullurl}/#{owner_uuid}"
        post_hash = {
          "src"       => src,
          "src_port"  => src_port,
          "dst"       => dst,
          "dst_port"  => dst_port,
          "proto"     => proto,
          "policy"    => policy,
          "table"     => table,
          "out_iface" => out_iface,
          "in_iface"  => in_iface
        }
        simplenet_post(full_url, post_hash)
      end

      def by_type
        simplenet_get("#{@url}/#{@netapp}/policies/by-type/#{@owner}")
      end

      def by_owner(owner_id)
        simplenet_get("#{@url}/#{@netapp}/policies/by-owner/#{@owner}/#{owner_id}")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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