Sha256: cd00ca6daeaad1b6484dcd3c2f52a3a13fe6607d8f27a60137c8060fb3cb6a5d

Contents?: true

Size: 1.41 KB

Versions: 9

Compression:

Stored size: 1.41 KB

Contents

# This file is part of the OpenStack-ActiveResource
#
# Copyright (C) 2012 Unidata S.p.A. (Davide Guerri - d.guerri@unidata.it)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

module OpenStack
  module Keystone
    module Admin

      # An OpenStack Role ("admin view")
      #
      # ==== Attributes
      # * +name+ - The name of this role
      class Role < Base
        self.element_name = "OS-KSADM/role"

        schema do
          attribute :name, :string
        end

        validates :name,
                  :presence => true,
                  :length => {:minimum => 4, :allow_blank => true},
                  :format => {:with => /\A[0-9a-z_]+\Z/i, :allow_blank => true}

        # List Roles with a given name
        def self.find_by_name(name)
          all.detect { |role| role.name == name }
        end

      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
openstack_activeresource-0.7.1 lib/open_stack/keystone/admin/role.rb
openstack_activeresource-0.7.0 lib/open_stack/keystone/admin/role.rb
openstack_activeresource-0.6.3 lib/open_stack/keystone/admin/role.rb
openstack_activeresource-0.6.2 lib/open_stack/keystone/admin/role.rb
openstack_activeresource-0.6.1 lib/open_stack/keystone/admin/role.rb
openstack_activeresource-0.6.0 lib/open_stack/keystone/admin/role.rb
openstack_activeresource-0.5.2 lib/open_stack/keystone/admin/role.rb
openstack_activeresource-0.5.1 lib/open_stack/keystone/admin/role.rb
openstack_activeresource-0.5.0 lib/open_stack/keystone/admin/role.rb