Sha256: 6a07039b7fd4720c1a5021f4c8e5a6e267ce8e0153727384c9977c9ea667b407

Contents?: true

Size: 1.86 KB

Versions: 20

Compression:

Stored size: 1.86 KB

Contents

module Fog
  module OpenStack
    class Identity
      class V2
        class Real
          ##
          # List EC2 credentials for a user.  Requires administrator
          # credentials.
          #
          # ==== Parameters hash
          # * :user_id<~String>: The id of the user to retrieve the credential
          #   for
          #
          # ==== Returns
          # * response<~Excon::Response>:
          #   * body<~Hash>:
          #     * 'credentials'<~Array>: The user's EC2 credentials
          #       * 'access'<~String>: The access key
          #       * 'secret'<~String>: The secret key
          #       * 'user_id'<~String>: The user id
          #       * 'tenant_id'<~String>: The tenant id

          def list_ec2_credentials(options = {})
            if options.kind_of?(Hash)
              user_id = options.delete(:user_id)
              query = options
            else
              Fog::Logger.deprecation('Calling OpenStack[:identity].list_ec2_credentials(user_id) is deprecated, use .list_ec2_credentials(:user_id => value)')
              user_id = options
              query = {}
            end

            request(
              :expects => [200, 202],
              :method  => 'GET',
              :path    => "users/#{user_id}/credentials/OS-EC2",
              :query   => query
            )
          end
        end

        class Mock
          def list_ec2_credentials(options = {})
            user_id = if options.kind_of?(Hash)
                        options.delete(:user_id)
                      else
                        options
                      end

            ec2_credentials = data[:ec2_credentials][user_id].values

            response = Excon::Response.new
            response.status = 200
            response.body = {'credentials' => ec2_credentials}
            response
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
fog-openstack-1.1.3 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.1.2 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-fork-99 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.1.0 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.1.0.pre lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.11 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.10 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.9 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.8 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.7 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.6 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.5 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.4 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.3 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.2 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.1 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-1.0.0 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb
fog-openstack-0.3.1 lib/fog/openstack/identity/v2/requests/list_ec2_credentials.rb