droplet_kit 3.7.0 → 3.8.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: 1c1031673d25cdfb01e6d3104c78d1b54323b89226caf46cdefed299a1a59a63
4
- data.tar.gz: 78014149c0412f7aabd632d7743bfc6a83f518612f2eb1b15a41540032f4b2cd
3
+ metadata.gz: 3d6e481a1878309fc130d5fa904ce8ec992bc9cc10c99c6c52b8647bc23fce4f
4
+ data.tar.gz: 45e46c149acff5b329ee56ad2d4febd0ee07d5d7832b0745e160aeb2c62047a5
5
5
  SHA512:
6
- metadata.gz: 6b5ac4a556582c79f77212260bb0f47817685e1957d16a6502e666b73cc4e3c923a673cfa4cf873c18b8ba9c3dc03974405e84599e7b6aa17d1710d4b6f2b3b6
7
- data.tar.gz: 990d08778766896d2878dba7f997486bc55a063295d22d56b4714182f07ce5b7838e1bfc91eabbbaf251a59ade95ec61f13bbdb9e8ef309bd1b49e0dd8dae0dd
6
+ metadata.gz: 217a89c5af353e8a91e3fcaaf6a0f42e9e60dc939c9d94a8841ee34faef5f5051c3a506dfab974de2258cd6d6a8d41b8c3f4c02373c81a2a746c71926cd6d1f4
7
+ data.tar.gz: 9bbc06f0bea6cfd49d3a580cee07daa1e430eaaa7a33b6a161e2761e39ecf6298835032e64b8fc38669619325723faddfe2bfcd2557721b16bcfb4cdfb5adbfe
data/README.md CHANGED
@@ -577,6 +577,30 @@ Actions supported:
577
577
  * `client.vpcs.delete(id: 'id')`
578
578
  * `client.vpcs.all_members(id: 'id')`
579
579
 
580
+ ## Container Registry resource
581
+
582
+ client = DropletKit::Client.new(access_token: 'TOKEN')
583
+ client.container_registry #=> DropletKit::ContainerRegistryResource
584
+
585
+ Actions supported:
586
+
587
+ * `client.container_registry.get()`
588
+ * `client.container_registry.create(registry)`
589
+ * `client.container_registry.delete()`
590
+ * `client.container_registry.docker_credentials()`
591
+
592
+ ## Container Registry Repository resource
593
+
594
+ client = DropletKit::Client.new(access_token: 'TOKEN')
595
+ client.container_registry_repository #=> DropletKit::ContainerRegistryRepositoryResource
596
+
597
+ Actions supported:
598
+
599
+ * `client.container_registry_repository.all(registry_name: 'registry')`
600
+ * `client.container_registry_repository.tags(registry_name: 'registry', repository: 'repo')`
601
+ * `client.container_registry_repository.delete_tag(registry_name: 'registry', repository: 'repo', tag: 'tag')`
602
+ * `client.container_registry_repository.delete_manifest(registry_name: 'registry', repository: 'repo', manifest_digest: 'sha256:cb8a924afdf0229ef7515d9e5b3024e23b3eb03ddbba287f4a19c6ac90b8d221')`
603
+
580
604
  ## Contributing
581
605
 
