Method: Aws::IAM::User#groups

Defined in:
lib/aws-sdk-iam/user.rb

#groups(options = {}) ⇒ Group::Collection

Examples:

Request syntax with placeholder values


user.groups()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:



807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
# File 'lib/aws-sdk-iam/user.rb', line 807

def groups(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(user_name: @name)
    resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
      @client.list_groups_for_user(options)
    end
    resp.each_page do |page|
      batch = []
      page.data.groups.each do |g|
        batch << Group.new(
          name: g.group_name,
          data: g,
          client: @client
        )
      end
      y.yield(batch)
    end
  end
  Group::Collection.new(batches)
end