Sha256: 4688b354f843eb9ffa4c7f76737013f13f970d40575da366b658ba66b939d702

Contents?: true

Size: 1.03 KB

Versions: 71

Compression:

Stored size: 1.03 KB

Contents

require 'fog/aws/models/iam/group'
require 'fog/aws/iam/paged_collection'

module Fog
  module AWS
    class IAM
      class Groups < Fog::AWS::IAM::PagedCollection

        attribute :username

        model Fog::AWS::IAM::Group

        def all(options = {})
          data, records = if self.username
                            response = service.list_groups_for_user(self.username, options)
                            [response.body, response.body['GroupsForUser']]
                          else
                            response = service.list_groups(options)
                            [response.body, response.body['Groups']]
                          end

          merge_attributes(data)
          load(records)
        end

        def get(identity)
          data = service.get_group(identity)

          group = data.body['Group']
          users = data.body['Users'].map { |u| service.users.new(u) }

          new(group.merge(:users => users))
        rescue Fog::AWS::IAM::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

71 entries across 69 versions & 3 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.29.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.28.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.27.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.26.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.25.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.24.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.23.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.22.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.21.1 lib/fog/aws/models/iam/groups.rb
fog-aws-3.21.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.20.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.19.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.18.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.17.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.16.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.15.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.14.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.13.0 lib/fog/aws/models/iam/groups.rb
fog-aws-3.12.0 lib/fog/aws/models/iam/groups.rb