class Rancher::ManagementApi::Project

Attributes

conn[R]

Public Class Methods

create(conn, name) click to toggle source
# 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)

  # reload until the project is ready
  while data["state"] == "registering"
    sleep 0.5
    url = data["links"]["self"]
    response = conn.get do |req|
      req.url url
    end

    data = JSON.parse(response.body)
  end

  new(conn, data)
end
new(conn, data) click to toggle source
Calls superclass method
# File lib/rancher/management_api/project.rb, line 32
def initialize(conn, data)
  @conn = conn
  super(data)
end

Public Instance Methods

create_api_key(name) click to toggle source
# File lib/rancher/management_api/project.rb, line 37
def create_api_key(name)
  ApiKey.create(self, name)
end
create_registration_token() click to toggle source
# File lib/rancher/management_api/project.rb, line 41
def create_registration_token
  RegistrationToken.create(self)
end