Module: HammerCLIKatello::SearchOptionsCreators
Instance Method Summary
collapse
-
#create_content_view_filter_rules_search_options(options, mode = nil) ⇒ Object
-
#create_content_view_versions_search_options(options, _mode = nil) ⇒ Object
-
#create_content_views_search_options(options, _mode = nil) ⇒ Object
-
#create_file_units_search_options(options, mode = nil) ⇒ Object
-
#create_host_collections_search_options(options, mode = nil) ⇒ Object
-
#create_lifecycle_environments_search_options(options, mode = nil) ⇒ Object
-
#create_module_streams_search_options(options, mode = nil) ⇒ Object
-
#create_repositories_search_options(options, _mode = nil) ⇒ Object
-
#create_repository_sets_search_options(options, mode = nil) ⇒ Object
-
#create_search_options_with_katello_api(options, resource, mode = nil) ⇒ Object
#create_architectures_search_options, #create_capsules_search_options, #create_compute_profiles_search_options, #create_compute_resources_search_options, #create_domains_search_options, #create_environments_search_options, #create_hostgroups_search_options, #create_hosts_search_options, #create_http_proxies_search_options, #create_images_search_options, #create_locations_search_options, #create_media_search_options, #create_operatingsystems_search_options, #create_organizations_search_options, #create_packages_search_options, #create_ptables_search_options, #create_realms_search_options, #create_smart_proxies_search_options, #create_subnets_search_options, #create_usergroups_search_options, #create_users_search_options
Instance Method Details
#create_content_view_filter_rules_search_options(options, mode = nil) ⇒ Object
24
25
26
27
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 24
def create_content_view_filter_rules_search_options(options, mode = nil)
create_search_options_without_katello_api(
options, api.resource(:content_view_filter_rules), mode)
end
|
#create_content_view_versions_search_options(options, _mode = nil) ⇒ Object
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 72
def create_content_view_versions_search_options(options, _mode = nil)
environment_id = options[HammerCLI.option_accessor_name("environment_id")]
content_view_id = options[HammerCLI.option_accessor_name("content_view_id")]
version = options[HammerCLI.option_accessor_name("version")]
versions = options[HammerCLI.option_accessor_name("versions")]
search_options = {}
if versions
search_options.merge!(
create_search_options_without_katello_api(options, api.resource(:content_view_versions))
)
end
search_options['content_view_id'] = content_view_id if content_view_id
search_options['environment_id'] = environment_id if environment_id && content_view_id
search_options['version'] = version if version
search_options
end
|
#create_content_views_search_options(options, _mode = nil) ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 44
def create_content_views_search_options(options, _mode = nil)
name = options[HammerCLI.option_accessor_name('name')]
organization_id = options[HammerCLI.option_accessor_name("organization_id")] ||
organization_id(scoped_options('organization', options, :single))
search_options = {}
search_options['name'] = name if name
if options['option_content_view_name'] || name
search_options['organization_id'] = organization_id
end
search_options
end
|
#create_file_units_search_options(options, mode = nil) ⇒ Object
19
20
21
22
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 19
def create_file_units_search_options(options, mode = nil)
create_search_options_without_katello_api(options, api.resource(:file_units), mode)
.merge(create_search_options(options, api.resource(:file_units), mode))
end
|
#create_host_collections_search_options(options, mode = nil) ⇒ Object
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 92
def create_host_collections_search_options(options, mode = nil)
options[HammerCLI.option_accessor_name("organization_id")] ||= organization_id(
scoped_options("organization", options, :single)
)
search_options = create_search_options_with_katello_api(
options, api.resource(:host_collections), mode
) || {}
search_options['organization_id'] ||= options['option_organization_id']
search_options
end
|
#create_lifecycle_environments_search_options(options, mode = nil) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 57
def create_lifecycle_environments_search_options(options, mode = nil)
search_options = {}
if mode != :multi
name = options[HammerCLI.option_accessor_name("environment_name")] ||
options[HammerCLI.option_accessor_name("name")]
search_options['name'] = name if name
end
organization_id = organization_id(scoped_options('organization', options, :single))
if options['option_lifecycle_environment_names'] || name
search_options['organization_id'] = organization_id
end
search_options
end
|
#create_module_streams_search_options(options, mode = nil) ⇒ Object
14
15
16
17
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 14
def create_module_streams_search_options(options, mode = nil)
create_search_options_without_katello_api(options, api.resource(:module_streams), mode)
.merge(create_search_options(options, api.resource(:module_streams), mode))
end
|
#create_repositories_search_options(options, _mode = nil) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 29
def create_repositories_search_options(options, _mode = nil)
name = options[HammerCLI.option_accessor_name("name")]
names = options[HammerCLI.option_accessor_name("names")]
product_id = options[HammerCLI.option_accessor_name("product_id")]
search_options = {}
if names
search_options['names'] = names
elsif name
search_options['name'] = name
end
search_options['product_id'] = product_id if product_id
search_options
end
|
#create_repository_sets_search_options(options, mode = nil) ⇒ Object
7
8
9
10
11
12
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 7
def create_repository_sets_search_options(options, mode = nil)
create_search_options(options, api.resource(:repository_sets), mode).merge(
'product_id' => options[HammerCLI.option_accessor_name('product_id')],
'organization_id' => options[HammerCLI.option_accessor_name('organization_id')]
)
end
|
#create_search_options_with_katello_api(options, resource, mode = nil) ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/hammer_cli_katello/search_options_creators.rb', line 103
def create_search_options_with_katello_api(options, resource, mode = nil)
search_options = {}
searchables(resource).each do |s|
value = options[HammerCLI.option_accessor_name(s.name.to_s)]
values = options[HammerCLI.option_accessor_name(s.plural_name.to_s)]
if value && [:single, nil].include?(mode)
search_options.update(s.name.to_s => value.to_s)
elsif values && [:multi, nil].include?(mode)
values.each { |v| search_options.update(s.name.to_s => v.to_s) }
end
end
search_options
end
|