Class: Smplkit::ManagementClient

Inherits:
Object
  • Object
show all
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).

Each namespace is wired to a generated SmplkitGeneratedClient ApiClient under the hood — auth, request encoding, and response parsing flow through the openapi-generator-produced layer in lib/smplkit/_generated. The wrapper layer keeps the customer-facing domain models (Flag, Config, etc.) and converts at the boundary via the existing <resource>_from_resource helpers.

Defined Under Namespace

Modules: ErrorMapping, ResourceShim Classes: AccountSettingsNamespace, ConfigNamespace, ContextTypesNamespace, ContextsNamespace, EnvironmentsNamespace, FlagsNamespace, LogGroupsNamespace, LoggersNamespace

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, base_domain: nil, scheme: nil, profile: nil, debug: nil, _resolved: nil) ⇒ ManagementClient

Returns a new instance of ManagementClient.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/smplkit/management/client.rb', line 37

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_api_client = build_api_client(SmplkitGeneratedClient::App, "app", cfg)
  @config_api_client = build_api_client(SmplkitGeneratedClient::Config, "config", cfg)
  @flags_api_client = build_api_client(SmplkitGeneratedClient::Flags, "flags", cfg)
  @logging_api_client = build_api_client(SmplkitGeneratedClient::Logging, "logging", cfg)

  @contexts = ContextsNamespace.new(@app_api_client)
  @context_types = ContextTypesNamespace.new(@app_api_client)
  @environments = EnvironmentsNamespace.new(@app_api_client)
  @account_settings = AccountSettingsNamespace.new(@app_api_client)
  @config = ConfigNamespace.new(@config_api_client)
  @flags = FlagsNamespace.new(@flags_api_client)
  @loggers = LoggersNamespace.new(@logging_api_client)
  @log_groups = LogGroupsNamespace.new(@logging_api_client)
end

Instance Attribute Details

#account_settingsObject (readonly)

Returns the value of attribute account_settings.



30
31
32
# File 'lib/smplkit/management/client.rb', line 30

def 
  @account_settings
end

#configObject (readonly)

Returns the value of attribute config.



30
31
32
# File 'lib/smplkit/management/client.rb', line 30

def config
  @config
end

#context_typesObject (readonly)

Returns the value of attribute context_types.



30
31
32
# File 'lib/smplkit/management/client.rb', line 30

def context_types
  @context_types
end

#contextsObject (readonly)

Returns the value of attribute contexts.



30
31
32
# File 'lib/smplkit/management/client.rb', line 30

def contexts
  @contexts
end

#environmentsObject (readonly)

Returns the value of attribute environments.



30
31
32
# File 'lib/smplkit/management/client.rb', line 30

def environments
  @environments
end

#flagsObject (readonly)

Returns the value of attribute flags.



30
31
32
# File 'lib/smplkit/management/client.rb', line 30

def flags
  @flags
end

#log_groupsObject (readonly)

Returns the value of attribute log_groups.



30
31
32
# File 'lib/smplkit/management/client.rb', line 30

def log_groups
  @log_groups
end

#loggersObject (readonly)

Returns the value of attribute loggers.



30
31
32
# File 'lib/smplkit/management/client.rb', line 30

def loggers
  @loggers
end

Class Method Details

.from_resolved(resolved) ⇒ Object



33
34
35
# File 'lib/smplkit/management/client.rb', line 33

def self.from_resolved(resolved)
  new(_resolved: resolved)
end

Instance Method Details

#_app_httpObject



69
# File 'lib/smplkit/management/client.rb', line 69

def _app_http = @app_api_client

#_config_httpObject



70
# File 'lib/smplkit/management/client.rb', line 70

def _config_http = @config_api_client

#_flags_httpObject



71
# File 'lib/smplkit/management/client.rb', line 71

def _flags_http = @flags_api_client

#_logging_httpObject



72
# File 'lib/smplkit/management/client.rb', line 72

def _logging_http = @logging_api_client

#_resolvedObject



68
# File 'lib/smplkit/management/client.rb', line 68

def _resolved = @resolved

#closeObject



63
64
65
66
# File 'lib/smplkit/management/client.rb', line 63

def close
  # The generated ApiClient owns Faraday connections that release on GC.
  # No explicit shutdown is exposed; this stub keeps the API stable.
end