droplet_kit 3.20.0 → 3.21.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fc38c8c6d69e9d358d6a5ce09f48d81f86162b21353864d111362d73ad869d0
4
- data.tar.gz: 69924df50fd90082ab18b00ff46678625bf199929bf722a43a60bb6bd4d4bcc2
3
+ metadata.gz: 615cc2a41f53e00443e4a8b59ea4e1af6b2f8edaf56c35fb764e79b5b28b77f3
4
+ data.tar.gz: 949eb311f59b8923be9c91864482fde4cbf836869c62a095a5aafde54a161bdf
5
5
  SHA512:
6
- metadata.gz: a119768dc94088edf60b0e33fa7429496686d9494350204531b019c491fc8413ff8364cca381495646e3d72c36d39827906e06a0eac8e4eae69faaa9c2a47972
7
- data.tar.gz: abd960f172d61201e42e126cf34a298d4da149f8e0b4cdc2fa19fc96c8b1666b96e81c9a0f612f8aa0cf5ee41ea78d9d304902ab3330084d33a41ecd5c6c91aa
6
+ metadata.gz: c78d6a1b8b99b43bceb14fe12a6a07aef9d5ca08e6ae6724897082d6b619ae393d0a4332018f05682851bfa89a13247fa97fc58d594b32f76d8518e857c9fa22
7
+ data.tar.gz: 813777d5eaa8e768291b2b4a0d9c74da033db81ce02f905227afea51283b25108b62a14d08fad46241c4db3677eec94199a9cb2926f5141c8e9ba9cb5fe9f6e7
data/README.md CHANGED
@@ -622,6 +622,20 @@ Actions supported:
622
622
  * `client.vpcs.delete(id: 'id')`
623
623
  * `client.vpcs.all_members(id: 'id')`
624
624
 
625
+ ## VPC Peering resource
626
+
627
+ client = DropletKit::Client.new(access_token: 'TOKEN')
628
+ client.vpc_peerings #=> DropletKit::VPCPeeringResource
629
+
630
+ Actions supported:
631
+
632
+ * `client.vpc_peerings.find(id: 'id')`
633
+ * `client.vpc_peerings.all()`
634
+ * `client.vpc_peerings.create(vpc_peering)`
635
+ * `client.vpc_peerings.update(vpc_peering, id: 'id')`
636
+ * `client.vpc_peerings.patch(vpc_peering, id: 'id')`
637
+ * `client.vpc_peerings.delete(id: 'id')`
638
+
625
639
  ## Container Registry resource
626
640
 
627
641
  client = DropletKit::Client.new(access_token: 'TOKEN')
@@ -80,7 +80,8 @@ module DropletKit
80
80
  projects: ProjectResource,
81
81
  volumes: VolumeResource,
82
82
  volume_actions: VolumeActionResource,
83
- vpcs: VPCResource
83
+ vpcs: VPCResource,
84
+ vpc_peerings: VPCPeeringResource
84
85
  }
85
86
  end
86
87
 
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class VPCPeeringMapping
5
+ include Kartograph::DSL
6
+
7
+ kartograph do
8
+ mapping VPCPeering
9
+ root_key plural: 'vpc_peerings', singular: 'vpc_peering', scopes: [:read]
10
+
11
+ scoped :read do
12
+ property :id
13
+ property :name
14
+ property :vpc_ids
15
+ property :created_at
16
+ property :status
17
+ end
18
+
19
+ scoped :update, :patch do
20
+ property :name
21
+ end
22
+
23
+ scoped :create do
24
+ property :name
25
+ property :vpc_ids
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class VPCPeering < BaseModel
5
+ attribute :id
6
+ attribute :name
7
+ attribute :vpc_ids
8
+ attribute :created_at
9
+ attribute :status
10
+ end
11
+ end
@@ -35,7 +35,7 @@ module DropletKit
35
35
  end
36
36
 
37
37
  TAG_ACTIONS.each do |action_name|
38
- action "#{action_name}_for_tag".to_sym, 'POST /v2/droplets/actions' do
38
+ action :"#{action_name}_for_tag", 'POST /v2/droplets/actions' do
39
39
  query_keys :tag_name
40
40
  body { |_| { type: action_name }.to_json }
