Sha256: ef8159b312e6eccb6cff1fee3aee2566f5f6f09ddaff0e5980c03e89cd3233d1

Contents?: true

Size: 1.37 KB

Versions: 43

Compression:

Stored size: 1.37 KB

Contents

module Fog
  module Compute
    class IBM
      class Real
        # Modify a key
        #
        # ==== Parameters
        # * key_name<~String> - name of key to be modified
        # * params<~Hash> - depends on type of request
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'success'<~Bool>: success status of update request
        def modify_key(key_name, params={})
          request(
            :method   => 'PUT',
            :expects  => 200,
            :path     => "/keys/#{key_name}",
            :body     => params
          )
        end
      end
      class Mock
        def modify_key(key_name, params={})
          response = Excon::Response.new
          if key_exists? key_name
            if params['public_key']
              self.data[:keys][key_name]['keyMaterial'] = public_key
              self.data[:keys][key_name]['lastModifiedTime'] = Fog::IBM::Mock.launch_time
            end
            if params['default']
              self.data[:keys].values.each do |key|
                key['default'] = false
              end
              self.data[:keys][key_name]['default'] = true
            end
            response.status = 200
            response.body = {"success"=>true}
          else
            response.status = 404
          end
          response
        end
      end
    end
  end
end

Version data entries

43 entries across 41 versions & 6 rubygems

Version Path
fog-1.33.0 lib/fog/ibm/requests/compute/modify_key.rb
fog-1.32.0 lib/fog/ibm/requests/compute/modify_key.rb
fog-1.31.0 lib/fog/ibm/requests/compute/modify_key.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/ibm/requests/compute/modify_key.rb
fog-1.30.0 lib/fog/ibm/requests/compute/modify_key.rb
fog-1.29.0 lib/fog/ibm/requests/compute/modify_key.rb
fog-1.28.0 lib/fog/ibm/requests/compute/modify_key.rb
fog-1.27.0 lib/fog/ibm/requests/compute/modify_key.rb
fog-1.26.0 lib/fog/ibm/requests/compute/modify_key.rb
fog-1.25.0 lib/fog/ibm/requests/compute/modify_key.rb
nsidc-fog-1.24.1 lib/fog/ibm/requests/compute/modify_key.rb
fog-1.24.0 lib/fog/ibm/requests/compute/modify_key.rb
ns-fog-1.22.11 lib/fog/ibm/requests/compute/modify_key.rb
ns-fog-1.22.10 lib/fog/ibm/requests/compute/modify_key.rb
ns-fog-1.22.9 lib/fog/ibm/requests/compute/modify_key.rb
ns-fog-1.22.8 lib/fog/ibm/requests/compute/modify_key.rb
ns-fog-1.22.7 lib/fog/ibm/requests/compute/modify_key.rb
ns-fog-1.22.6 lib/fog/ibm/requests/compute/modify_key.rb
fog-1.23.0 lib/fog/ibm/requests/compute/modify_key.rb
ns-fog-1.22.4 lib/fog/ibm/requests/compute/modify_key.rb