Class: Gjallarhorn::Adapter::Base
- Inherits:
-
Object
- Object
- Gjallarhorn::Adapter::Base
- Defined in:
- lib/gjallarhorn/adapter/base.rb
Overview
Abstract base class for all cloud provider adapters
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Hash
readonly
Configuration hash for this adapter.
-
#logger ⇒ Logger
readonly
Logger instance for adapter operations.
Instance Method Summary collapse
-
#deploy(image:, environment:, services: []) ⇒ void
abstract
Deploy a container image with the specified services.
-
#health_check(service:) ⇒ Boolean
abstract
Check the health status of a specific service.
-
#initialize(config) ⇒ Base
constructor
Initialize a new adapter instance.
-
#logs(service:, lines: 100) ⇒ String
abstract
Retrieve logs from a specific service.
-
#rollback(version:) ⇒ void
abstract
Rollback services to a previous version.
-
#scale(service:, replicas:) ⇒ void
abstract
Scale a service to the specified number of replicas.
-
#status ⇒ Array<String>
abstract
Get the current status of all services.
Constructor Details
#initialize(config) ⇒ Base
Initialize a new adapter instance
36 37 38 39 |
# File 'lib/gjallarhorn/adapter/base.rb', line 36 def initialize(config) @config = config @logger = Logger.new($stdout) end |
Instance Attribute Details
#config ⇒ Hash (readonly)
Returns Configuration hash for this adapter.
28 29 30 |
# File 'lib/gjallarhorn/adapter/base.rb', line 28 def config @config end |
#logger ⇒ Logger (readonly)
Returns Logger instance for adapter operations.
31 32 33 |
# File 'lib/gjallarhorn/adapter/base.rb', line 31 def logger @logger end |
Instance Method Details
#deploy(image:, environment:, services: []) ⇒ void
Subclasses must implement this method
This method returns an undefined value.
Deploy a container image with the specified services
49 50 51 |
# File 'lib/gjallarhorn/adapter/base.rb', line 49 def deploy(image:, environment:, services: []) raise NotImplementedError, "Subclasses must implement deploy" end |
#health_check(service:) ⇒ Boolean
Subclasses must implement this method
Check the health status of a specific service
78 79 80 |
# File 'lib/gjallarhorn/adapter/base.rb', line 78 def health_check(service:) raise NotImplementedError, "Subclasses must implement health_check" end |
#logs(service:, lines: 100) ⇒ String
Subclasses must implement this method
Retrieve logs from a specific service
100 101 102 |
# File 'lib/gjallarhorn/adapter/base.rb', line 100 def logs(service:, lines: 100) raise NotImplementedError, "Subclasses must implement logs" end |
#rollback(version:) ⇒ void
Subclasses must implement this method
This method returns an undefined value.
Rollback services to a previous version
59 60 61 |
# File 'lib/gjallarhorn/adapter/base.rb', line 59 def rollback(version:) raise NotImplementedError, "Subclasses must implement rollback" end |
#scale(service:, replicas:) ⇒ void
Subclasses must implement this method
This method returns an undefined value.
Scale a service to the specified number of replicas
89 90 91 |
# File 'lib/gjallarhorn/adapter/base.rb', line 89 def scale(service:, replicas:) raise NotImplementedError, "Subclasses must implement scale" end |
#status ⇒ Array<String>
Subclasses must implement this method
Get the current status of all services
68 69 70 |
# File 'lib/gjallarhorn/adapter/base.rb', line 68 def status raise NotImplementedError, "Subclasses must implement status" end |