Module: DataPlaneApi::Server
- Defined in:
- lib/data_plane_api/server.rb
Overview
Wraps endpoints regarding HAProxy servers.
Constant Summary collapse
- ADMIN_STATES =
::Set[:ready, :maint, :drain]
- OPERATIONAL_STATES =
::Set[:up, :down, :stopping]
Class Method Summary collapse
- .get_runtime_settings(backend:, name: nil, config: nil) ⇒ Faraday::Response
- .update_transient_settings(backend:, name:, settings:, config: nil) ⇒ Faraday::Response
Class Method Details
.get_runtime_settings(backend:, name: nil, config: nil) ⇒ Faraday::Response
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/data_plane_api/server.rb', line 21 def get_runtime_settings(backend:, name: nil, config: nil) config ||= CONFIG if backend.nil? || backend.empty? raise ::ArgumentError, "`backend` should be present but was `#{backend.inspect}`" end path = "services/haproxy/runtime/servers/#{name}".delete_suffix('/') send_request(method: :get, path: path, config: config) do |req| req.params[:backend] = backend end end |
.update_transient_settings(backend:, name:, settings:, config: nil) ⇒ Faraday::Response
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/data_plane_api/server.rb', line 39 def update_transient_settings(backend:, name:, settings:, config: nil) config ||= CONFIG if backend.nil? || backend.empty? raise ::ArgumentError, "`backend` should be present but was `#{backend.inspect}`" end raise ::ArgumentError, "`name` should be present but was `#{name.inspect}`" if name.nil? || name.empty? path = "services/haproxy/runtime/servers/#{name}" send_request(method: :put, path: path, config: config) do |req| req.params[:backend] = backend req.body = settings end end |