Class: Kamal::Providers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/kamal/providers/base.rb

Overview

Abstract base class defining the provider adapter interface All cloud provider implementations must inherit from this class and implement the required methods.

Example implementation:

class MyProvider < Kamal::Providers::Base
def provision_vm(config)
  # Implementation here
end
end

Direct Known Subclasses

Upcloud

Instance Method Summary collapse

Instance Method Details

#destroy_vm(vm_id) ⇒ Boolean

Destroy VM and cleanup all associated resources

Raises:



98
99
100
# File 'lib/kamal/providers/base.rb', line 98

def destroy_vm(vm_id)
  raise NotImplementedError, "#{self.class}#destroy_vm must be implemented"
end

#estimate_cost(config) ⇒ Hash

Estimate monthly cost for VM configuration

This provides generic cost guidance and pricing page link. Real-time pricing queries are not implemented in Phase 1.

Raises:

  • (NotImplementedError)


116
117
118
# File 'lib/kamal/providers/base.rb', line 116

def estimate_cost(config)
  raise NotImplementedError, "#{self.class}#estimate_cost must be implemented"
end

#provision_vm(config) ⇒ Hash

Provision a new VM

Raises:

  • (AuthenticationError)

    if credentials are invalid @raise [QuotaExceededError] if provider quota is exceeded @raise [TimeoutError] if VM doesn't start within timeout period @raise [ProvisioningError] for other provisioning failures



72
73
74
# File 'lib/kamal/providers/base.rb', line 72

def provision_vm(config)
  raise NotImplementedError, "#{self.class}#provision_vm must be implemented"
end

#query_status(vm_id) ⇒ Symbol

Query VM status

Raises:



87
88
89
# File 'lib/kamal/providers/base.rb', line 87

def query_status(vm_id)
  raise NotImplementedError, "#{self.class}#query_status must be implemented"
end