Module: DataPlaneApi::Server
- Defined in:
- lib/data_plane_api/server.rb
Overview
Wraps endpoints regarding HAProxy servers.
Constant Summary collapse
- ADMIN_STATES =
T.let(::Set[:ready, :maint, :drain], T::Set[Symbol])
- OPERATIONAL_STATES =
T.let(::Set[:up, :down, :stopping], T::Set[Symbol])
Class Method Summary collapse
-
.get_runtime_settings(backend:, name: nil, config: nil) ⇒ Object
: (String?, String?, Configuration?) -> Faraday::Response?.
-
.update_transient_settings(backend:, name:, settings:, config: nil) ⇒ Object
: (String?, String?, Hash[top, top], Configuration?) -> Faraday::Response?.
Class Method Details
.get_runtime_settings(backend:, name: nil, config: nil) ⇒ Object
: (String?, String?, Configuration?) -> Faraday::Response?
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/data_plane_api/server.rb', line 18 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) ⇒ Object
: (String?, String?, Hash[top, top], Configuration?) -> Faraday::Response?
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/data_plane_api/server.rb', line 34 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 |