Sha256: 265849227a32ebe69b1be0c1ae3da8e72748a5f7e690091243a5ff7ecd7a2c68

Contents?: true

Size: 1.16 KB

Versions: 11

Compression:

Stored size: 1.16 KB

Contents

module Fog
  module Compute
    class OracleCloud
      class Real
        def get_ssh_key(name)
          if !name.start_with?("/Compute-") then
            # They haven't provided a well formed name, add their name in
            name = "/Compute-#{@identity_domain}/#{@username}/#{name}"
          end
          response = request(
            :expects  => 200,
            :method   => 'GET',
            :path     => "/sshkey#{name}",
            :headers  => {
              'Content-Type' => 'application/oracle-compute-v3+json',
              'Accept' => 'application/oracle-compute-v3+json'
            }
          )
          response
        end
      end

      class Mock
        def get_ssh_key(name)
          response = Excon::Response.new
          clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''

          if sshkey = self.data[:sshkeys][clean_name] 
            response.status = 200
            response.body = sshkey
            response
          else;
            raise Fog::Compute::OracleCloud::NotFound.new("SSHKey #{name} does not exist");
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.12 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.11 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.10 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.9 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.8 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.7 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.6 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.5 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.4 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.3 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb
fog-oraclecloud-0.1.2 lib/fog/oraclecloud/requests/compute/get_ssh_key.rb