lib/hyperkit/client/profiles.rb in hyperkit-1.2.0 vs lib/hyperkit/client/profiles.rb in hyperkit-1.3.0

- old
+ new

@@ -5,11 +5,11 @@ class Client # Methods for the profiles API # # @see Hyperkit::Client - # @see https://github.com/lxc/lxd/blob/master/specs/rest-api.md + # @see https://github.com/lxc/lxd/blob/master/doc/rest-api.md module Profiles # List of profiles on the server # # @return [Array<String>] An array of profile names @@ -88,9 +88,31 @@ # }) def update_profile(name, options={}) opts = options.except(:name) opts[:config] = stringify_hash(opts[:config]) if opts[:config] put(profile_path(name), opts).metadata + end + + # Patch an existing profile using patch api + # + # @param name [String] Profile name + # @param options [Hash] Additional data to be passed + # @option options [Hash] :config Profile configuration. It will be merged with existing configuration + # @option options [String] :description Profile description + # @option options [Hash] :devices Profile devices. Existing devices will be merged + # @return [Sawyer::Resource] + # + # @example Patch profile with config (config is merged) + # Hyperkit.patch_profile("test-profile", config: { + # "limits.memory" => "4GB", + # "limits.cpu" => 4, + # "raw.lxc" => "lxc.aa_profile = unconfined" + # }) + # + def patch_profile(name, options={}) + opts = options.except(:name) + opts[:config] = stringify_hash(opts[:config]) if opts[:config] + patch(profile_path(name), opts).metadata end # Rename a profile # # @param old_name [String] Existing profile name