Class: ResourceQuota

Inherits:
Api show all
Defined in:
lib/base/v1/api/ResourceQuota.rb

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from Api

#showapi

Methods inherited from V1

#api_version

Methods inherited from Base

#create, #delete, #list, #setup, #setup_by_config_file, #update

Constructor Details

#initialize(namespace = nil) ⇒ ResourceQuota

Returns a new instance of ResourceQuota.



30
31
32
33
# File 'lib/base/v1/api/ResourceQuota.rb', line 30

def initialize(namespace=nil)
  super("resourcequotas", namespace)
  @namespace = namespace
end

Instance Method Details

#create_resource_quota(name, pods = nil, replicationcontrollers = nil, services = nil, secrets = nil, persistentvolumeclaims = nil) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/base/v1/api/ResourceQuota.rb', line 39

def create_resource_quota(name, pods=nil, replicationcontrollers=nil, services=nil,
                          secrets=nil, persistentvolumeclaims=nil)

  rqspec = ResourceQuotaSpec.new

  rqspec.pods = pods
  rqspec.replicationcontrollers = replicationcontrollers
  rqspec.services = services
  rqspec.secrets = secrets
  rqspec.persistentvolumeclaims = persistentvolumeclaims

  objectmeta = ObjectMeta.new
  objectmeta.name = name
  objectmeta.namespace = @namespace

  body = {'spec' => rqspec.get_hash, 'metadata' => objectmeta.get_hash}
  data = create(body)
  return data

end

#delete_resource_quota(name) ⇒ Object



60
61
62
63
# File 'lib/base/v1/api/ResourceQuota.rb', line 60

def delete_resource_quota(name)
  data = delete(name)
  return data
end

#list_resource_quotasObject



35
36
37
# File 'lib/base/v1/api/ResourceQuota.rb', line 35

def list_resource_quotas
  return list
end