hetznercloud 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/config/inflections.rb +9 -5
- data/lib/hcloud/concerns/concerns.rb +4 -0
- data/lib/hcloud/concerns/creatable.rb +1 -0
- data/lib/hcloud/concerns/meterable.rb +17 -0
- data/lib/hcloud/entities/algorithm.rb +7 -0
- data/lib/hcloud/entities/health_check.rb +12 -0
- data/lib/hcloud/entities/health_check_http.rb +13 -0
- data/lib/hcloud/entities/health_status.rb +8 -0
- data/lib/hcloud/entities/label_selector.rb +7 -0
- data/lib/hcloud/entities/load_balancer_private_net.rb +8 -0
- data/lib/hcloud/entities/load_balancer_public_net.rb +11 -0
- data/lib/hcloud/entities/service.rb +16 -0
- data/lib/hcloud/entities/service_http.rb +16 -0
- data/lib/hcloud/entities/target.rb +15 -0
- data/lib/hcloud/entities/target_ip.rb +7 -0
- data/lib/hcloud/entities/target_target.rb +15 -0
- data/lib/hcloud/entities/targets.rb +13 -0
- data/lib/hcloud/errors.rb +8 -1
- data/lib/hcloud/resource_type.rb +20 -2
- data/lib/hcloud/resources/firewall.rb +1 -1
- data/lib/hcloud/resources/load_balancer.rb +107 -0
- data/lib/hcloud/resources/load_balancer_type.rb +38 -0
- data/lib/hcloud/resources/network.rb +1 -2
- data/lib/hcloud/resources/server.rb +6 -11
- data/lib/hcloud/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de89d0a6117d05ba5b57c40b41601aecb419a6ca8c9bd5b639117051a6501e4
|
4
|
+
data.tar.gz: 9b3a8d86043d7c2a7622816f987b4bfa7c2584b2fe0b2535e8e3300f4a5117ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae331dfc72e7baf0bda9b6e6ad9354630166d4faa9169538d56f69c3d5117703955df6d5b7f10851e5f1cbd082d4b942826914091d2f22ec628040259e63405f
|
7
|
+
data.tar.gz: 2898e89f00a5ba8be3b7d75eb27ba3b3d507a83683f0b214555600c89482c7fc317b5cbf3f1e7e5461a784a5e047e6f302a08047320e230ab0bc5049eda70fc4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -84,9 +84,9 @@ Not all Hetzner Cloud API endpoints have been implemented yet.
|
|
84
84
|
| Images | Implemented |
|
85
85
|
| Image Actions | Implemented |
|
86
86
|
| ISOs | Implemented |
|
87
|
-
| Load Balancers |
|
87
|
+
| Load Balancers | Implemented |
|
88
88
|
| Load Balancer Actions | Not implemented |
|
89
|
-
| Load Balancer Types |
|
89
|
+
| Load Balancer Types | Implemented |
|
90
90
|
| Locations | Implemented |
|
91
91
|
| Networks | Implemented |
|
92
92
|
| Network Actions | Implemented |
|
data/config/inflections.rb
CHANGED
@@ -2,23 +2,27 @@
|
|
2
2
|
|
3
3
|
HCloud.loader.inflector.inflect(
|
4
4
|
"dns_pointer" => "DNSPointer",
|
5
|
-
"hcloud" => "HCloud",
|
6
|
-
"ssh_key" => "SSHKey",
|
7
5
|
"floating_ip" => "FloatingIP",
|
8
6
|
"floating_ip_price" => "FloatingIPPrice",
|
9
|
-
"floating_ips" => "FloatingIPs",
|
10
7
|
"floating_ip_prices" => "FloatingIPPrices",
|
8
|
+
"floating_ips" => "FloatingIPs",
|
9
|
+
"hcloud" => "HCloud",
|
10
|
+
"health_check_http" => "HealthCheckHTTP",
|
11
11
|
"http" => "HTTP",
|
12
|
+
"ip_not_available" => "IPNotAvailable",
|
12
13
|
"ipv4" => "IPv4",
|
13
14
|
"ipv6" => "IPv6",
|
14
|
-
"ip_not_available" => "IPNotAvailable",
|
15
15
|
"iso" => "ISO",
|
16
16
|
"iso_type" => "ISOType",
|
17
|
+
"service_http" => "ServiceHTTP",
|
18
|
+
"ssh_key" => "SSHKey",
|
19
|
+
"target_ip" => "TargetIP",
|
17
20
|
)
|
18
21
|
|
19
22
|
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
20
23
|
inflect.acronym "DNS"
|
21
|
-
inflect.acronym "
|
24
|
+
inflect.acronym "HTTP"
|
22
25
|
inflect.acronym "IP"
|
23
26
|
inflect.acronym "ISO"
|
27
|
+
inflect.acronym "JSON"
|
24
28
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HCloud
|
4
|
+
module Meterable
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
def metrics(type:, from:, to:, step: nil)
|
9
|
+
raise Errors::MissingIDError unless id
|
10
|
+
|
11
|
+
Metrics.new client
|
12
|
+
.get("/#{resource_name.pluralize}/#{id}/metrics", type: Array(type).join(","), start: from.iso8601, end: to.iso8601, step: step)
|
13
|
+
.fetch(:metrics)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HCloud
|
4
|
+
class HealthCheck < Entity
|
5
|
+
attribute :http, :health_check_http
|
6
|
+
attribute :interval, :integer
|
7
|
+
attribute :port, :integer
|
8
|
+
attribute :protocol
|
9
|
+
attribute :retries, :integer
|
10
|
+
attribute :timeout, :integer
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HCloud
|
4
|
+
class Service < Entity
|
5
|
+
attribute :listen_port, :integer
|
6
|
+
attribute :destination_port, :integer
|
7
|
+
|
8
|
+
attribute :protocol
|
9
|
+
attribute :proxyprotocol, :boolean
|
10
|
+
|
11
|
+
attribute :health_check, :health_check
|
12
|
+
attribute :http, :service_http
|
13
|
+
|
14
|
+
alias proxyprotocol? proxyprotocol
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HCloud
|
4
|
+
class ServiceHTTP < Entity
|
5
|
+
attribute :certificates, :certificate, array: true, default: -> { [] }
|
6
|
+
|
7
|
+
attribute :cookie_lifetime, :integer
|
8
|
+
attribute :cookie_name
|
9
|
+
|
10
|
+
attribute :redirect_http, :boolean
|
11
|
+
attribute :sticky_sessions, :boolean
|
12
|
+
|
13
|
+
alias redirect_http? redirect_http
|
14
|
+
alias sticky_sessions? sticky_sessions
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HCloud
|
4
|
+
class Target < Entity
|
5
|
+
attribute :type
|
6
|
+
|
7
|
+
attribute :health_status, :health_status, array: true, default: -> { [] }
|
8
|
+
|
9
|
+
attribute :server, :server
|
10
|
+
|
11
|
+
attribute :use_private_ip, :boolean
|
12
|
+
|
13
|
+
alias use_private_ip? use_private_ip
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HCloud
|
4
|
+
class TargetTarget < Entity
|
5
|
+
attribute :type
|
6
|
+
|
7
|
+
attribute :health_status, :health_status, array: true, default: -> { [] }
|
8
|
+
|
9
|
+
attribute :server, :server
|
10
|
+
|
11
|
+
attribute :use_private_ip, :boolean
|
12
|
+
|
13
|
+
alias use_private_ip? use_private_ip
|
14
|
+
end
|
15
|
+
end
|
data/lib/hcloud/errors.rb
CHANGED
@@ -23,15 +23,18 @@ module HCloud
|
|
23
23
|
end
|
24
24
|
|
25
25
|
class ActionFailed < Error; end
|
26
|
+
class CloudResourceIPNotAllowed < Error; end
|
26
27
|
class Conflict < Error; end
|
27
28
|
class FirewallAlreadyApplied < Error; end
|
28
29
|
class FirewallAlreadyRemoved < Error; end
|
29
30
|
class FirewallResourceNotFound < Error; end
|
30
31
|
class Forbidden < Error; end
|
31
32
|
class IPNotAvailable < Error; end
|
33
|
+
class IPNotOwned < Error; end
|
32
34
|
class IncompatibleNetworkType < Error; end
|
33
35
|
class InvalidInput < Error; end
|
34
36
|
class JSONError < Error; end
|
37
|
+
class LoadBalancerNotAttachedToNetwork < Error; end
|
35
38
|
class Locked < Error; end
|
36
39
|
class Maintenance < Error; end
|
37
40
|
class NetworksOverlap < Error; end
|
@@ -42,13 +45,17 @@ module HCloud
|
|
42
45
|
class PlacementError < Error; end
|
43
46
|
class Protected < Error; end
|
44
47
|
class RateLimitExceeded < Error; end
|
48
|
+
class ResourceInUse < Error; end
|
45
49
|
class ResourceLimitExceeded < Error; end
|
46
50
|
class ResourceUnavailable < Error; end
|
47
|
-
class
|
51
|
+
class RobotUnavailable < Error; end
|
48
52
|
class ServerAlreadyAdded < Error; end
|
49
53
|
class ServerAlreadyAttached < Error; end
|
50
54
|
class ServerError < Error; end
|
55
|
+
class ServerNotAttachedToNetwork < Error; end
|
51
56
|
class ServiceError < Error; end
|
57
|
+
class SourcePortAlreadyUsed < Error; end
|
58
|
+
class TargetAlreadyDefined < Error; end
|
52
59
|
class TokenReadonly < Error; end
|
53
60
|
class Unauthorized < Error; end
|
54
61
|
class UniquenessError < Error; end
|
data/lib/hcloud/resource_type.rb
CHANGED
@@ -19,8 +19,12 @@ module HCloud
|
|
19
19
|
value
|
20
20
|
when Integer # ID
|
21
21
|
resource_class.new(id: value)
|
22
|
-
when String # Name
|
23
|
-
resource_class.
|
22
|
+
when String # Name or Type
|
23
|
+
if resource_class.attribute_names.include?("name")
|
24
|
+
resource_class.new(name: value)
|
25
|
+
else
|
26
|
+
resource_class.new(type: value)
|
27
|
+
end
|
24
28
|
when Hash # Attribute hash
|
25
29
|
resource_class.new(value)
|
26
30
|
when Array # List
|
@@ -52,6 +56,7 @@ module HCloud
|
|
52
56
|
end
|
53
57
|
|
54
58
|
ActiveModel::Type.register(:action, HCloud::ResourceType.Type("HCloud::Action"))
|
59
|
+
ActiveModel::Type.register(:algorithm, HCloud::ResourceType.Type("HCloud::Algorithm"))
|
55
60
|
ActiveModel::Type.register(:amount, HCloud::ResourceType.Type("HCloud::Amount"))
|
56
61
|
ActiveModel::Type.register(:applied_to, HCloud::ResourceType.Type("HCloud::AppliedTo"))
|
57
62
|
ActiveModel::Type.register(:applied_to_resource, HCloud::ResourceType.Type("HCloud::AppliedToResource"))
|
@@ -66,11 +71,19 @@ ActiveModel::Type.register(:firewall, HCloud::ResourceType.Type("HCloud::Firewal
|
|
66
71
|
ActiveModel::Type.register(:floating_ip, HCloud::ResourceType.Type("HCloud::FloatingIP"))
|
67
72
|
ActiveModel::Type.register(:floating_ip_price, HCloud::ResourceType.Type("HCloud::FloatingIPPrice"))
|
68
73
|
ActiveModel::Type.register(:floating_ip_prices, HCloud::ResourceType.Type("HCloud::FloatingIPPrices"))
|
74
|
+
ActiveModel::Type.register(:health_check, HCloud::ResourceType.Type("HCloud::HealthCheck"))
|
75
|
+
ActiveModel::Type.register(:health_check_http, HCloud::ResourceType.Type("HCloud::HealthCheckHTTP"))
|
76
|
+
ActiveModel::Type.register(:health_status, HCloud::ResourceType.Type("HCloud::HealthStatus"))
|
69
77
|
ActiveModel::Type.register(:image, HCloud::ResourceType.Type("HCloud::Image"))
|
70
78
|
ActiveModel::Type.register(:image_price, HCloud::ResourceType.Type("HCloud::ImagePrice"))
|
71
79
|
ActiveModel::Type.register(:ipv4, HCloud::ResourceType.Type("HCloud::IPv4"))
|
72
80
|
ActiveModel::Type.register(:ipv6, HCloud::ResourceType.Type("HCloud::IPv6"))
|
73
81
|
ActiveModel::Type.register(:iso, HCloud::ResourceType.Type("HCloud::ISO"))
|
82
|
+
ActiveModel::Type.register(:label_selector, HCloud::ResourceType.Type("HCloud::LabelSelector"))
|
83
|
+
ActiveModel::Type.register(:load_balancer, HCloud::ResourceType.Type("HCloud::LoadBalancer"))
|
84
|
+
ActiveModel::Type.register(:load_balancer_private_net, HCloud::ResourceType.Type("HCloud::LoadBalancerPrivateNet"))
|
85
|
+
ActiveModel::Type.register(:load_balancer_public_net, HCloud::ResourceType.Type("HCloud::LoadBalancerPublicNet"))
|
86
|
+
ActiveModel::Type.register(:load_balancer_type, HCloud::ResourceType.Type("HCloud::LoadBalancerType"))
|
74
87
|
ActiveModel::Type.register(:load_balancer_type_price, HCloud::ResourceType.Type("HCloud::LoadBalancerTypePrice"))
|
75
88
|
ActiveModel::Type.register(:location, HCloud::ResourceType.Type("HCloud::Location"))
|
76
89
|
ActiveModel::Type.register(:network, HCloud::ResourceType.Type("HCloud::Network"))
|
@@ -86,8 +99,13 @@ ActiveModel::Type.register(:server, HCloud::ResourceType.Type("HCloud::Server"))
|
|
86
99
|
ActiveModel::Type.register(:server_backup_price, HCloud::ResourceType.Type("HCloud::ServerBackupPrice"))
|
87
100
|
ActiveModel::Type.register(:server_type, HCloud::ResourceType.Type("HCloud::ServerType"))
|
88
101
|
ActiveModel::Type.register(:server_type_price, HCloud::ResourceType.Type("HCloud::ServerTypePrice"))
|
102
|
+
ActiveModel::Type.register(:service, HCloud::ResourceType.Type("HCloud::Service"))
|
103
|
+
ActiveModel::Type.register(:service_http, HCloud::ResourceType.Type("HCloud::ServiceHTTP"))
|
89
104
|
ActiveModel::Type.register(:ssh_key, HCloud::ResourceType.Type("HCloud::SSHKey"))
|
90
105
|
ActiveModel::Type.register(:subnet, HCloud::ResourceType.Type("HCloud::Subnet"))
|
106
|
+
ActiveModel::Type.register(:target, HCloud::ResourceType.Type("HCloud::Target"))
|
107
|
+
ActiveModel::Type.register(:targets, HCloud::ResourceType.Type("HCloud::Targets"))
|
108
|
+
ActiveModel::Type.register(:target_ip, HCloud::ResourceType.Type("HCloud::TargetIP"))
|
91
109
|
ActiveModel::Type.register(:traffic_price, HCloud::ResourceType.Type("HCloud::TrafficPrice"))
|
92
110
|
ActiveModel::Type.register(:used_by, HCloud::ResourceType.Type("HCloud::UsedBy"))
|
93
111
|
ActiveModel::Type.register(:volume, HCloud::ResourceType.Type("HCloud::Volume"))
|
@@ -112,7 +112,7 @@ module HCloud
|
|
112
112
|
attribute :name
|
113
113
|
|
114
114
|
attribute :applied_to, :applied_to, array: true, default: -> { [] }
|
115
|
-
#
|
115
|
+
# TODO: use only for creation
|
116
116
|
attribute :apply_to, :apply_to, array: true, default: -> { [] }
|
117
117
|
|
118
118
|
attribute :rules, :rule, array: true, default: -> { [] }
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HCloud
|
4
|
+
##
|
5
|
+
# Represents a load balancer
|
6
|
+
#
|
7
|
+
# == List all load balancers
|
8
|
+
#
|
9
|
+
# HCloud::LoadBalancer.all
|
10
|
+
# # => [#<HCloud::LoadBalancer id: 1, ...>, ...]
|
11
|
+
#
|
12
|
+
# == Sort load balancers
|
13
|
+
#
|
14
|
+
# HCloud::LoadBalancer.all.sort(name: :desc)
|
15
|
+
# # => [#<HCloud::LoadBalancer id: 1, ...>, ...]
|
16
|
+
#
|
17
|
+
# HCloud::LoadBalancer.all.sort(:id, name: :asc)
|
18
|
+
# # => [#<HCloud::LoadBalancer id: 1, ...>, ...]
|
19
|
+
#
|
20
|
+
# == Search load balancers
|
21
|
+
#
|
22
|
+
# HCloud::LoadBalancer.all.where(name: "my_load_balancer")
|
23
|
+
# # => #<HCloud::LoadBalancer id: 1, ...>
|
24
|
+
#
|
25
|
+
# == Find load balancer by ID
|
26
|
+
#
|
27
|
+
# HCloud::LoadBalancer.find(1)
|
28
|
+
# # => #<HCloud::LoadBalancer id: 1, ...>
|
29
|
+
#
|
30
|
+
# == Create load balancer
|
31
|
+
#
|
32
|
+
# load_balancer = HCloud::LoadBalancer.new(name: "my_load_balancer", algorithm: { type: "round_robin" }, load_balancer_type: "lb11", location: "nbg1")
|
33
|
+
# load_balancer.create
|
34
|
+
# load_balancer.created?
|
35
|
+
# # => true
|
36
|
+
#
|
37
|
+
# load_balancer = HCloud::LoadBalancer.create(name: "my_load_balancer", algorithm: { type: "round_robin" }, load_balancer_type: "lb11", location: "nbg1")
|
38
|
+
# # => #<HCloud::LoadBalancer id: 1, ...>
|
39
|
+
#
|
40
|
+
# == Update load balancer
|
41
|
+
#
|
42
|
+
# load_balancer = HCloud::LoadBalancer.find(1)
|
43
|
+
# load_balancer.name = "another_load_balancer"
|
44
|
+
# load_balancer.update
|
45
|
+
#
|
46
|
+
# == Delete load balancer
|
47
|
+
#
|
48
|
+
# load_balancer = HCloud::LoadBalancer.find(1)
|
49
|
+
# load_balancer.delete
|
50
|
+
# load_balancer.deleted?
|
51
|
+
# # => true
|
52
|
+
#
|
53
|
+
# == Get metrics
|
54
|
+
#
|
55
|
+
# load_balancer = HCloud::LoadBalancer.find(1)
|
56
|
+
# load_balancer.metrics(type: :bandwidth, from: 2.minutes.ago, to: 1.minute.ago)
|
57
|
+
# # => #<HCloud::Metrics ...>
|
58
|
+
#
|
59
|
+
# load_balancer.metrics(type: [:connections_per_second, :requests_per_second], from: 2.minutes.ago, to: 1.minute.ago, step: 60)
|
60
|
+
# # => #<HCloud::Metrics ...>
|
61
|
+
#
|
62
|
+
class LoadBalancer < Resource
|
63
|
+
queryable
|
64
|
+
creatable
|
65
|
+
updatable
|
66
|
+
deletable
|
67
|
+
meterable
|
68
|
+
|
69
|
+
attribute :id, :integer
|
70
|
+
attribute :name
|
71
|
+
|
72
|
+
attribute :algorithm, :algorithm
|
73
|
+
|
74
|
+
attribute :included_traffic, :integer
|
75
|
+
attribute :ingoing_traffic, :integer
|
76
|
+
attribute :outgoing_traffic, :integer
|
77
|
+
|
78
|
+
attribute :load_balancer_type, :load_balancer_type
|
79
|
+
|
80
|
+
attribute :location, :location
|
81
|
+
|
82
|
+
# TODO: use only for creation
|
83
|
+
attribute :network_zone
|
84
|
+
# TODO: use only for creation
|
85
|
+
attribute :network, :network
|
86
|
+
# TODO: use only for creation
|
87
|
+
attribute :public_interface, :boolean
|
88
|
+
|
89
|
+
attribute :private_net, :load_balancer_private_net
|
90
|
+
attribute :public_net, :load_balancer_public_net
|
91
|
+
|
92
|
+
attribute :services, :service, array: true, default: -> { [] }
|
93
|
+
attribute :targets, :target, array: true, default: -> { [] }
|
94
|
+
|
95
|
+
attribute :protection, :protection
|
96
|
+
|
97
|
+
attribute :labels, default: -> { {} }
|
98
|
+
|
99
|
+
def creatable_attributes
|
100
|
+
[:name, :labels, :algorithm, :network_zone, :public_interface, :services, :targets, load_balancer_type: [:id, :name], location: [:id, :name], network: [:id, :name]]
|
101
|
+
end
|
102
|
+
|
103
|
+
def updatable_attributes
|
104
|
+
[:name, :labels]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HCloud
|
4
|
+
##
|
5
|
+
# Represents a load balancer type
|
6
|
+
#
|
7
|
+
# == List all load balancer types
|
8
|
+
#
|
9
|
+
# HCloud::LoadBalancerType.all
|
10
|
+
# # => [#<HCloud::LoadBalancerType id: 1, ...>, ...]
|
11
|
+
#
|
12
|
+
# == Search load balancer types
|
13
|
+
#
|
14
|
+
# HCloud::LoadBalancerType.all.where(name: "cx11")
|
15
|
+
# # => #<HCloud::LoadBalancerType id: 1, ...>
|
16
|
+
#
|
17
|
+
# == Find load balancer type by ID
|
18
|
+
#
|
19
|
+
# HCloud::LoadBalancerType.find(1)
|
20
|
+
# # => #<HCloud::LoadBalancerType id: 1, ...>
|
21
|
+
#
|
22
|
+
class LoadBalancerType < Resource
|
23
|
+
queryable
|
24
|
+
|
25
|
+
attribute :id, :integer
|
26
|
+
attribute :name
|
27
|
+
attribute :description
|
28
|
+
|
29
|
+
attribute :max_assigned_certificates, :integer
|
30
|
+
attribute :max_connections, :integer
|
31
|
+
attribute :max_services, :integer
|
32
|
+
attribute :max_targets, :integer
|
33
|
+
|
34
|
+
attribute :prices, :price, array: true, default: -> { [] }
|
35
|
+
|
36
|
+
attribute :deprecated, :datetime
|
37
|
+
end
|
38
|
+
end
|
@@ -117,8 +117,7 @@ module HCloud
|
|
117
117
|
|
118
118
|
attribute :servers, :server, array: true, default: -> { [] }
|
119
119
|
|
120
|
-
|
121
|
-
attribute :load_balancers, array: true, default: -> { [] }
|
120
|
+
attribute :load_balancers, :load_balancer, array: true, default: -> { [] }
|
122
121
|
|
123
122
|
attribute :protection, :protection
|
124
123
|
|
@@ -64,7 +64,6 @@ module HCloud
|
|
64
64
|
# # => #<HCloud::Metrics ...>
|
65
65
|
#
|
66
66
|
# TODO: actions
|
67
|
-
# TODO: return root_password if ssh_keys is empty
|
68
67
|
#
|
69
68
|
class Server < Resource
|
70
69
|
actionable
|
@@ -72,6 +71,7 @@ module HCloud
|
|
72
71
|
creatable
|
73
72
|
updatable
|
74
73
|
deletable
|
74
|
+
meterable
|
75
75
|
|
76
76
|
attribute :id, :integer
|
77
77
|
attribute :name
|
@@ -94,6 +94,8 @@ module HCloud
|
|
94
94
|
# TODO: use only for creation
|
95
95
|
attribute :networks, array: true, default: -> { [] }
|
96
96
|
|
97
|
+
attribute :root_password
|
98
|
+
|
97
99
|
attribute :datacenter, :datacenter
|
98
100
|
|
99
101
|
attribute :included_traffic, :integer
|
@@ -115,13 +117,12 @@ module HCloud
|
|
115
117
|
|
116
118
|
attribute :labels, default: -> { {} }
|
117
119
|
|
118
|
-
|
119
|
-
attribute :load_balancers, array: true, default: -> { [] }
|
120
|
+
attribute :load_balancers, :load_balancer, array: true, default: -> { [] }
|
120
121
|
|
121
122
|
attribute :volumes, :volume, array: true, default: -> { [] }
|
122
123
|
|
123
|
-
attribute :locked
|
124
|
-
attribute :rescue_enabled
|
124
|
+
attribute :locked, :boolean
|
125
|
+
attribute :rescue_enabled, :boolean
|
125
126
|
|
126
127
|
alias rescue_enabled? rescue_enabled
|
127
128
|
|
@@ -161,12 +162,6 @@ module HCloud
|
|
161
162
|
|
162
163
|
action :request_console
|
163
164
|
|
164
|
-
def metrics(type:, from:, to:, step: nil)
|
165
|
-
Metrics.new client
|
166
|
-
.get("/servers/#{id}/metrics", type: Array(type).join(","), start: from.iso8601, end: to.iso8601, step: step)
|
167
|
-
.fetch(:metrics)
|
168
|
-
end
|
169
|
-
|
170
165
|
def creatable_attributes
|
171
166
|
[:name, :automount, :start_after_create, :user_data, :labels, datacenter: [:id, :name], image: [:id, :name], location: [:id, :name], server_type: [:id, :name], ssh_keys: [:id, :name], firewalls: :id, networks: :id, volumes: :id]
|
172
167
|
end
|
data/lib/hcloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hetznercloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Dejonckheere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -213,9 +213,11 @@ files:
|
|
213
213
|
- lib/hcloud/concerns/concerns.rb
|
214
214
|
- lib/hcloud/concerns/creatable.rb
|
215
215
|
- lib/hcloud/concerns/deletable.rb
|
216
|
+
- lib/hcloud/concerns/meterable.rb
|
216
217
|
- lib/hcloud/concerns/queryable.rb
|
217
218
|
- lib/hcloud/concerns/singleton.rb
|
218
219
|
- lib/hcloud/concerns/updatable.rb
|
220
|
+
- lib/hcloud/entities/algorithm.rb
|
219
221
|
- lib/hcloud/entities/amount.rb
|
220
222
|
- lib/hcloud/entities/applied_to.rb
|
221
223
|
- lib/hcloud/entities/applied_to_resource.rb
|
@@ -226,9 +228,15 @@ files:
|
|
226
228
|
- lib/hcloud/entities/error.rb
|
227
229
|
- lib/hcloud/entities/floating_ip_price.rb
|
228
230
|
- lib/hcloud/entities/floating_ip_prices.rb
|
231
|
+
- lib/hcloud/entities/health_check.rb
|
232
|
+
- lib/hcloud/entities/health_check_http.rb
|
233
|
+
- lib/hcloud/entities/health_status.rb
|
229
234
|
- lib/hcloud/entities/image_price.rb
|
230
235
|
- lib/hcloud/entities/ipv4.rb
|
231
236
|
- lib/hcloud/entities/ipv6.rb
|
237
|
+
- lib/hcloud/entities/label_selector.rb
|
238
|
+
- lib/hcloud/entities/load_balancer_private_net.rb
|
239
|
+
- lib/hcloud/entities/load_balancer_public_net.rb
|
232
240
|
- lib/hcloud/entities/load_balancer_type_price.rb
|
233
241
|
- lib/hcloud/entities/metrics.rb
|
234
242
|
- lib/hcloud/entities/price.rb
|
@@ -239,7 +247,13 @@ files:
|
|
239
247
|
- lib/hcloud/entities/rule.rb
|
240
248
|
- lib/hcloud/entities/server_backup_price.rb
|
241
249
|
- lib/hcloud/entities/server_type_price.rb
|
250
|
+
- lib/hcloud/entities/service.rb
|
251
|
+
- lib/hcloud/entities/service_http.rb
|
242
252
|
- lib/hcloud/entities/subnet.rb
|
253
|
+
- lib/hcloud/entities/target.rb
|
254
|
+
- lib/hcloud/entities/target_ip.rb
|
255
|
+
- lib/hcloud/entities/target_target.rb
|
256
|
+
- lib/hcloud/entities/targets.rb
|
243
257
|
- lib/hcloud/entities/traffic_price.rb
|
244
258
|
- lib/hcloud/entities/used_by.rb
|
245
259
|
- lib/hcloud/entities/volume_price.rb
|
@@ -255,6 +269,8 @@ files:
|
|
255
269
|
- lib/hcloud/resources/floating_ip.rb
|
256
270
|
- lib/hcloud/resources/image.rb
|
257
271
|
- lib/hcloud/resources/iso.rb
|
272
|
+
- lib/hcloud/resources/load_balancer.rb
|
273
|
+
- lib/hcloud/resources/load_balancer_type.rb
|
258
274
|
- lib/hcloud/resources/location.rb
|
259
275
|
- lib/hcloud/resources/network.rb
|
260
276
|
- lib/hcloud/resources/placement_group.rb
|