582
606
  1. Fork it ( https://github.com/digitalocean/droplet_kit/fork )
@@ -8,6 +8,8 @@ module DropletKit
8
8
  # Models
9
9
  autoload :BaseModel, 'droplet_kit/models/base_model'
10
10
  autoload :ContainerRegistry, 'droplet_kit/models/container_registry'
11
+ autoload :ContainerRegistryRepository, 'droplet_kit/models/container_registry_repository'
12
+ autoload :ContainerRegistryRepositoryTag, 'droplet_kit/models/container_registry_repository_tag'
11
13
  autoload :Droplet, 'droplet_kit/models/droplet'
12
14
  autoload :Region, 'droplet_kit/models/region'
13
15
  autoload :Image, 'droplet_kit/models/image'
@@ -67,6 +69,7 @@ module DropletKit
67
69
  autoload :DropletResource, 'droplet_kit/resources/droplet_resource'
68
70
  autoload :ActionResource, 'droplet_kit/resources/action_resource'
69
71
  autoload :ContainerRegistryResource, 'droplet_kit/resources/container_registry_resource'
72
+ autoload :ContainerRegistryRepositoryResource, 'droplet_kit/resources/container_registry_repository_resource'
70
73
  autoload :DomainResource, 'droplet_kit/resources/domain_resource'
71
74
  autoload :DomainRecordResource, 'droplet_kit/resources/domain_record_resource'
72
75
  autoload :DropletActionResource, 'droplet_kit/resources/droplet_action_resource'
@@ -96,6 +99,8 @@ module DropletKit
96
99
  # JSON Maps
97
100
  autoload :DropletMapping, 'droplet_kit/mappings/droplet_mapping'
98
101
  autoload :ContainerRegistryMapping, 'droplet_kit/mappings/container_registry_mapping'
102
+ autoload :ContainerRegistryRepositoryMapping, 'droplet_kit/mappings/container_registry_repository_mapping'
103
+ autoload :ContainerRegistryRepositoryTagMapping, 'droplet_kit/mappings/container_registry_repository_tag_mapping'
99
104
  autoload :ImageMapping, 'droplet_kit/mappings/image_mapping'
100
105
  autoload :RegionMapping, 'droplet_kit/mappings/region_mapping'
101
106
  autoload :SizeMapping, 'droplet_kit/mappings/size_mapping'
@@ -32,6 +32,7 @@ module DropletKit
32
32
  cdns: CDNResource,
33
33
  certificates: CertificateResource,
34
34
  container_registry: ContainerRegistryResource,
35
+ container_registry_repository: ContainerRegistryRepositoryResource,
35
36
  databases: DatabaseResource,
36
37
  droplets: DropletResource,
37
38
  kubernetes_clusters: KubernetesClusterResource,
@@ -0,0 +1,14 @@
1
+ module DropletKit
2
+ class ContainerRegistryRepositoryMapping
3
+ include Kartograph::DSL
4
+ kartograph do
5
+ mapping ContainerRegistryRepository
6
+ root_key singular: 'repository', plural: 'repositories', scopes: [:read]
7
+
8
+ property :registry_name, scopes: [:read]
9
+ property :name, scopes: [:read]
10
+ property :latest_tag, scopes: [:read], include: ContainerRegistryRepositoryTagMapping
11
+ property :tag_count, scopes: [:read]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ module DropletKit
2
+ class ContainerRegistryRepositoryTagMapping
3
+ include Kartograph::DSL
4
+ kartograph do
5
+ mapping ContainerRegistryRepositoryTag
6
+ root_key singular: 'tag', plural: 'tags', scopes: [:read]
7
+
8
+ property :registry_name, scopes: [:read]
9
+ property :repository, scopes: [:read]
10
+ property :tag, scopes: [:read]
11
+ property :manifest_digest, scopes: [:read]
12
+ property :compressed_size_bytes, scopes: [:read]
13
+ property :size_bytes, scopes: [:read]
14
+ property :updated_at, scopes: [:read]
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,7 @@
1
+ module DropletKit
2
+ class ContainerRegistryRepository < BaseModel
3
+ [:registry_name,:name,:latest_tag,:tag_count].each do |key|
4
+ attribute(key)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module DropletKit
2
+ class ContainerRegistryRepositoryTag < BaseModel
3
+ [:registry_name,:repository,:tag,:manifest_digest,:compressed_size_bytes,:size_bytes,:updated_at].each do |key|
4
+ attribute(key)
5
+ end
6
+ end
7
+ end
@@ -25,7 +25,7 @@ module DropletKit
25
25
  @collection[index]
26
26
  end
27
27
 
28
- def each(start = 0)
28
+ def each(start = 0, &block)
29
29
  # Start off with the first page if we have no idea of anything yet
30
30
  fetch_next_page if total.nil?
31
31
 
@@ -37,7 +37,7 @@ module DropletKit
37
37
  unless last?
38
38
  start = [@collection.size, start].max
39
39
  fetch_next_page
40
- each(start, &Proc.new)
40
+ each(start, &block)
41
41
  end
42
42
 
43
43
  self
@@ -0,0 +1,35 @@
1
+ module DropletKit
2
+ class ContainerRegistryRepositoryResource < ResourceKit::Resource
3
+ include ErrorHandlingResourcable
4
+
5
+ resources do
6
+ action :all, 'GET /v2/registry/:registry_name/repositories' do
7
+ query_keys :per_page, :page
8
+ handler(200) { |response| ContainerRegistryRepositoryMapping.extract_collection(response.body, :read) }
9
+ end
10
+
11
+ action :tags, 'GET /v2/registry/:registry_name/repositories/:repository/tags' do
12
+ query_keys :per_page, :page
13
+ handler(200) { |response| DropletKit::ContainerRegistryRepositoryTagMapping.extract_collection(response.body, :read) }
14
+ end
15
+
16
+ action :delete_tag, 'DELETE /v2/registry/:registry_name/repositories/:repository/tags/:tag' do
17
+ handler(204) { |response| true }
18
+ end
19
+
20
+ action :delete_manifest, 'DELETE /v2/registry/:registry_name/repositories/:repository/digests/:manifest_digest' do
21
+ handler(204) { |response| true }
22
+ handler(400) { |response| ErrorMapping.fail_with(FailedDelete, response.body) }
23
+ end
24
+ end
25
+
26
+ def all(*args)
27
+ PaginatedResource.new(action(:all), self, *args)
28
+ end
29
+
30
+ def tags(*args)
31
+ PaginatedResource.new(action(:tags), self, *args)
32
+ end
33
+ end
34
+ end
35
+
@@ -1,3 +1,3 @@
1
1
  module DropletKit
2
- VERSION = "3.7.0"
2
+ VERSION = "3.8.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droplet_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
- - Digital Ocean API/CLI team
7
+ - DigitalOcean API Engineering team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-07 00:00:00.000000000 Z
11
+ date: 2020-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -56,14 +56,14 @@ dependencies:
56
56
  name: faraday
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.15'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.15'
69
69
  - !ruby/object:Gem::Dependency
@@ -153,6 +153,8 @@ files:
153
153
  - lib/droplet_kit/mappings/cdn_mapping.rb
154
154
  - lib/droplet_kit/mappings/certificate_mapping.rb
155
155
  - lib/droplet_kit/mappings/container_registry_mapping.rb
156
+ - lib/droplet_kit/mappings/container_registry_repository_mapping.rb
157
+ - lib/droplet_kit/mappings/container_registry_repository_tag_mapping.rb
156
158
  - lib/droplet_kit/mappings/database_backup_mapping.rb
157
159
  - lib/droplet_kit/mappings/database_backup_restore_mapping.rb
158
160
  - lib/droplet_kit/mappings/database_cluster_mapping.rb
@@ -210,6 +212,8 @@ files:
210
212
  - lib/droplet_kit/models/cdn.rb
211
213
  - lib/droplet_kit/models/certificate.rb
212
214
  - lib/droplet_kit/models/container_registry.rb
215
+ - lib/droplet_kit/models/container_registry_repository.rb
216
+ - lib/droplet_kit/models/container_registry_repository_tag.rb
213
217
  - lib/droplet_kit/models/database.rb
214
218
  - lib/droplet_kit/models/database_backup.rb
215
219
  - lib/droplet_kit/models/database_cluster.rb
@@ -267,6 +271,7 @@ files:
267
271
  - lib/droplet_kit/resources/action_resource.rb
268
272
  - lib/droplet_kit/resources/cdn_resource.rb
269
273
  - lib/droplet_kit/resources/certificate_resource.rb
274
+ - lib/droplet_kit/resources/container_registry_repository_resource.rb
270
275
  - lib/droplet_kit/resources/container_registry_resource.rb
271
276
  - lib/droplet_kit/resources/database_resource.rb
272
277
  - lib/droplet_kit/resources/domain_record_resource.rb
@@ -306,7 +311,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
306
311
  requirements:
307
312
  - - ">="
308
313
  - !ruby/object:Gem::Version
309
- version: 2.4.0
314
+ version: 2.5.0
310
315
  required_rubygems_version: !ruby/object:Gem::Requirement
311
316
  requirements:
312
317
  - - ">="