Sha256: 271cd73bcfdebe5f7dc54cfc1a9cda81ebcebfdeb7b17a4701851c8451ba7c03

Contents?: true

Size: 835 Bytes

Versions: 5

Compression:

Stored size: 835 Bytes

Contents

require 'fog/openstack/models/collection'
require 'fog/openstack/models/network/rbac_policy'

module Fog
  module Network
    class OpenStack
      class RbacPolicies < Fog::OpenStack::Collection
        attribute :filters

        model Fog::Network::OpenStack::RbacPolicy

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        def all(filters_arg = filters)
          filters = filters_arg
          load_response(service.list_rbac_policies(filters), 'rbac_policies')
        end

        def get(rbac_policy_id)
          if rbac_policy = service.get_rbac_policy(rbac_policy_id).body['rbac_policy']
            new(rbac_policy)
          end
        rescue Fog::Network::OpenStack::NotFound
          nil
        end
        alias_method :find_by_id, :get
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/models/network/rbac_policies.rb
fog-openstack-0.1.9 lib/fog/openstack/models/network/rbac_policies.rb
fog-openstack-0.1.8 lib/fog/openstack/models/network/rbac_policies.rb
fog-openstack-0.1.7 lib/fog/openstack/models/network/rbac_policies.rb
fog-openstack-0.1.6 lib/fog/openstack/models/network/rbac_policies.rb