Rancher::ManagementApi Gem
Usage
-
Create a manager:
a. If your Rancher has access control:
manager = Rancher::ManagementApi::Token.build_manager( host: "http://localhost:8080", username: "youruser", password: "yourpassword" )
b. Or just create a manager:
manager = Rancher::ManagementApi::Manager.new( host: "http://localhost:8080", )
-
Create a project (known in the UI as an Environment):
project = manager.create_project("my environment name")
-
Create a new API key:
api_key = project.create_api_key("my api key name")
-
Save your api_key's secret:
puts "Your new RANCHER_ACCESS_KEY=#{api_key.publicValue}" puts "Your new RANCHER_SECRET_KEY=#{api_key.secretValue}"