droplet_kit 3.16.1 → 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -10
- data/lib/droplet_kit/client.rb +3 -1
- data/lib/droplet_kit/error_handling_resourcable.rb +4 -3
- data/lib/droplet_kit/mappings/balance_mapping.rb +0 -1
- data/lib/droplet_kit/mappings/container_registry_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/database_cluster_mapping.rb +8 -8
- data/lib/droplet_kit/mappings/database_connection_pool_mapping.rb +5 -5
- data/lib/droplet_kit/mappings/database_eviction_policy_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/database_firewall_rule_mapping.rb +3 -3
- data/lib/droplet_kit/mappings/database_maintenance_window_mapping.rb +2 -2
- data/lib/droplet_kit/mappings/database_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/database_sql_mode_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/database_user_mapping.rb +3 -3
- data/lib/droplet_kit/mappings/database_user_reset_auth_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/domain_mapping.rb +2 -2
- data/lib/droplet_kit/mappings/domain_record_mapping.rb +9 -9
- data/lib/droplet_kit/mappings/droplet_upgrade_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/error_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/firewall_inbound_rule_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/firewall_outbound_rule_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/floating_ip_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/forwarding_rule_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/image_mapping.rb +10 -10
- data/lib/droplet_kit/mappings/invoice_mapping.rb +0 -1
- data/lib/droplet_kit/mappings/kernel_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/kubernetes_cluster_mapping.rb +9 -9
- data/lib/droplet_kit/mappings/kubernetes_node_mapping.rb +0 -1
- data/lib/droplet_kit/mappings/kubernetes_node_pool_mapping.rb +8 -9
- data/lib/droplet_kit/mappings/load_balancer_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/network_detail_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/network_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/project_assignment_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/project_mapping.rb +5 -5
- data/lib/droplet_kit/mappings/region_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/reserved_ip_mapping.rb +21 -0
- data/lib/droplet_kit/mappings/size_mapping.rb +1 -0
- data/lib/droplet_kit/mappings/snapshot_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/ssh_key_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/volume_mapping.rb +5 -6
- data/lib/droplet_kit/mappings/vpc_member_mapping.rb +1 -1
- data/lib/droplet_kit/models/base_model.rb +3 -3
- data/lib/droplet_kit/models/container_registry_repository.rb +1 -1
- data/lib/droplet_kit/models/container_registry_repository_tag.rb +1 -1
- data/lib/droplet_kit/models/domain.rb +1 -1
- data/lib/droplet_kit/models/droplet.rb +6 -7
- data/lib/droplet_kit/models/invoice.rb +15 -16
- data/lib/droplet_kit/models/kernel.rb +1 -1
- data/lib/droplet_kit/models/kubernetes_cluster.rb +1 -1
- data/lib/droplet_kit/models/kubernetes_node.rb +1 -1
- data/lib/droplet_kit/models/kubernetes_node_pool.rb +1 -1
- data/lib/droplet_kit/models/load_balancer.rb +4 -4
- data/lib/droplet_kit/models/meta_information.rb +1 -1
- data/lib/droplet_kit/models/pagination_information.rb +1 -1
- data/lib/droplet_kit/models/project.rb +1 -1
- data/lib/droplet_kit/models/reserved_ip.rb +20 -0
- data/lib/droplet_kit/models/size.rb +1 -0
- data/lib/droplet_kit/models/snapshot.rb +1 -1
- data/lib/droplet_kit/models/ssh_key.rb +1 -1
- data/lib/droplet_kit/models/volume.rb +1 -1
- data/lib/droplet_kit/models/vpc.rb +1 -1
- data/lib/droplet_kit/models/vpc_member.rb +1 -1
- data/lib/droplet_kit/paginated_resource.rb +10 -10
- data/lib/droplet_kit/resources/account_resource.rb +1 -1
- data/lib/droplet_kit/resources/balance_resource.rb +1 -1
- data/lib/droplet_kit/resources/domain_record_resource.rb +2 -2
- data/lib/droplet_kit/resources/droplet_action_resource.rb +5 -5
- data/lib/droplet_kit/resources/firewall_resource.rb +3 -3
- data/lib/droplet_kit/resources/image_resource.rb +1 -1
- data/lib/droplet_kit/resources/kubernetes_cluster_resource.rb +3 -5
- data/lib/droplet_kit/resources/load_balancer_resource.rb +1 -1
- data/lib/droplet_kit/resources/project_resource.rb +1 -1
- data/lib/droplet_kit/resources/reserved_ip_action_resource.rb +32 -0
- data/lib/droplet_kit/resources/reserved_ip_resource.rb +31 -0
- data/lib/droplet_kit/resources/ssh_key_resource.rb +3 -3
- data/lib/droplet_kit/resources/volume_action_resource.rb +3 -3
- data/lib/droplet_kit/resources/vpc_resource.rb +5 -5
- data/lib/droplet_kit/utils.rb +9 -9
- data/lib/droplet_kit/version.rb +1 -1
- data/lib/droplet_kit.rb +6 -2
- data/lib/tasks/resource_doc.rake +8 -9
- metadata +99 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3e2b46c0716d69015a44fc025bd61dc48b1f554ff7757c6f58517a94879d5e6
|
4
|
+
data.tar.gz: 55198741a7f9c1ea42bfa3dbe99c6b0479839c744d2040c01245fd537577273a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcefea9fb76fb5d89181edc7044d39e1573e447dd2ad73acc0835b6c99f02559baa0412fc4f862a3c68a58299eb6fb712d140d6d5832546a5b319444e838420f
|
7
|
+
data.tar.gz: 98baa8e8ed6c35e86313b588ddb1e81b26e6d7ad5f563b67db377012ca79130868716ba0f633d3c1f822a8294b3116fe8831c72bcf534dc950c5525aba83fcc5
|
data/README.md
CHANGED
@@ -525,27 +525,27 @@ Actions supported:
|
|
525
525
|
|
526
526
|
* `client.balance.info()`
|
527
527
|
|
528
|
-
##
|
528
|
+
## Reserved IP resource
|
529
529
|
|
530
530
|
client = DropletKit::Client.new(access_token: 'TOKEN')
|
531
|
-
client.
|
531
|
+
client.reserved_ips #=> DropletKit::ReservedIpResource
|
532
532
|
|
533
533
|
Actions supported:
|
534
534
|
|
535
|
-
* `client.
|
536
|
-
* `client.
|
537
|
-
* `client.
|
538
|
-
* `client.
|
535
|
+
* `client.reserved_ips.all()`
|
536
|
+
* `client.reserved_ips.find(ip: 'ip address')`
|
537
|
+
* `client.reserved_ips.create(reserved_ip)`
|
538
|
+
* `client.reserved_ips.delete(ip: 'ip address')`
|
539
539
|
|
540
|
-
##
|
540
|
+
## Reserved IP Action resource
|
541
541
|
|
542
542
|
client = DropletKit::Client.new(access_token: 'TOKEN')
|
543
|
-
client.
|
543
|
+
client.reserved_ip_actions #=> DropletKit::ReservedIpActionResource
|
544
544
|
|
545
545
|
Actions supported:
|
546
546
|
|
547
|
-
* `client.
|
548
|
-
* `client.
|
547
|
+
* `client.reserved_ip_actions.assign(ip: reserved_ip.ip, droplet_id: droplet.id)`
|
548
|
+
* `client.reserved_ip_actions.unassign(ip: reserved_ip.ip)`
|
549
549
|
|
550
550
|
## Volume resource
|
551
551
|
|
data/lib/droplet_kit/client.rb
CHANGED
@@ -55,6 +55,8 @@ module DropletKit
|
|
55
55
|
balance: BalanceResource,
|
56
56
|
floating_ips: FloatingIpResource,
|
57
57
|
floating_ip_actions: FloatingIpActionResource,
|
58
|
+
reserved_ips: ReservedIpResource,
|
59
|
+
reserved_ip_actions: ReservedIpActionResource,
|
58
60
|
tags: TagResource,
|
59
61
|
projects: ProjectResource,
|
60
62
|
volumes: VolumeResource,
|
@@ -64,7 +66,7 @@ module DropletKit
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def method_missing(name, *args, &block)
|
67
|
-
if self.class.resources.
|
69
|
+
if self.class.resources.key?(name)
|
68
70
|
resources[name] ||= self.class.resources[name].new(connection: connection)
|
69
71
|
resources[name]
|
70
72
|
else
|
@@ -4,16 +4,17 @@ module ErrorHandlingResourcable
|
|
4
4
|
def self.included(base)
|
5
5
|
base.send(:resources) do
|
6
6
|
default_handler do |response|
|
7
|
-
|
7
|
+
case response.status
|
8
|
+
when 200...299
|
8
9
|
next
|
9
|
-
|
10
|
+
when 429
|
10
11
|
error = DropletKit::RateLimitReached.new("#{response.status}: #{response.body}")
|
11
12
|
error.limit = response.headers['RateLimit-Limit']
|
12
13
|
error.remaining = response.headers['RateLimit-Remaining']
|
13
14
|
error.reset_at = response.headers['RateLimit-Reset']
|
14
15
|
raise error
|
15
16
|
else
|
16
|
-
raise DropletKit::Error
|
17
|
+
raise DropletKit::Error, "#{response.status}: #{response.body}"
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
@@ -9,22 +9,22 @@ module DropletKit
|
|
9
9
|
root_key singular: 'database', plural: 'databases', scopes: [:read]
|
10
10
|
|
11
11
|
property :id, scopes: [:read]
|
12
|
-
property :name, scopes: [
|
13
|
-
property :engine, scopes: [
|
14
|
-
property :version, scopes: [
|
12
|
+
property :name, scopes: %i[read create restore]
|
13
|
+
property :engine, scopes: %i[read create restore]
|
14
|
+
property :version, scopes: %i[read create restore]
|
15
15
|
property :connection, scopes: [:read], include: DatabaseConnectionMapping
|
16
16
|
property :private_connection, scopes: [:read], include: DatabaseConnectionMapping
|
17
17
|
property :users, plural: true, scopes: [:read], include: DatabaseUserMapping
|
18
18
|
property :backup_restore, scopes: [:restore], include: DatabaseBackupRestoreMapping
|
19
|
-
property :num_nodes, scopes: [
|
20
|
-
property :size, scopes: [
|
19
|
+
property :num_nodes, scopes: %i[read create resize restore]
|
20
|
+
property :size, scopes: %i[read create resize restore]
|
21
21
|
property :db_names, plural: true, scopes: [:read]
|
22
|
-
property :region, scopes: [
|
22
|
+
property :region, scopes: %i[read create migrate restore]
|
23
23
|
property :status, scopes: [:read]
|
24
24
|
property :maintenance_window, scopes: [:read], include: DatabaseMaintenanceWindowMapping
|
25
25
|
property :created_at, scopes: [:read]
|
26
|
-
property :private_network_uuid, scopes: [
|
27
|
-
property :tags, plural: true, scopes: [
|
26
|
+
property :private_network_uuid, scopes: %i[read create]
|
27
|
+
property :tags, plural: true, scopes: %i[read create]
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -8,11 +8,11 @@ module DropletKit
|
|
8
8
|
mapping DatabaseConnectionPool
|
9
9
|
root_key singular: 'pool', plural: 'pools', scopes: [:read]
|
10
10
|
|
11
|
-
property :name, scopes: [
|
12
|
-
property :mode, scopes: [
|
13
|
-
property :size, scopes: [
|
14
|
-
property :db, scopes: [
|
15
|
-
property :user, scopes: [
|
11
|
+
property :name, scopes: %i[read create]
|
12
|
+
property :mode, scopes: %i[read create]
|
13
|
+
property :size, scopes: %i[read create]
|
14
|
+
property :db, scopes: %i[read create]
|
15
|
+
property :user, scopes: %i[read create]
|
16
16
|
property :connection, scopes: [:read], include: DatabaseConnectionMapping
|
17
17
|
end
|
18
18
|
end
|
@@ -6,10 +6,10 @@ module DropletKit
|
|
6
6
|
|
7
7
|
kartograph do
|
8
8
|
mapping DatabaseFirewallRule
|
9
|
-
root_key plural: 'rules', scopes: [
|
9
|
+
root_key plural: 'rules', scopes: %i[read update]
|
10
10
|
|
11
|
-
property :type, scopes: [
|
12
|
-
property :value, scopes: [
|
11
|
+
property :type, scopes: %i[read update]
|
12
|
+
property :value, scopes: %i[read update]
|
13
13
|
property :uuid, scopes: [:read]
|
14
14
|
property :cluster_uuid, scopes: [:read]
|
15
15
|
property :created_at, scopes: [:read]
|
@@ -8,8 +8,8 @@ module DropletKit
|
|
8
8
|
mapping DatabaseMaintenanceWindow
|
9
9
|
root_key singular: 'database_maintenance_window', plural: 'database_maintenance_windows', scopes: [:read]
|
10
10
|
|
11
|
-
property :day, scopes: [
|
12
|
-
property :hour, scopes: [
|
11
|
+
property :day, scopes: %i[read update]
|
12
|
+
property :hour, scopes: %i[read update]
|
13
13
|
property :pending, scopes: [:read]
|
14
14
|
property :description, scopes: [:read]
|
15
15
|
end
|
@@ -8,9 +8,9 @@ module DropletKit
|
|
8
8
|
mapping DatabaseUser
|
9
9
|
root_key singular: 'user', plural: 'users', scopes: [:read]
|
10
10
|
|
11
|
-
property :name, scopes: [
|
12
|
-
property :role, scopes: [
|
13
|
-
property :password, scopes: [
|
11
|
+
property :name, scopes: %i[read create]
|
12
|
+
property :role, scopes: %i[read create]
|
13
|
+
property :password, scopes: %i[read create]
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -8,10 +8,10 @@ module DropletKit
|
|
8
8
|
mapping Domain
|
9
9
|
root_key plural: 'domains', singular: 'domain', scopes: [:read]
|
10
10
|
|
11
|
-
property :name, scopes: [
|
11
|
+
property :name, scopes: %i[read create]
|
12
12
|
property :ttl, scopes: [:read]
|
13
13
|
property :zone_file, scopes: [:read]
|
14
14
|
property :ip_address, scopes: [:create]
|
15
15
|
end
|
16
16
|
end
|
17
|
-
end
|
17
|
+
end
|
@@ -9,15 +9,15 @@ module DropletKit
|
|
9
9
|
root_key plural: 'domain_records', singular: 'domain_record', scopes: [:read]
|
10
10
|
|
11
11
|
property :id, scopes: [:read]
|
12
|
-
property :type, scopes: [
|
13
|
-
property :name, scopes: [
|
14
|
-
property :data, scopes: [
|
15
|
-
property :priority, scopes: [
|
16
|
-
property :port, scopes: [
|
17
|
-
property :ttl, scopes: [
|
18
|
-
property :weight, scopes: [
|
19
|
-
property :flags, scopes: [
|
20
|
-
property :tag, scopes: [
|
12
|
+
property :type, scopes: %i[read create update]
|
13
|
+
property :name, scopes: %i[read create update]
|
14
|
+
property :data, scopes: %i[read create update]
|
15
|
+
property :priority, scopes: %i[read create update]
|
16
|
+
property :port, scopes: %i[read create update]
|
17
|
+
property :ttl, scopes: %i[read create update]
|
18
|
+
property :weight, scopes: %i[read create update]
|
19
|
+
property :flags, scopes: %i[read create update]
|
20
|
+
property :tag, scopes: %i[read create update]
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -6,7 +6,7 @@ module DropletKit
|
|
6
6
|
|
7
7
|
kartograph do
|
8
8
|
mapping FirewallOutboundRule
|
9
|
-
root_key plural: 'outbound_rules', scopes: [
|
9
|
+
root_key plural: 'outbound_rules', scopes: %i[read create update]
|
10
10
|
|
11
11
|
scoped :read, :create, :update do
|
12
12
|
property :protocol
|
@@ -10,17 +10,17 @@ module DropletKit
|
|
10
10
|
root_key plural: 'snapshots', singular: 'snapshot', scopes: [:read_snapshot]
|
11
11
|
root_key plural: 'backups', singular: 'backup', scopes: [:read_backup]
|
12
12
|
|
13
|
-
property :id, scopes: [
|
14
|
-
property :name, scopes: [
|
15
|
-
property :distribution, scopes: [
|
16
|
-
property :slug, scopes: [
|
17
|
-
property :public, scopes: [
|
18
|
-
property :regions, scopes: [
|
19
|
-
property :type, scopes: [
|
13
|
+
property :id, scopes: %i[read read_snapshot read_backup]
|
14
|
+
property :name, scopes: %i[read update read_snapshot read_backup]
|
15
|
+
property :distribution, scopes: %i[read read_snapshot read_backup]
|
16
|
+
property :slug, scopes: %i[read read_snapshot read_backup]
|
17
|
+
property :public, scopes: %i[read read_snapshot read_backup]
|
18
|
+
property :regions, scopes: %i[read read_snapshot read_backup]
|
19
|
+
property :type, scopes: %i[read read_snapshot read_backup]
|
20
20
|
|
21
|
-
property :min_disk_size, scopes: [
|
22
|
-
property :created_at, scopes: [
|
23
|
-
property :size_gigabytes, scopes: [
|
21
|
+
property :min_disk_size, scopes: %i[read read_snapshot read_backup]
|
22
|
+
property :created_at, scopes: %i[read read_snapshot read_backup]
|
23
|
+
property :size_gigabytes, scopes: %i[read read_snapshot read_backup]
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -8,19 +8,19 @@ module DropletKit
|
|
8
8
|
root_key plural: 'kubernetes_clusters', singular: 'kubernetes_cluster', scopes: [:read]
|
9
9
|
|
10
10
|
property :id, scopes: [:read]
|
11
|
-
property :name, scopes: [
|
12
|
-
property :region, scopes: [
|
13
|
-
property :version, scopes: [
|
14
|
-
property :auto_upgrade, scopes: [
|
11
|
+
property :name, scopes: %i[read update create]
|
12
|
+
property :region, scopes: %i[read create]
|
13
|
+
property :version, scopes: %i[read create]
|
14
|
+
property :auto_upgrade, scopes: %i[read update create]
|
15
15
|
property :cluster_subnet, scopes: [:read]
|
16
16
|
property :service_subnet, scopes: [:read]
|
17
17
|
property :ipv4, scopes: [:read]
|
18
18
|
property :endpoint, scopes: [:read]
|
19
|
-
property :tags, scopes: [
|
20
|
-
property :maintenance_policy, scopes: [
|
21
|
-
property :node_pools, scopes: [
|
22
|
-
property :vpc_uuid, scopes: [
|
23
|
-
property :ha, scopes: [
|
19
|
+
property :tags, scopes: %i[read update create]
|
20
|
+
property :maintenance_policy, scopes: %i[read update create]
|
21
|
+
property :node_pools, scopes: %i[read create]
|
22
|
+
property :vpc_uuid, scopes: %i[read create]
|
23
|
+
property :ha, scopes: %i[read create]
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -20,18 +20,17 @@ module DropletKit
|
|
20
20
|
property :nodes, plural: true, scopes: [:read], include: KubernetesNodeMapping
|
21
21
|
|
22
22
|
# Create properties
|
23
|
-
property :name, scopes: [
|
24
|
-
property :size, scopes: [
|
25
|
-
property :count, scopes: [
|
26
|
-
property :tags, scopes: [
|
27
|
-
property :labels, scopes: [
|
28
|
-
property :auto_scale, scopes: [
|
29
|
-
property :min_nodes, scopes: [
|
30
|
-
property :max_nodes, scopes: [
|
23
|
+
property :name, scopes: %i[create update]
|
24
|
+
property :size, scopes: %i[create update]
|
25
|
+
property :count, scopes: %i[create update]
|
26
|
+
property :tags, scopes: %i[create update]
|
27
|
+
property :labels, scopes: %i[create update]
|
28
|
+
property :auto_scale, scopes: %i[create update]
|
29
|
+
property :min_nodes, scopes: %i[create update]
|
30
|
+
property :max_nodes, scopes: %i[create update]
|
31
31
|
|
32
32
|
# recycle
|
33
33
|
property :nodes, plural: true, scopes: [:recycle]
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
@@ -8,7 +8,7 @@ module DropletKit
|
|
8
8
|
mapping ProjectAssignment
|
9
9
|
root_key plural: 'resources', singular: 'resource', scopes: [:read]
|
10
10
|
|
11
|
-
property :urn, scopes: [
|
11
|
+
property :urn, scopes: %i[read create]
|
12
12
|
property :assigned_at, scopes: [:read]
|
13
13
|
|
14
14
|
property :links, scopes: [:read] do
|
@@ -12,11 +12,11 @@ module DropletKit
|
|
12
12
|
property :owner_uuid, scopes: [:read]
|
13
13
|
property :owner_id, scopes: [:read]
|
14
14
|
|
15
|
-
property :name, scopes: [
|
16
|
-
property :description, scopes: [
|
17
|
-
property :purpose, scopes: [
|
18
|
-
property :environment, scopes: [
|
19
|
-
property :is_default, scopes: [
|
15
|
+
property :name, scopes: %i[read create update]
|
16
|
+
property :description, scopes: %i[read create update]
|
17
|
+
property :purpose, scopes: %i[read create update]
|
18
|
+
property :environment, scopes: %i[read create update]
|
19
|
+
property :is_default, scopes: %i[read create update]
|
20
20
|
|
21
21
|
property :created_at, scopes: [:read]
|
22
22
|
property :updated_at, scopes: [:read]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DropletKit
|
4
|
+
class ReservedIpMapping
|
5
|
+
include Kartograph::DSL
|
6
|
+
|
7
|
+
kartograph do
|
8
|
+
mapping ReservedIp
|
9
|
+
root_key plural: 'reserved_ips', singular: 'reserved_ip', scopes: [:read]
|
10
|
+
|
11
|
+
property :ip, scopes: [:read]
|
12
|
+
|
13
|
+
property :region, scopes: [:read], include: RegionMapping
|
14
|
+
property :droplet, scopes: [:read], include: DropletMapping
|
15
|
+
|
16
|
+
# Create properties aren't quite the same
|
17
|
+
property :droplet_id, scopes: [:create]
|
18
|
+
property :region, scopes: [:create]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -11,16 +11,15 @@ module DropletKit
|
|
11
11
|
property :id, scopes: [:read]
|
12
12
|
property :region, scopes: [:read], include: RegionMapping
|
13
13
|
property :droplet_ids, scopes: [:read]
|
14
|
-
property :name, scopes: [
|
15
|
-
property :description, scopes: [
|
16
|
-
property :size_gigabytes, scopes: [
|
14
|
+
property :name, scopes: %i[read create]
|
15
|
+
property :description, scopes: %i[read create]
|
16
|
+
property :size_gigabytes, scopes: %i[read create]
|
17
17
|
property :created_at, scopes: [:read]
|
18
18
|
|
19
19
|
property :region, scopes: [:create]
|
20
20
|
property :snapshot_id, scopes: [:create]
|
21
|
-
property :filesystem_type, scopes: [
|
22
|
-
property :filesystem_label, scopes: [
|
21
|
+
property :filesystem_type, scopes: %i[read create]
|
22
|
+
property :filesystem_label, scopes: %i[read create]
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
@@ -6,13 +6,13 @@ require 'droplet_kit/utils'
|
|
6
6
|
module DropletKit
|
7
7
|
class BaseModel
|
8
8
|
DO_NAMESPACE = 'do'
|
9
|
-
UNSUPPORTED_COLLECTIONS = ['space']
|
9
|
+
UNSUPPORTED_COLLECTIONS = ['space'].freeze
|
10
10
|
|
11
11
|
include Virtus.model
|
12
12
|
include Virtus::Equalizer.new(name || inspect)
|
13
13
|
|
14
14
|
def inspect
|
15
|
-
values =
|
15
|
+
values = instance_variables.map { |name| [name, instance_variable_get(name)] }.to_h
|
16
16
|
"<#{self.class.name} #{values}>"
|
17
17
|
end
|
18
18
|
|
@@ -26,7 +26,7 @@ module DropletKit
|
|
26
26
|
|
27
27
|
def identifier
|
28
28
|
identifier = attributes[:id] || attributes[:uuid] || attributes[:slug]
|
29
|
-
raise DropletKit::Error
|
29
|
+
raise DropletKit::Error, "#{self.class.name} doesn't support URNs" if identifier.nil?
|
30
30
|
|
31
31
|
identifier
|
32
32
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DropletKit
|
4
4
|
class ContainerRegistryRepositoryTag < BaseModel
|
5
|
-
[
|
5
|
+
%i[registry_name repository tag manifest_digest compressed_size_bytes size_bytes updated_at].each do |key|
|
6
6
|
attribute(key)
|
7
7
|
end
|
8
8
|
end
|