Class: Pangea::Contracts::ClusterResult

Inherits:
Object
  • Object
show all
Defined in:
lib/pangea/contracts/cluster_result.rb

Overview

Base typed result object for the cluster phase. Wraps the backend-specific control plane reference and provides named accessors for common cluster outputs.

Unknown methods are delegated to control_plane_ref for backward compatibility with provider-specific attributes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(control_plane_ref) ⇒ ClusterResult

Returns a new instance of ClusterResult.



30
31
32
# File 'lib/pangea/contracts/cluster_result.rb', line 30

def initialize(control_plane_ref)
  @control_plane_ref = control_plane_ref
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object

Forward unknown methods to control_plane_ref for backward compatibility



81
82
83
84
85
86
87
# File 'lib/pangea/contracts/cluster_result.rb', line 81

def method_missing(method_name, *args, &block)
  if control_plane_ref.respond_to?(method_name)
    control_plane_ref.public_send(method_name, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#control_plane_refObject (readonly)

Returns the value of attribute control_plane_ref.



28
29
30
# File 'lib/pangea/contracts/cluster_result.rb', line 28

def control_plane_ref
  @control_plane_ref
end

Instance Method Details

#arnObject



72
73
74
# File 'lib/pangea/contracts/cluster_result.rb', line 72

def arn
  control_plane_ref.arn
end

#asgObject



39
40
41
# File 'lib/pangea/contracts/cluster_result.rb', line 39

def asg
  control_plane_ref.asg
end

#idObject



68
69
70
# File 'lib/pangea/contracts/cluster_result.rb', line 68

def id
  control_plane_ref.id
end

#launch_templateObject Also known as: lt



43
44
45
# File 'lib/pangea/contracts/cluster_result.rb', line 43

def launch_template
  control_plane_ref.lt
end

#listenerObject



53
54
55
# File 'lib/pangea/contracts/cluster_result.rb', line 53

def listener
  control_plane_ref.listener
end

#nlbObject

Named accessors for common cluster components



35
36
37
# File 'lib/pangea/contracts/cluster_result.rb', line 35

def nlb
  control_plane_ref.nlb
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/pangea/contracts/cluster_result.rb', line 89

def respond_to_missing?(method_name, include_private = false)
  control_plane_ref.respond_to?(method_name, include_private) || super
end

#security_groupObject

Convenience: return a pseudo-reference for security_group access Templates use result.cluster.security_group.id



64
65
66
# File 'lib/pangea/contracts/cluster_result.rb', line 64

def security_group
  SecurityGroupAccessor.new(control_plane_ref.sg_id)
end

#sg_idObject

Security group ID — the SG used for cluster nodes



58
59
60
# File 'lib/pangea/contracts/cluster_result.rb', line 58

def sg_id
  control_plane_ref.sg_id
end

#target_groupObject Also known as: tg



48
49
50
# File 'lib/pangea/contracts/cluster_result.rb', line 48

def target_group
  control_plane_ref.tg
end

#to_hObject



76
77
78
# File 'lib/pangea/contracts/cluster_result.rb', line 76

def to_h
  control_plane_ref.respond_to?(:to_h) ? control_plane_ref.to_h : {}
end