runcible 0.4.12 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +42 -13
- data/Rakefile +1 -17
- data/lib/runcible/base.rb +26 -36
- data/lib/runcible/extensions/consumer.rb +22 -15
- data/lib/runcible/extensions/consumer_group.rb +12 -12
- data/lib/runcible/extensions/repository.rb +44 -38
- data/lib/runcible/extensions/rpm.rb +3 -3
- data/lib/runcible/extensions/unit.rb +21 -16
- data/lib/runcible/instance.rb +129 -0
- data/lib/runcible/{extensions → models}/distributor.rb +7 -3
- data/lib/runcible/{extensions → models}/export_distributor.rb +6 -3
- data/lib/runcible/{extensions → models}/importer.rb +2 -2
- data/lib/runcible/{extensions → models}/iso_distributor.rb +5 -2
- data/lib/runcible/{extensions → models}/iso_importer.rb +2 -2
- data/lib/runcible/models/nodes_http_distributor.rb +61 -0
- data/lib/runcible/{extensions → models}/yum_clone_distributor.rb +3 -1
- data/lib/runcible/{extensions → models}/yum_distributor.rb +2 -2
- data/lib/runcible/{extensions → models}/yum_importer.rb +2 -2
- data/lib/runcible/resources/consumer.rb +14 -14
- data/lib/runcible/resources/consumer_group.rb +9 -9
- data/lib/runcible/resources/event_notifier.rb +3 -3
- data/lib/runcible/resources/repository.rb +20 -20
- data/lib/runcible/resources/repository_group.rb +6 -6
- data/lib/runcible/resources/repository_schedule.rb +4 -4
- data/lib/runcible/resources/role.rb +2 -2
- data/lib/runcible/resources/task.rb +5 -5
- data/lib/runcible/resources/unit.rb +2 -2
- data/lib/runcible/resources/user.rb +4 -4
- data/lib/runcible/version.rb +1 -1
- data/lib/runcible.rb +6 -2
- metadata +84 -91
@@ -31,17 +31,17 @@ module Runcible
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# This function is not implemented for RPMs since they do not have content IDs
|
34
|
-
def
|
34
|
+
def find
|
35
35
|
raise NotImplementedError
|
36
36
|
end
|
37
37
|
|
38
38
|
# This function is not implemented for RPMs since they do not have content IDs
|
39
|
-
def
|
39
|
+
def find_all
|
40
40
|
raise NotImplementedError
|
41
41
|
end
|
42
42
|
|
43
43
|
# This function is not implemented for RPMs since they do not have content IDs
|
44
|
-
def
|
44
|
+
def unassociate_ids_from_repo(repo_id, ids)
|
45
45
|
raise NotImplementedError
|
46
46
|
end
|
47
47
|
end
|
@@ -25,24 +25,28 @@
|
|
25
25
|
module Runcible
|
26
26
|
module Extensions
|
27
27
|
class Unit < Runcible::Resources::Unit
|
28
|
-
|
28
|
+
|
29
29
|
# The content type (e.g. rpm, errata)
|
30
30
|
def self.content_type
|
31
|
-
|
31
|
+
raise "Content type not defined"
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_type
|
35
|
+
self.class.content_type
|
32
36
|
end
|
33
37
|
|
34
38
|
# Retrieves all content of a certain @@type
|
35
39
|
#
|
36
40
|
# @return [RestClient::Response] list of all content for the given type
|
37
|
-
def
|
38
|
-
|
41
|
+
def all
|
42
|
+
search(content_type, {})
|
39
43
|
end
|
40
44
|
|
41
45
|
# Retrieves a single content by it's content ID
|
42
46
|
#
|
43
47
|
# @param [Array] id the content ID of the content to retrieve
|
44
48
|
# @return [RestClient::Response] the requested content
|
45
|
-
def
|
49
|
+
def find(id, optional={})
|
46
50
|
optional[:include_repos] ||= true
|
47
51
|
find_all([id], optional).first
|
48
52
|
end
|
@@ -51,16 +55,16 @@ module Runcible
|
|
51
55
|
#
|
52
56
|
# @param [Array] ids list of content IDs to retrieve
|
53
57
|
# @return [RestClient::Response] list of content
|
54
|
-
def
|
58
|
+
def find_all(ids, optional={})
|
55
59
|
optional[:include_repos] ||= true
|
56
|
-
|
60
|
+
search(content_type, { :filters => {'id'=> {'$in'=> ids}} }, optional)
|
57
61
|
end
|
58
62
|
|
59
63
|
# Retrieves a single content by it's unit ID
|
60
64
|
#
|
61
65
|
# @param [Array] id the unit ID of the content to retrieve
|
62
66
|
# @return [RestClient::Response] the requested content
|
63
|
-
def
|
67
|
+
def find_by_unit_id(id, optional={})
|
64
68
|
optional[:include_repos] ||= true
|
65
69
|
find_all_by_unit_ids([id], [], optional).first
|
66
70
|
end
|
@@ -70,11 +74,11 @@ module Runcible
|
|
70
74
|
# @param [Array] ids list of content unit IDs to retrieve
|
71
75
|
# @param [Array] fields optional list of to retrieve
|
72
76
|
# @return [RestClient::Response] list of content
|
73
|
-
def
|
77
|
+
def find_all_by_unit_ids(ids, fields=[], optional={})
|
74
78
|
optional[:include_repos] ||= true
|
75
79
|
criteria = { :filters => { :_id => { '$in'=> ids } } }
|
76
80
|
criteria[:fields] = fields unless fields.empty?
|
77
|
-
|
81
|
+
search(content_type, criteria, optional)
|
78
82
|
end
|
79
83
|
|
80
84
|
# unassociates content units from a repository
|
@@ -82,10 +86,10 @@ module Runcible
|
|
82
86
|
# @param [String] repo_id the repository ID to remove units from
|
83
87
|
# @param [Hash] filters the filters to find the units this content type to remove
|
84
88
|
# @return [RestClient::Response] a task representing the unit unassociate operation
|
85
|
-
def
|
89
|
+
def unassociate_from_repo(repo_id, filters)
|
86
90
|
criteria = {:type_ids => [content_type]}
|
87
91
|
criteria[:filters] = filters
|
88
|
-
Runcible::Extensions::Repository.unassociate_units(repo_id, criteria)
|
92
|
+
Runcible::Extensions::Repository.new(self.config).unassociate_units(repo_id, criteria)
|
89
93
|
end
|
90
94
|
|
91
95
|
# unassociates content units from a repository
|
@@ -96,7 +100,7 @@ module Runcible
|
|
96
100
|
# ex: "RHEA-2010:0001" for errata..,
|
97
101
|
# Note rpms do not have ids, so cant use this.
|
98
102
|
# @return [RestClient::Response] a task representing the unit unassociate operation
|
99
|
-
def
|
103
|
+
def unassociate_ids_from_repo(repo_id, ids)
|
100
104
|
unassociate_from_repo(repo_id, :unit => {'id' => {'$in' => ids}})
|
101
105
|
end
|
102
106
|
|
@@ -108,7 +112,7 @@ module Runcible
|
|
108
112
|
# for example: "efdd2d63-b275-4728-a298-f68cf4c174e7"
|
109
113
|
#
|
110
114
|
# @return [RestClient::Response] a task representing the unit unassociate operation
|
111
|
-
def
|
115
|
+
def unassociate_unit_ids_from_repo(repo_id, ids)
|
112
116
|
unassociate_from_repo(repo_id, :association => {'unit_id' => {'$in' => ids}})
|
113
117
|
end
|
114
118
|
|
@@ -118,15 +122,16 @@ module Runcible
|
|
118
122
|
# @param [String] destination_repo_id the destination repository ID
|
119
123
|
# @param [Hash] optional container for all optional parameters
|
120
124
|
# @return [RestClient::Response] a task representing the unit copy operation
|
121
|
-
def
|
125
|
+
def copy(source_repo_id, destination_repo_id, optional={})
|
122
126
|
criteria = {:type_ids => [content_type], :filters => {}}
|
123
127
|
criteria[:filters]['association'] = {'unit_id' => {'$in' => optional[:ids]}} if optional[:ids]
|
128
|
+
criteria[:filters] = optional[:filters] if optional[:filters]
|
124
129
|
criteria[:fields] = {:unit => optional[:fields]} if optional[:fields]
|
125
130
|
|
126
131
|
payload = {:criteria => criteria}
|
127
132
|
payload[:override_config] = {:copy_children => optional[:copy_children]} if optional.has_key?(:copy_children)
|
128
133
|
|
129
|
-
Runcible::Extensions::Repository.unit_copy(destination_repo_id, source_repo_id, payload)
|
134
|
+
Runcible::Extensions::Repository.new(self.config).unit_copy(destination_repo_id, source_repo_id, payload)
|
130
135
|
end
|
131
136
|
|
132
137
|
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# Copyright (c) 2013 Red Hat Inc.
|
2
|
+
#
|
3
|
+
# MIT License
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
module Runcible
|
25
|
+
class Instance
|
26
|
+
|
27
|
+
def self.resource_classes
|
28
|
+
@@resource_classes ||= gather_classes("resources")
|
29
|
+
@@resource_classes
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.extension_classes
|
33
|
+
@@extension_classes ||= gather_classes("extensions")
|
34
|
+
@@extension_classes
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
attr_accessor :resources
|
39
|
+
attr_accessor :extensions
|
40
|
+
|
41
|
+
# Initialize a Runcible instance
|
42
|
+
#
|
43
|
+
# @param [Hash] config
|
44
|
+
# @option config [String] :user Pulp username
|
45
|
+
# @option config [String] :oauth Oauth credentials
|
46
|
+
# @option config [Hash] :headers Additional headers e.g. content-type => "application/json"
|
47
|
+
# @option config [String] :url Scheme and hostname for the pulp server e.g. https://localhost/
|
48
|
+
# @option config [String] :api_path URL path for the api e.g. pulp/api/v2/
|
49
|
+
# @option config [String] :timeout Timeout in seconds for the connection (defaults to rest client's default)
|
50
|
+
# @option config [String] :open_timeout timeout in seconds for the connection to open(defaults to rest client's default)
|
51
|
+
# @option config [Hash] :http_auth Needed when using simple http auth
|
52
|
+
# @option http_auth [String] :password The password to use for simple auth
|
53
|
+
def initialize(config={})
|
54
|
+
@config = {
|
55
|
+
:api_path => '/pulp/api/v2/',
|
56
|
+
:url => 'https://localhost',
|
57
|
+
:user => '',
|
58
|
+
:http_auth => {:password => {} },
|
59
|
+
:headers => {:content_type => 'application/json',
|
60
|
+
:accept => 'application/json'},
|
61
|
+
:logging => {}
|
62
|
+
}.merge(config).with_indifferent_access
|
63
|
+
|
64
|
+
|
65
|
+
initialize_wrappers(config)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Update an existing config value
|
69
|
+
# @param [String, Symbol] key The key of the config to update
|
70
|
+
# @param [Object] value The value of the config to update
|
71
|
+
def update_config(key, value)
|
72
|
+
@config[key] = value
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def initialize_wrappers(config)
|
78
|
+
self.resources = Wrapper.new('resources')
|
79
|
+
self.extensions = Wrapper.new('extensions')
|
80
|
+
|
81
|
+
self.class.resource_classes.each do |runcible_class|
|
82
|
+
instance = runcible_class.new(@config)
|
83
|
+
self.resources.set_instance(accessible_class(runcible_class), instance)
|
84
|
+
end
|
85
|
+
|
86
|
+
self.class.extension_classes.each do |runcible_class|
|
87
|
+
instance = runcible_class.new(@config)
|
88
|
+
self.extensions.set_instance(accessible_class(runcible_class), instance)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def accessible_class(class_object)
|
93
|
+
#converts a class (Runcible::Resources::ConsumerGroup) to a user friendly name:
|
94
|
+
# (e.g. consumer_group)
|
95
|
+
class_object.name.split("::").last.underscore
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.gather_classes(type)
|
99
|
+
const = Runcible
|
100
|
+
const = const.const_get(type.camelize)
|
101
|
+
path = File.dirname(__FILE__) + "/#{type}/*.rb"
|
102
|
+
base_names = Dir.glob(path).collect{|f| File.basename(f, '.rb') }
|
103
|
+
classes = base_names.collect{|name| const.const_get(name.camelize)}
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
#Wrapper class to provide access to instances
|
110
|
+
class Wrapper
|
111
|
+
|
112
|
+
def initialize(name)
|
113
|
+
@name = name
|
114
|
+
@methods = []
|
115
|
+
end
|
116
|
+
|
117
|
+
def set_instance(attr_name, instance)
|
118
|
+
@methods << attr_name
|
119
|
+
define_singleton_method(attr_name) { instance }
|
120
|
+
end
|
121
|
+
|
122
|
+
def to_s
|
123
|
+
"#{@name} - #{@methods.uniq.sort.to_s}"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
end
|
129
|
+
|
@@ -25,14 +25,18 @@ require 'active_support/json'
|
|
25
25
|
require 'securerandom'
|
26
26
|
|
27
27
|
module Runcible
|
28
|
-
module
|
28
|
+
module Models
|
29
29
|
class Distributor
|
30
30
|
attr_accessor 'auto_publish', 'id'
|
31
31
|
|
32
32
|
def initialize(params={})
|
33
33
|
@auto_publish = false
|
34
|
-
|
35
|
-
params.each{|k,v|
|
34
|
+
id = params[:id] || SecureRandom.hex(10)
|
35
|
+
params.each{|k,v| send("#{k.to_s}=",v)}
|
36
|
+
end
|
37
|
+
|
38
|
+
def type_id
|
39
|
+
self.class.type_id
|
36
40
|
end
|
37
41
|
|
38
42
|
# Distributor Type id
|
@@ -25,7 +25,7 @@ require 'active_support/json'
|
|
25
25
|
require 'securerandom'
|
26
26
|
|
27
27
|
module Runcible
|
28
|
-
module
|
28
|
+
module Models
|
29
29
|
class ExportDistributor < Distributor
|
30
30
|
#required
|
31
31
|
attr_accessor "http", "https"
|
@@ -39,9 +39,12 @@ module Runcible
|
|
39
39
|
@http = http
|
40
40
|
@https = https
|
41
41
|
# Pulp seems to expect the ID to be export_distributor, not a random
|
42
|
-
super({:id =>
|
42
|
+
super({:id => type_id})
|
43
43
|
end
|
44
44
|
|
45
|
+
# Distributor Type id
|
46
|
+
#
|
47
|
+
# @return [string]
|
45
48
|
def self.type_id
|
46
49
|
'export_distributor'
|
47
50
|
end
|
@@ -50,7 +53,7 @@ module Runcible
|
|
50
53
|
#
|
51
54
|
# @return [Hash]
|
52
55
|
def config
|
53
|
-
to_ret =
|
56
|
+
to_ret = as_json
|
54
57
|
to_ret.delete('auto_publish')
|
55
58
|
to_ret.delete('id')
|
56
59
|
to_ret
|
@@ -26,13 +26,13 @@ require 'active_support/json'
|
|
26
26
|
|
27
27
|
|
28
28
|
module Runcible
|
29
|
-
module
|
29
|
+
module Models
|
30
30
|
|
31
31
|
# Generic class to represent Pulp Importers
|
32
32
|
# Child classes should supply id & config methods
|
33
33
|
class Importer
|
34
34
|
def initialize(params={})
|
35
|
-
params.each{|k,v|
|
35
|
+
params.each{|k,v| send("#{k.to_s}=",v)}
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -25,7 +25,7 @@ require 'active_support/json'
|
|
25
25
|
require 'securerandom'
|
26
26
|
|
27
27
|
module Runcible
|
28
|
-
module
|
28
|
+
module Models
|
29
29
|
class IsoDistributor < Distributor
|
30
30
|
#required
|
31
31
|
attr_accessor "serve_http", "serve_https"
|
@@ -41,6 +41,9 @@ module Runcible
|
|
41
41
|
super({})
|
42
42
|
end
|
43
43
|
|
44
|
+
# Distributor Type id
|
45
|
+
#
|
46
|
+
# @return [string]
|
44
47
|
def self.type_id
|
45
48
|
'iso_distributor'
|
46
49
|
end
|
@@ -49,7 +52,7 @@ module Runcible
|
|
49
52
|
#
|
50
53
|
# @return [Hash]
|
51
54
|
def config
|
52
|
-
to_ret =
|
55
|
+
to_ret = as_json
|
53
56
|
to_ret.delete('auto_publish')
|
54
57
|
to_ret.delete('id')
|
55
58
|
to_ret
|
@@ -22,7 +22,7 @@
|
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
23
|
|
24
24
|
module Runcible
|
25
|
-
module
|
25
|
+
module Models
|
26
26
|
class IsoImporter < Importer
|
27
27
|
ID = 'iso_importer'
|
28
28
|
|
@@ -41,7 +41,7 @@ module Runcible
|
|
41
41
|
#
|
42
42
|
# @return [Hash]
|
43
43
|
def config
|
44
|
-
|
44
|
+
as_json
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Copyright (c) 2013 Red Hat Inc.
|
2
|
+
#
|
3
|
+
# MIT License
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
require 'active_support/json'
|
25
|
+
require 'securerandom'
|
26
|
+
|
27
|
+
module Runcible
|
28
|
+
module Models
|
29
|
+
class NodesHttpDistributor < Distributor
|
30
|
+
#required
|
31
|
+
attr_accessor "http", "https"
|
32
|
+
|
33
|
+
# Instantiates a export distributor
|
34
|
+
#
|
35
|
+
# @param [boolean] http serve the contents over http
|
36
|
+
# @param [boolean] https serve the contents over https
|
37
|
+
# @return [Runcible::Extensions::ExportDistributor]
|
38
|
+
def initialize()
|
39
|
+
# Pulp seems to expect the ID to be export_distributor, not a random
|
40
|
+
super({:id => type_id})
|
41
|
+
end
|
42
|
+
|
43
|
+
# Distributor Type id
|
44
|
+
#
|
45
|
+
# @return [string]
|
46
|
+
def self.type_id
|
47
|
+
'nodes_http_distributor'
|
48
|
+
end
|
49
|
+
|
50
|
+
# generate the pulp config for the export distributor
|
51
|
+
#
|
52
|
+
# @return [Hash]
|
53
|
+
def config
|
54
|
+
to_ret = as_json
|
55
|
+
to_ret.delete('auto_publish')
|
56
|
+
to_ret.delete('id')
|
57
|
+
to_ret
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -25,7 +25,9 @@ require 'active_support/json'
|
|
25
25
|
require 'securerandom'
|
26
26
|
|
27
27
|
module Runcible
|
28
|
-
module
|
28
|
+
module Models
|
29
|
+
# Requires the pulp-katello-plugins
|
30
|
+
# https://github.com/Katello/pulp-katello-plugins
|
29
31
|
class YumCloneDistributor < Distributor
|
30
32
|
|
31
33
|
#optional
|
@@ -25,7 +25,7 @@ require 'active_support/json'
|
|
25
25
|
require 'securerandom'
|
26
26
|
|
27
27
|
module Runcible
|
28
|
-
module
|
28
|
+
module Models
|
29
29
|
class YumDistributor < Distributor
|
30
30
|
#required
|
31
31
|
attr_accessor "relative_url", "http", "https"
|
@@ -46,7 +46,7 @@ module Runcible
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def config
|
49
|
-
to_ret =
|
49
|
+
to_ret = as_json
|
50
50
|
to_ret.delete('auto_publish')
|
51
51
|
to_ret.delete('id')
|
52
52
|
to_ret
|
@@ -22,7 +22,7 @@
|
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
23
|
|
24
24
|
module Runcible
|
25
|
-
module
|
25
|
+
module Models
|
26
26
|
class YumImporter < Importer
|
27
27
|
ID = 'yum_importer'
|
28
28
|
|
@@ -37,7 +37,7 @@ module Runcible
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def config
|
40
|
-
|
40
|
+
as_json
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -40,7 +40,7 @@ module Runcible
|
|
40
40
|
# @param [String] id the ID of the consumer
|
41
41
|
# @param [Hash] optional container for all optional parameters
|
42
42
|
# @return [RestClient::Response]
|
43
|
-
def
|
43
|
+
def create(id, optional={})
|
44
44
|
required = required_params(binding.send(:local_variables), binding)
|
45
45
|
call(:post, path, :payload => { :required => required, :optional => optional })
|
46
46
|
end
|
@@ -49,7 +49,7 @@ module Runcible
|
|
49
49
|
#
|
50
50
|
# @param [String] id the ID of the consumer
|
51
51
|
# @return [RestClient::Response]
|
52
|
-
def
|
52
|
+
def retrieve(id)
|
53
53
|
call(:get, path(id))
|
54
54
|
end
|
55
55
|
|
@@ -58,7 +58,7 @@ module Runcible
|
|
58
58
|
# @param [String] id the ID of the consumer
|
59
59
|
# @param [Hash] optional container for all optional parameters
|
60
60
|
# @return [RestClient::Response]
|
61
|
-
def
|
61
|
+
def update(id, optional={})
|
62
62
|
call(:put, path(id), :payload => { :delta => optional })
|
63
63
|
end
|
64
64
|
|
@@ -66,7 +66,7 @@ module Runcible
|
|
66
66
|
#
|
67
67
|
# @param [String] id the id of the consumer
|
68
68
|
# @return [RestClient::Response]
|
69
|
-
def
|
69
|
+
def delete(id)
|
70
70
|
call(:delete, path(id))
|
71
71
|
end
|
72
72
|
|
@@ -76,7 +76,7 @@ module Runcible
|
|
76
76
|
# @param [String] content_type the content type
|
77
77
|
# @param [Hash] profile hash representing the consumer profile
|
78
78
|
# @return [RestClient::Response]
|
79
|
-
def
|
79
|
+
def upload_profile(id, content_type, profile)
|
80
80
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
81
81
|
call(:post, path("#{id}/profiles/"), :payload => { :required => required })
|
82
82
|
end
|
@@ -86,7 +86,7 @@ module Runcible
|
|
86
86
|
# @param [String] id the ID of the consumer
|
87
87
|
# @param [String] content_type the content type
|
88
88
|
# @return [RestClient::Response]
|
89
|
-
def
|
89
|
+
def retrieve_profile(id, content_type)
|
90
90
|
call(:get, path("#{id}/profiles/#{content_type}/"))
|
91
91
|
end
|
92
92
|
|
@@ -96,7 +96,7 @@ module Runcible
|
|
96
96
|
# @param [String] repo_id the ID of the repository
|
97
97
|
# @param [String] distributor_id the ID of the distributor
|
98
98
|
# @return [RestClient::Response]
|
99
|
-
def
|
99
|
+
def retrieve_binding(id, repo_id, distributor_id)
|
100
100
|
call(:get, path("#{id}/bindings/#{repo_id}/#{distributor_id}"))
|
101
101
|
end
|
102
102
|
|
@@ -104,7 +104,7 @@ module Runcible
|
|
104
104
|
#
|
105
105
|
# @param [String] id the ID of the consumer
|
106
106
|
# @return [RestClient::Response]
|
107
|
-
def
|
107
|
+
def retrieve_bindings(id)
|
108
108
|
call(:get, path("#{id}/bindings/"))
|
109
109
|
end
|
110
110
|
|
@@ -115,7 +115,7 @@ module Runcible
|
|
115
115
|
# @param [String] distributor_id the ID of the distributor
|
116
116
|
# @param [Hash] optional optional parameters
|
117
117
|
# @return [RestClient::Response]
|
118
|
-
def
|
118
|
+
def bind(id, repo_id, distributor_id, optional={})
|
119
119
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
120
120
|
call(:post, path("#{id}/bindings/"), :payload => { :required => required, :optional=>optional })
|
121
121
|
end
|
@@ -126,7 +126,7 @@ module Runcible
|
|
126
126
|
# @param [String] repo_id the ID of the repository
|
127
127
|
# @param [String] distributor_id the ID of the distributor
|
128
128
|
# @return [RestClient::Response]
|
129
|
-
def
|
129
|
+
def unbind(id, repo_id, distributor_id)
|
130
130
|
call(:delete, path("#{id}/bindings/#{repo_id}/#{distributor_id}"))
|
131
131
|
end
|
132
132
|
|
@@ -136,7 +136,7 @@ module Runcible
|
|
136
136
|
# @param [Array] units array of units to install
|
137
137
|
# @param [Hash] options hash of install options
|
138
138
|
# @return [RestClient::Response]
|
139
|
-
def
|
139
|
+
def install_units(id, units, options={})
|
140
140
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
141
141
|
call(:post, path("#{id}/actions/content/install/"), :payload => { :required => required })
|
142
142
|
end
|
@@ -147,7 +147,7 @@ module Runcible
|
|
147
147
|
# @param [Array] units array of units to update
|
148
148
|
# @param [Hash] options hash of update options
|
149
149
|
# @return [RestClient::Response]
|
150
|
-
def
|
150
|
+
def update_units(id, units, options={})
|
151
151
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
152
152
|
call(:post, path("#{id}/actions/content/update/"), :payload => { :required => required })
|
153
153
|
end
|
@@ -158,7 +158,7 @@ module Runcible
|
|
158
158
|
# @param [Array] units array of units to uninstall
|
159
159
|
# @param [Hash] options hash of uninstall options
|
160
160
|
# @return [RestClient::Response]
|
161
|
-
def
|
161
|
+
def uninstall_units(id, units, options={})
|
162
162
|
required = required_params(binding.send(:local_variables), binding, ["id"])
|
163
163
|
call(:post, path("#{id}/actions/content/uninstall/"), :payload => { :required => required })
|
164
164
|
end
|
@@ -167,7 +167,7 @@ module Runcible
|
|
167
167
|
#
|
168
168
|
# @param [Hash] options hash of uninstall options
|
169
169
|
# @return [RestClient::Response]
|
170
|
-
def
|
170
|
+
def applicability(options={})
|
171
171
|
call(:post, path("actions/content/applicability/"), :payload => { :required => options })
|
172
172
|
end
|
173
173
|
|