41
41
  handler(201, 200) { |response| ActionMapping.extract_collection(response.body, :read) }
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class VPCPeeringResource < ResourceKit::Resource
5
+ include ErrorHandlingResourcable
6
+
7
+ resources do
8
+ action :find, 'GET /v2/vpc_peerings/:id' do
9
+ handler(200) do |response|
10
+ VPCPeeringMapping.extract_single(response.body, :read)
11
+ end
12
+ end
13
+
14
+ action :all, 'GET /v2/vpc_peerings' do
15
+ query_keys :per_page, :page
16
+
17
+ handler(200) do |response|
18
+ VPCPeeringMapping.extract_collection(response.body, :read)
19
+ end
20
+ end
21
+
22
+ action :create, 'POST /v2/vpc_peerings' do
23
+ body { |vpc_peering| VPCPeeringMapping.representation_for(:create, vpc_peering) }
24
+ handler(202) { |response| VPCPeeringMapping.extract_single(response.body, :read) }
25
+ handler(422) { |response| ErrorMapping.fail_with(FailedCreate, response.body) }
26
+ end
27
+
28
+ action :patch, 'PATCH /v2/vpc_peerings/:id' do
29
+ body { |vpc_peering| VPCPeeringMapping.representation_for(:patch, vpc_peering) }
30
+ handler(200) { |response| VPCPeeringMapping.extract_single(response.body, :read) }
31
+ handler(422) { |response| ErrorMapping.fail_with(FailedUpdate, response.body) }
32
+ end
33
+
34
+ action :delete, 'DELETE /v2/vpc_peerings/:id' do
35
+ handler(202) { |response| VPCPeeringMapping.extract_single(response.body, :read) }
36
+ end
37
+ end
38
+
39
+ def all(*args)
40
+ PaginatedResource.new(action(:all), self, *args)
41
+ end
42
+ end
43
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DropletKit
4
- VERSION = '3.20.0'
4
+ VERSION = '3.21.0'
5
5
  end
data/lib/droplet_kit.rb CHANGED
@@ -69,6 +69,7 @@ module DropletKit
69
69
  autoload :KubernetesOptions, 'droplet_kit/models/kubernetes_options'
70
70
  autoload :VPC, 'droplet_kit/models/vpc'
71
71
  autoload :VPCMember, 'droplet_kit/models/vpc_member'
72
+ autoload :VPCPeering, 'droplet_kit/models/vpc_peering'
72
73
 
73
74
  # Resources
74
75
  autoload :DropletResource, 'droplet_kit/resources/droplet_resource'
@@ -104,6 +105,7 @@ module DropletKit
104
105
  autoload :KubernetesClusterResource, 'droplet_kit/resources/kubernetes_cluster_resource'
105
106
  autoload :KubernetesOptionsResource, 'droplet_kit/resources/kubernetes_options_resource'
106
107
  autoload :VPCResource, 'droplet_kit/resources/vpc_resource'
108
+ autoload :VPCPeeringResource, 'droplet_kit/resources/vpc_peering_resource'
107
109
 
108
110
  # JSON Maps
109
111
  autoload :DropletMapping, 'droplet_kit/mappings/droplet_mapping'
@@ -168,6 +170,7 @@ module DropletKit
168
170
  autoload :KubernetesOptionsMapping, 'droplet_kit/mappings/kubernetes_options_mapping'
169
171
  autoload :VPCMapping, 'droplet_kit/mappings/vpc_mapping'
170
172
  autoload :VPCMemberMapping, 'droplet_kit/mappings/vpc_member_mapping'
173
+ autoload :VPCPeeringMapping, 'droplet_kit/mappings/vpc_peering_mapping'
171
174
 
172
175
  # Utils
173
176
  autoload :PaginatedResource, 'droplet_kit/paginated_resource'
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droplet_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.20.0
4
+ version: 3.21.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: 2023-08-21 00:00:00.000000000 Z
11
+ date: 2024-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bigdecimal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: faraday
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -299,6 +313,7 @@ files:
299
313
  - lib/droplet_kit/mappings/volume_mapping.rb
300
314
  - lib/droplet_kit/mappings/vpc_mapping.rb
301
315
  - lib/droplet_kit/mappings/vpc_member_mapping.rb
316
+ - lib/droplet_kit/mappings/vpc_peering_mapping.rb
302
317
  - lib/droplet_kit/models/account.rb
303
318
  - lib/droplet_kit/models/action.rb
304
319
  - lib/droplet_kit/models/balance.rb
@@ -362,6 +377,7 @@ files:
362
377
  - lib/droplet_kit/models/volume.rb
363
378
  - lib/droplet_kit/models/vpc.rb
364
379
  - lib/droplet_kit/models/vpc_member.rb
380
+ - lib/droplet_kit/models/vpc_peering.rb
365
381
  - lib/droplet_kit/paginated_resource.rb
366
382
  - lib/droplet_kit/resources/account_resource.rb
367
383
  - lib/droplet_kit/resources/action_resource.rb
@@ -395,6 +411,7 @@ files:
395
411
  - lib/droplet_kit/resources/tag_resource.rb
396
412
  - lib/droplet_kit/resources/volume_action_resource.rb
397
413
  - lib/droplet_kit/resources/volume_resource.rb
414
+ - lib/droplet_kit/resources/vpc_peering_resource.rb
398
415
  - lib/droplet_kit/resources/vpc_resource.rb
399
416
  - lib/droplet_kit/utils.rb
400
417
  - lib/droplet_kit/version.rb