class Selectel::V2::Client
Public Class Methods
# File lib/selectel.rb, line 12 def initialize(token) @token = token end
Public Instance Methods
Show quotas info for all domain projects.
GET /quotas/projects
# File lib/selectel.rb, line 64 def all_project_quotas execute(:get, 'quotas/projects') end
Capabilities Get possible values for different variables GET /capabilities
# File lib/selectel.rb, line 87 def capabilities execute(:get, 'capabilities') end
Create new project and optionally set quotas on it. POST /projects
# File lib/selectel.rb, line 26 def create_project(props) execute(:post, 'projects', json: props) end
Delete Project and all it's objects. DELETE /projects/{project_id}
# File lib/selectel.rb, line 44 def delete_project(id) execute(:get,"projects/#{id}") end
Get full information about Project. GET /projects/{project_id}
# File lib/selectel.rb, line 32 def project(id) execute(:get,"projects/#{id}") end
GET /quotas/projects/{project_id}
# File lib/selectel.rb, line 69 def project_quotas(project_id) execute(:get, "quotas/projects/#{project_id}") end
Get list of projects in current domain. GET /projects
# File lib/selectel.rb, line 20 def projects execute(:get, 'projects') end
Quotas
Get total amount of resources available to be allocated to projects.
GET /quotas
# File lib/selectel.rb, line 52 def quotas execute(:get, 'quotas') end
Get amount of resources available to be allocated to projects.
GET /quotas/free
# File lib/selectel.rb, line 58 def quotas_free execute(:get, 'quotas/free') end
Traffic GET /traffic
# File lib/selectel.rb, line 80 def traffic execute(:get, 'traffic') end
Update Project's properties. PATCH /projects/{project_id}
# File lib/selectel.rb, line 38 def update_project(id, props) execute(:patch, "projects/#{id}", json: props) end
PATCH /quotas/projects/{project_id}
# File lib/selectel.rb, line 74 def update_project_quotas(project_id, opts = {}) execute(:patch, "quotas/projects/#{project_id}", json: opts) end
Private Instance Methods
Users GET /users POST /users GET /users/{user_id} PATCH /users/{user_id} DELETE /users/{user_id}
Roles POST /roles GET /roles/projects/{project_id}/users/{user_id} DELETE /roles/projects/{project_id}/users/{user_id} GET /roles/users/{user_id}
Tokens POST /tokens
Floating IPs GET /floatingips POST /floatingips/projects/{project_id} GET /floatingips/{floatingip_id} DELETE /floatingips/{floatingip_id}
Subnets GET /subnets POST /subnets/projects/{project_id} GET /subnets/{subnet_id} DELETE /subnets/{subnet_id}
Licences GET /licenses POST /licenses/projects/{project_id} GET /licenses/{license_id} DELETE /licenses/{license_id}
# File lib/selectel.rb, line 131 def execute(method, path, *args) JSON.parse( HTTP .headers('X-token' => @token) .public_send(method, url(path), *args) ) end
# File lib/selectel.rb, line 140 def url(path) [BASE_URL, VERSION, path].join('/') end