Sha256: 8840745b6e655bb465a71349b2c4ffb436a945d3617b371ed93d70c847b034bd

Contents?: true

Size: 847 Bytes

Versions: 4

Compression:

Stored size: 847 Bytes

Contents

require 'fog/core/collection'

module Fog
  module OracleCloud
    class Java
      class AccessRules < Fog::Collection
        attribute :instance

        model Fog::OracleCloud::Java::AccessRule

        def all
          data = service.list_access_rules(instance.service_name).body['accessRules']
          load(data)
        end

        def get(rule_name)
          data = service.list_access_rules(instance.service_name).body['accessRules']
          rule = load(data).detect { |r| r.rule_name === rule_name }
          if !rule.nil?
            rule
          else
            raise Fog::OracleCloud::Java::NotFound.new("Access Rule #{rule_name} does not exist");
          end
        end

        def new(attributes = {})
          super({:service_name=>instance.service_name}.merge!(attributes))
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.17 lib/fog/oraclecloud/models/java/access_rules.rb
fog-oraclecloud-0.1.16 lib/fog/oraclecloud/models/java/access_rules.rb
fog-oraclecloud-0.1.15 lib/fog/oraclecloud/models/java/access_rules.rb
fog-oraclecloud-0.1.14 lib/fog/oraclecloud/models/java/access_rules.rb