Sha256: 79cf93b4ab4095204576426b47a52df1ba2732b8d6823183efbc4348e2680a20
Contents?: true
Size: 794 Bytes
Versions: 1
Compression:
Stored size: 794 Bytes
Contents
# frozen_string_literal: true module Hcloud class VolumeResource < AbstractResource filter_attributes :name, :label_selector def [](arg) case arg when Integer then find_by(id: arg) when String then find_by(name: arg) end end def create(size:, name:, automount: nil, format: nil, location: nil, server: nil, labels: {}) prepare_request( 'volumes', j: COLLECT_ARGS.call(__method__, binding), expected_code: 201 ) do |response| [ Action.new(client, response.parsed_json[:action]), Volume.new(client, response.parsed_json[:volume]), response.parsed_json[:next_actions].map do |action| Action.new(client, action) end ] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hcloud-1.1.0 | lib/hcloud/volume_resource.rb |