Class: Smplkit::ManagementClient
- Inherits:
-
Object
- Object
- Smplkit::ManagementClient
- Defined in:
- lib/smplkit/management/client.rb
Overview
Top-level management client. Owns the HTTP transports + CRUD APIs for every resource on the smplkit platform.
Sub-namespaces (mirroring the Python SDK):
- +mgmt.contexts.*+
- +mgmt.context_types.*+
- +mgmt.environments.*+
- +mgmt.account_settings.*+
- +mgmt.config.*+
- +mgmt.flags.*+
- +mgmt.loggers.*+
- +mgmt.log_groups.*+
Constructable both as Smplkit::ManagementClient.new (standalone) and as Smplkit::Client#manage (shared transports).
Defined Under Namespace
Modules: HttpHelpers Classes: AccountSettingsNamespace, ConfigNamespace, ContextTypesNamespace, ContextsNamespace, EnvironmentsNamespace, FlagsNamespace, LogGroupsNamespace, LoggersNamespace
Instance Attribute Summary collapse
-
#account_settings ⇒ Object
readonly
Returns the value of attribute account_settings.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#context_types ⇒ Object
readonly
Returns the value of attribute context_types.
-
#contexts ⇒ Object
readonly
Returns the value of attribute contexts.
-
#environments ⇒ Object
readonly
Returns the value of attribute environments.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#log_groups ⇒ Object
readonly
Returns the value of attribute log_groups.
-
#loggers ⇒ Object
readonly
Returns the value of attribute loggers.
Class Method Summary collapse
Instance Method Summary collapse
- #_app_http ⇒ Object
- #_config_http ⇒ Object
- #_flags_http ⇒ Object
- #_logging_http ⇒ Object
- #_resolved ⇒ Object
- #close ⇒ Object
-
#initialize(api_key: nil, base_domain: nil, scheme: nil, profile: nil, debug: nil, _resolved: nil) ⇒ ManagementClient
constructor
A new instance of ManagementClient.
Constructor Details
#initialize(api_key: nil, base_domain: nil, scheme: nil, profile: nil, debug: nil, _resolved: nil) ⇒ ManagementClient
Returns a new instance of ManagementClient.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/smplkit/management/client.rb', line 32 def initialize(api_key: nil, base_domain: nil, scheme: nil, profile: nil, debug: nil, _resolved: nil) cfg = _resolved || ConfigResolution.resolve_management_config( api_key: api_key, base_domain: base_domain, scheme: scheme, profile: profile, debug: debug ) Smplkit.enable_debug if cfg.debug @resolved = cfg @app_http = build_http(ConfigResolution.service_url(cfg.scheme, "app", cfg.base_domain), cfg.api_key) @config_http = build_http(ConfigResolution.service_url(cfg.scheme, "config", cfg.base_domain), cfg.api_key) @flags_http = build_http(ConfigResolution.service_url(cfg.scheme, "flags", cfg.base_domain), cfg.api_key) @logging_http = build_http(ConfigResolution.service_url(cfg.scheme, "logging", cfg.base_domain), cfg.api_key) @contexts = ContextsNamespace.new(@app_http) @context_types = ContextTypesNamespace.new(@app_http) @environments = EnvironmentsNamespace.new(@app_http) @account_settings = AccountSettingsNamespace.new(@app_http) @config = ConfigNamespace.new(@config_http) @flags = FlagsNamespace.new(@flags_http) @loggers = LoggersNamespace.new(@logging_http) @log_groups = LogGroupsNamespace.new(@logging_http) end |
Instance Attribute Details
#account_settings ⇒ Object (readonly)
Returns the value of attribute account_settings.
25 26 27 |
# File 'lib/smplkit/management/client.rb', line 25 def account_settings @account_settings end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
25 26 27 |
# File 'lib/smplkit/management/client.rb', line 25 def config @config end |
#context_types ⇒ Object (readonly)
Returns the value of attribute context_types.
25 26 27 |
# File 'lib/smplkit/management/client.rb', line 25 def context_types @context_types end |
#contexts ⇒ Object (readonly)
Returns the value of attribute contexts.
25 26 27 |
# File 'lib/smplkit/management/client.rb', line 25 def contexts @contexts end |
#environments ⇒ Object (readonly)
Returns the value of attribute environments.
25 26 27 |
# File 'lib/smplkit/management/client.rb', line 25 def environments @environments end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
25 26 27 |
# File 'lib/smplkit/management/client.rb', line 25 def flags @flags end |
#log_groups ⇒ Object (readonly)
Returns the value of attribute log_groups.
25 26 27 |
# File 'lib/smplkit/management/client.rb', line 25 def log_groups @log_groups end |
#loggers ⇒ Object (readonly)
Returns the value of attribute loggers.
25 26 27 |
# File 'lib/smplkit/management/client.rb', line 25 def loggers @loggers end |
Class Method Details
.from_resolved(resolved) ⇒ Object
28 29 30 |
# File 'lib/smplkit/management/client.rb', line 28 def self.from_resolved(resolved) new(_resolved: resolved) end |
Instance Method Details
#_app_http ⇒ Object
64 |
# File 'lib/smplkit/management/client.rb', line 64 def _app_http = @app_http |
#_config_http ⇒ Object
65 |
# File 'lib/smplkit/management/client.rb', line 65 def _config_http = @config_http |
#_flags_http ⇒ Object
66 |
# File 'lib/smplkit/management/client.rb', line 66 def _flags_http = @flags_http |
#_logging_http ⇒ Object
67 |
# File 'lib/smplkit/management/client.rb', line 67 def _logging_http = @logging_http |
#_resolved ⇒ Object
63 |
# File 'lib/smplkit/management/client.rb', line 63 def _resolved = @resolved |
#close ⇒ Object
57 58 59 60 61 |
# File 'lib/smplkit/management/client.rb', line 57 def close [@app_http, @config_http, @flags_http, @logging_http].each do |conn| conn.close if conn.respond_to?(:close) end end |