Class: Rancher::ManagementApi::Project

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/rancher/management_api/project.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conn, data) ⇒ Project

Returns a new instance of Project.



21
22
23
24
# File 'lib/rancher/management_api/project.rb', line 21

def initialize(conn, data)
  @conn = conn
  super(data)
end

Instance Attribute Details

#connObject (readonly)

Returns the value of attribute conn.



19
20
21
# File 'lib/rancher/management_api/project.rb', line 19

def conn
  @conn
end

Class Method Details

.create(conn, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rancher/management_api/project.rb', line 6

def self.create(conn, name)
  env_response = conn.post do |req|
    req.url "/v1/project"
    req.body = {
      name: name,
    }.to_json
  end

  data = JSON.parse(env_response.body)

  new(conn, data)
end

Instance Method Details

#create_api_key(name) ⇒ Object



26
27
28
# File 'lib/rancher/management_api/project.rb', line 26

def create_api_key(name)
  ApiKey.create(self, name)
end