Class: Microsandbox::BackendInfo
- Inherits:
-
Object
- Object
- Microsandbox::BackendInfo
- Defined in:
- lib/microsandbox/backend_info.rb
Overview
Secret-safe description of the active default backend, from default_backend_info (runtime v0.6.9). Describes what selected the backend and where it points — never its credential: the API key is deliberately absent.
Instance Attribute Summary collapse
-
#api_url ⇒ String?
readonly
Effective cloud API endpoint (nil for local).
-
#profile ⇒ String?
readonly
The selected profile name, when a profile chose the backend.
Instance Method Summary collapse
- #cloud? ⇒ Boolean
-
#initialize(data) ⇒ BackendInfo
constructor
A new instance of BackendInfo.
- #inspect ⇒ Object
-
#kind ⇒ Symbol
:local or :cloud.
- #local? ⇒ Boolean
-
#source ⇒ Symbol
What selected this backend:
:programmatic(an SDK setter),:MSB_BACKEND/:MSB_API_KEY/:MSB_PROFILE(environment),:profile(an explicit SDK profile constructor),:active_profile(the SDK config file), or:default(the final local fallback).
Constructor Details
#initialize(data) ⇒ BackendInfo
Returns a new instance of BackendInfo.
15 16 17 18 19 20 |
# File 'lib/microsandbox/backend_info.rb', line 15 def initialize(data) @kind = data["kind"] @api_url = data["api_url"] @source = data["source"] @profile = data["profile"] end |
Instance Attribute Details
#api_url ⇒ String? (readonly)
Returns effective cloud API endpoint (nil for local).
10 11 12 |
# File 'lib/microsandbox/backend_info.rb', line 10 def api_url @api_url end |
#profile ⇒ String? (readonly)
Returns the selected profile name, when a profile chose the backend.
13 14 15 |
# File 'lib/microsandbox/backend_info.rb', line 13 def profile @profile end |
Instance Method Details
#cloud? ⇒ Boolean
38 |
# File 'lib/microsandbox/backend_info.rb', line 38 def cloud? = kind == :cloud |
#inspect ⇒ Object
40 41 42 43 44 |
# File 'lib/microsandbox/backend_info.rb', line 40 def inspect "#<Microsandbox::BackendInfo kind=#{@kind} source=#{@source.inspect}" \ "#{" api_url=#{@api_url.inspect}" if @api_url}" \ "#{" profile=#{@profile.inspect}" if @profile}>" end |
#kind ⇒ Symbol
Returns :local or :cloud.
23 24 25 |
# File 'lib/microsandbox/backend_info.rb', line 23 def kind @kind.to_sym end |
#local? ⇒ Boolean
36 |
# File 'lib/microsandbox/backend_info.rb', line 36 def local? = kind == :local |
#source ⇒ Symbol
What selected this backend: :programmatic (an SDK setter),
:MSB_BACKEND / :MSB_API_KEY / :MSB_PROFILE (environment),
:profile (an explicit SDK profile constructor), :active_profile
(the SDK config file), or :default (the final local fallback).
32 33 34 |
# File 'lib/microsandbox/backend_info.rb', line 32 def source @source.to_sym end |