Class: Kubeclient::Client
- Inherits:
-
Object
- Object
- Kubeclient::Client
- Defined in:
- lib/kubeclient.rb
Overview
Kubernetes Client
Constant Summary collapse
- ENTITY_TYPES =
%w(Pod Service ReplicationController Node Event Endpoint Namespace)
Instance Attribute Summary collapse
-
#api_endpoint ⇒ Object
readonly
Returns the value of attribute api_endpoint.
Instance Method Summary collapse
- #all_entities ⇒ Object
-
#initialize(uri, version) ⇒ Client
constructor
A new instance of Client.
- #ssl_options(client_cert: nil, client_key: nil, ca_file: nil, verify_ssl: OpenSSL::SSL::VERIFY_PEER) ⇒ Object
Constructor Details
#initialize(uri, version) ⇒ Client
Returns a new instance of Client.
27 28 29 30 31 32 33 34 |
# File 'lib/kubeclient.rb', line 27 def initialize(uri, version) @api_endpoint = (uri.is_a? URI) ? uri : URI.parse(uri) @api_endpoint.merge!(File.join(@api_endpoint.path, 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.
13 14 15 |
# File 'lib/kubeclient.rb', line 13 def api_endpoint @api_endpoint end |
Instance Method Details
#all_entities ⇒ Object
197 198 199 200 201 202 203 204 205 |
# File 'lib/kubeclient.rb', line 197 def all_entities ENTITY_TYPES.each_with_object({}) do |entity_type, result_hash| # method call for get each entities # build hash of entity name to array of the entities method_name = "get_#{entity_type.underscore.pluralize}" key_name = entity_type.underscore result_hash[key_name] = send(method_name) end end |
#ssl_options(client_cert: nil, client_key: nil, ca_file: nil, verify_ssl: OpenSSL::SSL::VERIFY_PEER) ⇒ Object
155 156 157 158 159 160 161 162 163 |
# File 'lib/kubeclient.rb', line 155 def (client_cert: nil, client_key: nil, ca_file: nil, verify_ssl: OpenSSL::SSL::VERIFY_PEER) @ssl_options = { ca_file: ca_file, verify_ssl: verify_ssl, client_cert: client_cert, client_key: client_key } end |