Class: Nahook::Management
- Inherits:
-
Object
- Object
- Nahook::Management
- Defined in:
- lib/nahook/management.rb
Overview
Client for the Nahook Management API.
Provides programmatic access to manage workspaces, endpoints, event types, applications, subscriptions, and portal sessions. Intended for server-side use with a management token.
Unlike Client, the Management client does not support retries – management operations are not idempotent by default.
Instance Attribute Summary collapse
- #applications ⇒ Resources::Applications readonly
- #endpoints ⇒ Resources::Endpoints readonly
- #environments ⇒ Resources::Environments readonly
- #event_types ⇒ Resources::EventTypes readonly
- #portal_sessions ⇒ Resources::PortalSessions readonly
- #subscriptions ⇒ Resources::Subscriptions readonly
Instance Method Summary collapse
-
#initialize(token, base_url: HttpClient::DEFAULT_BASE_URL, timeout_ms: HttpClient::DEFAULT_TIMEOUT_MS) ⇒ Management
constructor
A new instance of Management.
Constructor Details
#initialize(token, base_url: HttpClient::DEFAULT_BASE_URL, timeout_ms: HttpClient::DEFAULT_TIMEOUT_MS) ⇒ Management
Returns a new instance of Management.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/nahook/management.rb', line 48 def initialize(token, base_url: HttpClient::DEFAULT_BASE_URL, timeout_ms: HttpClient::DEFAULT_TIMEOUT_MS) unless token.start_with?("nhm_") raise ArgumentError, "Invalid management token: must start with 'nhm_'" end http = HttpClient.new(token: token, base_url: base_url, timeout_ms: timeout_ms) @endpoints = Resources::Endpoints.new(http) @event_types = Resources::EventTypes.new(http) @applications = Resources::Applications.new(http) @subscriptions = Resources::Subscriptions.new(http) @portal_sessions = Resources::PortalSessions.new(http) @environments = Resources::Environments.new(http) end |
Instance Attribute Details
#applications ⇒ Resources::Applications (readonly)
33 34 35 |
# File 'lib/nahook/management.rb', line 33 def applications @applications end |
#endpoints ⇒ Resources::Endpoints (readonly)
27 28 29 |
# File 'lib/nahook/management.rb', line 27 def endpoints @endpoints end |
#environments ⇒ Resources::Environments (readonly)
42 43 44 |
# File 'lib/nahook/management.rb', line 42 def environments @environments end |
#event_types ⇒ Resources::EventTypes (readonly)
30 31 32 |
# File 'lib/nahook/management.rb', line 30 def event_types @event_types end |
#portal_sessions ⇒ Resources::PortalSessions (readonly)
39 40 41 |
# File 'lib/nahook/management.rb', line 39 def portal_sessions @portal_sessions end |
#subscriptions ⇒ Resources::Subscriptions (readonly)
36 37 38 |
# File 'lib/nahook/management.rb', line 36 def subscriptions @subscriptions end |