Class: Ocpclient::Client

Inherits:
Kubeclient::Client
  • Object
show all
Includes:
Kubeclient::ClientMixin
Defined in:
lib/ocpclient.rb

Overview

OCP Client

Constant Summary collapse

ENTITY_TYPES =

Dynamically creating classes definitions (class Project, class BuildConfig, etc.), The classes are extending RecursiveOpenStruct. This cancels the need to define the classes manually on every new entity addition, and especially since currently the class body is empty

%w(Project ProjectRequest BuildConfig RoleBinding).map do |et|
  clazz = Class.new(RecursiveOpenStruct) do
    def initialize(hash = nil, args = {})
      args.merge!(recurse_over_arrays: true)
      super(hash, args)
    end
  end
  [Kubeclient.const_set(et, clazz), et]
end

Instance Method Summary collapse

Constructor Details

#initialize(uri, version = 'v1', **options) ⇒ Client

Returns a new instance of Client.



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ocpclient.rb', line 33

def initialize(
  uri,
  version = 'v1',
  **options
)
  initialize_client(
    uri,
    '/oapi',
    version,
    options
  )
end

Instance Method Details

#all_entitiesObject



46
47
48
# File 'lib/ocpclient.rb', line 46

def all_entities
  retrieve_all_entities(ENTITY_TYPES)
end