droplet_kit 3.16.1 → 3.17.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 +2 -0
- data/lib/droplet_kit/mappings/reserved_ip_mapping.rb +21 -0
- data/lib/droplet_kit/models/reserved_ip.rb +20 -0
- 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/version.rb +1 -1
- data/lib/droplet_kit.rb +4 -0
- metadata +14 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41268723b3dc385b7044425695730bfdd7f11852f790a3a0ef67d40b63dc5057
|
4
|
+
data.tar.gz: d96fbf6b39c6d3536afdb3a3dd458cfa4bf5ffbdc758d023427d04eff85eef94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aa5da7401020dda27fafb3d7fa3844d089ade8c3e5b029cfe656fb1b802a798cc91f96cfe37c0204a73f26182952b8f004ef254cb599087ad6d3c590b4b1c2a
|
7
|
+
data.tar.gz: bead9ef065aae464fd0d8c7f0b421c5e58d57af2026054d39ceaf2cef5286146bd4d2ba8ea6c9ce33a3e2a6391c4492edcef9270808ca3ba7e8b7808b2b1c3f3
|
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,
|
@@ -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
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DropletKit
|
4
|
+
class ReservedIp < BaseModel
|
5
|
+
attribute :ip
|
6
|
+
attribute :region
|
7
|
+
attribute :droplet
|
8
|
+
|
9
|
+
# Used for creates
|
10
|
+
attribute :droplet_id
|
11
|
+
|
12
|
+
def identifier
|
13
|
+
ip
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.from_identifier(identifier)
|
17
|
+
new(ip: identifier)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DropletKit
|
4
|
+
class ReservedIpActionResource < ResourceKit::Resource
|
5
|
+
resources do
|
6
|
+
default_handler(422) { |response| ErrorMapping.fail_with(FailedCreate, response.body) }
|
7
|
+
|
8
|
+
action :assign, 'POST /v2/reserved_ips/:ip/actions' do
|
9
|
+
body { |hash| { type: 'assign', droplet_id: hash[:droplet_id] }.to_json }
|
10
|
+
handler(201, 200) { |response| ActionMapping.extract_single(response.body, :read) }
|
11
|
+
end
|
12
|
+
|
13
|
+
action :unassign, 'POST /v2/reserved_ips/:ip/actions' do
|
14
|
+
body { |hash| { type: 'unassign' }.to_json }
|
15
|
+
handler(201, 200) { |response| ActionMapping.extract_single(response.body, :read) }
|
16
|
+
end
|
17
|
+
|
18
|
+
action :find, 'GET /v2/reserved_ips/:ip/actions/:id' do
|
19
|
+
handler(200) { |response| ActionMapping.extract_single(response.body, :read) }
|
20
|
+
end
|
21
|
+
|
22
|
+
action :all, 'GET /v2/reserved_ips/:ip/actions' do
|
23
|
+
query_keys :per_page, :page
|
24
|
+
handler(200) { |response| ActionMapping.extract_collection(response.body, :read) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def all(*args)
|
29
|
+
PaginatedResource.new(action(:all), self, *args)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DropletKit
|
4
|
+
class ReservedIpResource < ResourceKit::Resource
|
5
|
+
resources do
|
6
|
+
action :all, 'GET /v2/reserved_ips' do
|
7
|
+
query_keys :per_page, :page
|
8
|
+
handler(200) { |response| ReservedIpMapping.extract_collection(response.body, :read) }
|
9
|
+
end
|
10
|
+
|
11
|
+
action :find, 'GET /v2/reserved_ips/:ip' do
|
12
|
+
handler(200) { |response| ReservedIpMapping.extract_single(response.body, :read) }
|
13
|
+
end
|
14
|
+
|
15
|
+
action :create, 'POST /v2/reserved_ips' do
|
16
|
+
body { |object| ReservedIpMapping.representation_for(:create, object) }
|
17
|
+
handler(202) { |response| ReservedIpMapping.extract_single(response.body, :read) }
|
18
|
+
handler(422) { |response| ErrorMapping.fail_with(FailedCreate, response.body) }
|
19
|
+
end
|
20
|
+
|
21
|
+
action :delete, 'DELETE /v2/reserved_ips/:ip' do
|
22
|
+
handler(202) { |response| ActionMapping.extract_single(response.body, :read) }
|
23
|
+
handler(204) { |response| true }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def all(*args)
|
28
|
+
PaginatedResource.new(action(:all), self, *args)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/droplet_kit/version.rb
CHANGED
data/lib/droplet_kit.rb
CHANGED
@@ -30,6 +30,7 @@ module DropletKit
|
|
30
30
|
autoload :Balance, 'droplet_kit/models/balance'
|
31
31
|
autoload :DropletUpgrade, 'droplet_kit/models/droplet_upgrade'
|
32
32
|
autoload :FloatingIp, 'droplet_kit/models/floating_ip'
|
33
|
+
autoload :ReservedIp, 'droplet_kit/models/reserved_ip'
|
33
34
|
autoload :Project, 'droplet_kit/models/project'
|
34
35
|
autoload :ProjectAssignment, 'droplet_kit/models/project_assignment'
|
35
36
|
autoload :Links, 'droplet_kit/models/links'
|
@@ -88,6 +89,8 @@ module DropletKit
|
|
88
89
|
autoload :DropletUpgradeResource, 'droplet_kit/resources/droplet_upgrade_resource'
|
89
90
|
autoload :FloatingIpResource, 'droplet_kit/resources/floating_ip_resource'
|
90
91
|
autoload :FloatingIpActionResource, 'droplet_kit/resources/floating_ip_action_resource'
|
92
|
+
autoload :ReservedIpResource, 'droplet_kit/resources/reserved_ip_resource'
|
93
|
+
autoload :ReservedIpActionResource, 'droplet_kit/resources/reserved_ip_action_resource'
|
91
94
|
autoload :ProjectResource, 'droplet_kit/resources/project_resource'
|
92
95
|
autoload :TagResource, 'droplet_kit/resources/tag_resource'
|
93
96
|
autoload :VolumeResource, 'droplet_kit/resources/volume_resource'
|
@@ -125,6 +128,7 @@ module DropletKit
|
|
125
128
|
autoload :BalanceMapping, 'droplet_kit/mappings/balance_mapping'
|
126
129
|
autoload :DropletUpgradeMapping, 'droplet_kit/mappings/droplet_upgrade_mapping'
|
127
130
|
autoload :FloatingIpMapping, 'droplet_kit/mappings/floating_ip_mapping'
|
131
|
+
autoload :ReservedIpMapping, 'droplet_kit/mappings/reserved_ip_mapping'
|
128
132
|
autoload :ProjectMapping, 'droplet_kit/mappings/project_mapping'
|
129
133
|
autoload :ProjectAssignmentMapping, 'droplet_kit/mappings/project_assignment_mapping'
|
130
134
|
autoload :LinksMapping, 'droplet_kit/mappings/links_mapping'
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: droplet_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DigitalOcean API Engineering team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.0.3
|
20
|
+
- - "<="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 1.0.3
|
30
|
+
- - "<="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: resource_kit
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,6 +203,7 @@ files:
|
|
197
203
|
- lib/droplet_kit/mappings/project_assignment_mapping.rb
|
198
204
|
- lib/droplet_kit/mappings/project_mapping.rb
|
199
205
|
- lib/droplet_kit/mappings/region_mapping.rb
|
206
|
+
- lib/droplet_kit/mappings/reserved_ip_mapping.rb
|
200
207
|
- lib/droplet_kit/mappings/size_mapping.rb
|
201
208
|
- lib/droplet_kit/mappings/snapshot_mapping.rb
|
202
209
|
- lib/droplet_kit/mappings/ssh_key_mapping.rb
|
@@ -259,6 +266,7 @@ files:
|
|
259
266
|
- lib/droplet_kit/models/project.rb
|
260
267
|
- lib/droplet_kit/models/project_assignment.rb
|
261
268
|
- lib/droplet_kit/models/region.rb
|
269
|
+
- lib/droplet_kit/models/reserved_ip.rb
|
262
270
|
- lib/droplet_kit/models/size.rb
|
263
271
|
- lib/droplet_kit/models/snapshot.rb
|
264
272
|
- lib/droplet_kit/models/ssh_key.rb
|
@@ -295,6 +303,8 @@ files:
|
|
295
303
|
- lib/droplet_kit/resources/load_balancer_resource.rb
|
296
304
|
- lib/droplet_kit/resources/project_resource.rb
|
297
305
|
- lib/droplet_kit/resources/region_resource.rb
|
306
|
+
- lib/droplet_kit/resources/reserved_ip_action_resource.rb
|
307
|
+
- lib/droplet_kit/resources/reserved_ip_resource.rb
|
298
308
|
- lib/droplet_kit/resources/size_resource.rb
|
299
309
|
- lib/droplet_kit/resources/snapshot_resource.rb
|
300
310
|
- lib/droplet_kit/resources/ssh_key_resource.rb
|