Sha256: 3269628c6b086e97f559925581182b92cf5897b7543132f5c0efed6bfd21a376

Contents?: true

Size: 1.87 KB

Versions: 14

Compression:

Stored size: 1.87 KB

Contents

module Fog
  module Identity
    class OpenStack
      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 # class V2
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fog-openstack-0.1.25 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.24 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.23 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.22 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.21 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.20 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.19 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.18 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.17 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.15 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.14 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.13 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.12 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb
fog-openstack-0.1.11 lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb