Sha256: 8a284504c0fb94b10f2a5d952b01c01be364645e1c363781888f901656044e7f

Contents?: true

Size: 1.84 KB

Versions: 19

Compression:

Stored size: 1.84 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.is_a?(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 = {})
            if options.is_a?(Hash)
              user_id = options.delete(:user_id)
            else
              user_id = options
            end

            ec2_credentials = self.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

19 entries across 19 versions & 3 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.9 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.8 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.7 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.6 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.5 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.4 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.3 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.2 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.1 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-openstack-0.1.0 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-1.37.0 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-1.36.0 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-1.35.0 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-2.0.0.pre.0 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-1.34.0 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-1.33.0 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb
fog-1.32.0 lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb