Sha256: 7177ff0c0ea9c230d0a931e984580048a7fb724ef448b39d3e7d6fe937060f34
Contents?: true
Size: 932 Bytes
Versions: 1
Compression:
Stored size: 932 Bytes
Contents
# frozen_string_literal: true module Hcloud class ServerResource < AbstractResource filter_attributes :status, :name, :label_selector bind_to Server def create(name:, server_type:, image:, datacenter: nil, location: nil, start_after_create: nil, ssh_keys: [], networks: [], user_data: nil, labels: {}) prepare_request('servers', j: COLLECT_ARGS.call(__method__, binding), expected_code: 201) do |response| [ Action.new(client, response.parsed_json[:action]), Server.new(client, response.parsed_json[:server]), response.parsed_json[:root_password] ] end end def [](arg) case arg when Integer then find_by(id: arg) when String then find_by(name: arg) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hcloud-1.1.0 | lib/hcloud/server_resource.rb |