Class: OctaSpace::Resources::Services::MachineRental
- Defined in:
- lib/octaspace/resources/services/machine_rental.rb
Overview
Machine Rental (MR) service endpoints
Instance Method Summary collapse
-
#create(**attrs) ⇒ OctaSpace::Response
Create (start) a machine rental POST /services/mr.
-
#list(**params) ⇒ OctaSpace::Response
List available marketplace machines for rent GET /services/mr.
Methods inherited from Base
Constructor Details
This class inherits a constructor from OctaSpace::Resources::Base
Instance Method Details
#create(**attrs) ⇒ OctaSpace::Response
Create (start) a machine rental POST /services/mr
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/octaspace/resources/services/machine_rental.rb', line 29 def create(**attrs) item = { id: 0, node_id: attrs.fetch(:node_id), disk_size: attrs.fetch(:disk_size), image: attrs.fetch(:image), app: attrs[:app].to_s, envs: attrs[:envs] || {}, ports: attrs[:ports] || [], http_ports: attrs[:http_ports] || [], start_command: attrs[:start_command].to_s, entrypoint: attrs[:entrypoint].to_s } item[:organization_id] = attrs[:organization_id] if attrs.key?(:organization_id) item[:project_id] = attrs[:project_id] if attrs.key?(:project_id) response = post("/services/mr", body: [item]) raise_if_rejected!(response) response end |
#list(**params) ⇒ OctaSpace::Response
List available marketplace machines for rent GET /services/mr
21 22 23 |
# File 'lib/octaspace/resources/services/machine_rental.rb', line 21 def list(**params) get("/services/mr", params:) end |