Class: StudioApi::Appliance::GpgKey
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- StudioApi::Appliance::GpgKey
- Extended by:
- StudioResource
- Defined in:
- lib/studio_api/appliance.rb
Overview
Represents GPGKey assigned to appliance
Class Method Summary collapse
-
.create(appliance_id, name, key, options = {}) ⇒ Object
upload new GPG key to appliance.
Methods included from StudioResource
collection_path, element_path, extended, studio_connection, studio_connection=
Class Method Details
.create(appliance_id, name, key, options = {}) ⇒ Object
upload new GPG key to appliance
121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/studio_api/appliance.rb', line 121 def self.create (appliance_id, name, key, ={}) [:target] ||= "rpm" data = {} if key.is_a?(IO) && key.respond_to?(:path) #if key is string, that pass it in request, if not pack it in body data[:file] = key else [:key] = key.to_s end request_str = "/appliances/#{appliance_id.to_i}/gpg_keys?name=#{name}" request_str = Util. request_str, , false response = GenericRequest.new(studio_connection).post request_str, data self.new Hash.from_xml(response)["gpg_key"] end |