Class: Kubeclient::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/kubeclient.rb

Constant Summary collapse

ENTITIES =
%w(Pod Service ReplicationController Node)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_endpoint, version) ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
23
# 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
end

Instance Attribute Details

#api_endpointObject (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_entitiesObject



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/kubeclient.rb', line 107

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