Class: Kubeclient::Client
- Inherits:
-
Object
- Object
- Kubeclient::Client
- Defined in:
- lib/kubeclient.rb
Constant Summary collapse
- ENTITIES =
%w(Pod Service ReplicationController Node)
Instance Attribute Summary collapse
-
#api_endpoint ⇒ Object
readonly
Returns the value of attribute api_endpoint.
Instance Method Summary collapse
- #get_all_entities ⇒ Object
-
#initialize(api_endpoint, version) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_endpoint, version) ⇒ Client
Returns a new instance of Client.
18 19 20 21 22 23 24 25 |
# File 'lib/kubeclient.rb', line 18 def initialize(api_endpoint,version) if !api_endpoint.end_with? "/" api_endpoint = api_endpoint + "/" end @api_endpoint = api_endpoint+version #version flag is needed to take care of the differences between versions @api_version = version end |
Instance Attribute Details
#api_endpoint ⇒ Object (readonly)
Returns the value of attribute api_endpoint.
15 16 17 |
# File 'lib/kubeclient.rb', line 15 def api_endpoint @api_endpoint end |
Instance Method Details
#get_all_entities ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/kubeclient.rb', line 118 def get_all_entities result_hash = {} ENTITIES.each do |entity| # method call for get each entities # build hash of entity name to array of the entities method_name = "get_#{entity.underscore.pluralize}" key_name = entity.underscore result_hash[key_name] = send(method_name) end result_hash end |