Module: NexusCli::SmartProxyActions
- Included in:
- ProRemote
- Defined in:
- lib/nexus_cli/mixins/pro/smart_proxy_actions.rb
Overview
Instance Method Summary collapse
-
#add_trusted_key(certificate, description, path = true) ⇒ Boolean
Adds a trusted key to Nexus for use with Smart Proxy.
-
#delete_trusted_key(key_id) ⇒ Boolean
Deletes a trusted key from the Nexus server.
-
#disable_artifact_publish(repository_id) ⇒ Boolean
Disables artifact publishing for the given [repository_id].
-
#disable_artifact_subscribe(repository_id) ⇒ Boolean
Disables artifact subscribing for the given [repository_id].
-
#disable_smart_proxy ⇒ Boolean
Disables Smart Proxy on the Nexus server.
-
#enable_artifact_publish(repository_id) ⇒ Boolean
Enables artifact publishing for the given [repository_id].
-
#enable_artifact_subscribe(repository_id, preemptive_fetch) ⇒ Boolean
Enables artifact subscribing for the given [repository_id].
-
#enable_smart_proxy(host = nil, port = nil) ⇒ Boolean
Enables Smart Proxy on the Nexus server.
-
#get_pub_sub(repository_id) ⇒ String
Gets Smart Proxy related information about the given [repository_id].
-
#get_smart_proxy_key ⇒ Object
deprecated
Deprecated.
this method might not be used.
-
#get_smart_proxy_settings ⇒ String
Gets the current Smart Proxy settings of the Nexus server.
-
#get_trusted_keys ⇒ String
Gets information about the current list of trusted keys in the Nexus server.
Instance Method Details
#add_trusted_key(certificate, description, path = true) ⇒ Boolean
Adds a trusted key to Nexus for use with Smart Proxy. By default, the [certificate] parameter will point to a path of a certificate file. As an alternative, call with path=false to pass a certificate in directly.
128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 128 def add_trusted_key(certificate, description, path=true) params = {:description => description} params[:certificate] = path ? File.read(File.(certificate)) : certificate response = nexus.post(nexus_url("service/local/smartproxy/trusted-keys"), :body => create_add_trusted_key_json(params), :header => DEFAULT_CONTENT_TYPE_HEADER) case response.status when 201 return true else raise UnexpectedStatusCodeException.new(response.status) end end |
#delete_trusted_key(key_id) ⇒ Boolean
Deletes a trusted key from the Nexus server.
145 146 147 148 149 150 151 152 153 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 145 def delete_trusted_key(key_id) response = nexus.delete(nexus_url("service/local/smartproxy/trusted-keys/#{key_id}")) case response.status when 204 return true else raise UnexpectedStatusCodeException.new(response.status) end end |
#disable_artifact_publish(repository_id) ⇒ Boolean
Disables artifact publishing for the given [repository_id].
37 38 39 40 41 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 37 def disable_artifact_publish(repository_id) params = {:repositoryId => repository_id} params[:publish] = false artifact_publish(repository_id, params) end |
#disable_artifact_subscribe(repository_id) ⇒ Boolean
Disables artifact subscribing for the given [repository_id].
63 64 65 66 67 68 69 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 63 def disable_artifact_subscribe(repository_id) raise NotProxyRepositoryException.new(repository_id) unless is_proxy_repository?(get_repository_info(repository_id)) params = {:repositoryId => repository_id} params[:subscribe] = false artifact_subscribe(repository_id, params) end |
#disable_smart_proxy ⇒ Boolean
Disables Smart Proxy on the Nexus server.
88 89 90 91 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 88 def disable_smart_proxy params = {:enabled => false} smart_proxy(params) end |
#enable_artifact_publish(repository_id) ⇒ Boolean
Enables artifact publishing for the given [repository_id].
26 27 28 29 30 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 26 def enable_artifact_publish(repository_id) params = {:repositoryId => repository_id} params[:publish] = true artifact_publish(repository_id, params) end |
#enable_artifact_subscribe(repository_id, preemptive_fetch) ⇒ Boolean
Enables artifact subscribing for the given [repository_id].
49 50 51 52 53 54 55 56 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 49 def enable_artifact_subscribe(repository_id, preemptive_fetch) raise NotProxyRepositoryException.new(repository_id) unless is_proxy_repository?(get_repository_info(repository_id)) params = {:repositoryId => repository_id} params[:subscribe] = true params[:preemptiveFetch] = preemptive_fetch artifact_subscribe(repository_id, params) end |
#enable_smart_proxy(host = nil, port = nil) ⇒ Boolean
Enables Smart Proxy on the Nexus server.
77 78 79 80 81 82 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 77 def enable_smart_proxy(host=nil, port=nil) params = {:enabled => true} params[:host] = host unless host.nil? params[:port] = port unless port.nil? smart_proxy(params) end |
#get_pub_sub(repository_id) ⇒ String
Gets Smart Proxy related information about the given [repository_id].
11 12 13 14 15 16 17 18 19 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 11 def get_pub_sub(repository_id) response = nexus.get(nexus_url("service/local/smartproxy/pub-sub/#{repository_id}")) case response.status when 200 return response.content else raise UnexpectedStatusCodeException.new(response.status) end end |
#get_smart_proxy_key ⇒ Object
this method might not be used.
109 110 111 112 113 114 115 116 117 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 109 def get_smart_proxy_key response = nexus.get(nexus_url("service/local/smartproxy/settings"), :header => DEFAULT_ACCEPT_HEADER) case response.status when 200 return response.content else raise UnexpectedStatusCodeException.new(response.status) end end |
#get_smart_proxy_settings ⇒ String
Gets the current Smart Proxy settings of the Nexus server.
98 99 100 101 102 103 104 105 106 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 98 def get_smart_proxy_settings response = nexus.get(nexus_url("service/local/smartproxy/settings"), :header => DEFAULT_ACCEPT_HEADER) case response.status when 200 return response.content else raise UnexpectedStatusCodeException.new(response.status) end end |
#get_trusted_keys ⇒ String
Gets information about the current list of trusted keys in the Nexus server. A large amount of JSON will be printed because this resource returns the actual certificates.
160 161 162 163 164 165 166 167 168 |
# File 'lib/nexus_cli/mixins/pro/smart_proxy_actions.rb', line 160 def get_trusted_keys response = nexus.get(nexus_url("service/local/smartproxy/trusted-keys"), :header => DEFAULT_ACCEPT_HEADER) case response.status when 200 return response.content else raise UnexpectedStatusCodeException.new(response.status) end end |