aptible-api 1.0.2 → 1.2.4

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
- SHA1:
3
- metadata.gz: badb2a83972ce6b05b50ec1ee107f45b41eb1817
4
- data.tar.gz: bb991020c5af70cd9f2655122c54fe7d0ed95555
2
+ SHA256:
3
+ metadata.gz: be1c6053f997574827fdcfb296226ff27099004d6c41f518e9af1282289aa6be
4
+ data.tar.gz: 5358305b1616321c836cccbe74e59510f6d47f5075f5ab36cfa80bd01b9b34b8
5
5
  SHA512:
6
- metadata.gz: 5c3d799644752a869c4467431520d73c9878b270519c9e137ee54da5e01787b621f098af164a8d4b7c7683786322c45e71b01bd40b55bff4e08c94c53ec403f7
7
- data.tar.gz: a319e8406cf1cbbf80108ecae77396b5931cc642446bc98a9fca67c27f0babf6fa38b5923bb4afd1bf82ceda2d0862d9f6c3b721e640f6cbac0171d6cdaf5b2f
6
+ metadata.gz: 482ba8b83dc939813695cd27715767741a67fdc14920e0b152e53ee1aa9b05263762e130e973e88b13a00933c6d9cfc9afe85989e8621647c1d3f48c8663ecad
7
+ data.tar.gz: 5aeaaef8f892b287f45ed953e6e0a54d765c6467bf58aed2d4e33379686c8c2cda12724c94b066e7cf647c24392de3e1fb71ba9c75be43f13d0d9448da5f70f7
@@ -0,0 +1 @@
1
+ * @almathew
@@ -1,6 +1,9 @@
1
1
  sudo: false
2
2
 
3
3
  rvm:
4
- - "2.0"
5
4
  - "2.1"
6
5
  - "2.2"
6
+ - "2.3"
7
+ - "2.4"
8
+ - "2.5"
9
+ - "2.6"
data/README.md CHANGED
@@ -61,6 +61,4 @@ end
61
61
 
62
62
  MIT License, see [LICENSE](LICENSE.md) for details.
63
63
 
64
- Copyright (c) 2014 [Aptible](https://www.aptible.com) and contributors.
65
-
66
- [<img src="https://s.gravatar.com/avatar/9b58236204e844e3181e43e05ddb0809?s=60" style="border-radius: 50%;" alt="@sandersonet" />](https://github.com/sandersonet)
64
+ Copyright (c) 2019 [Aptible](https://www.aptible.com) and contributors.
data/Rakefile CHANGED
@@ -4,5 +4,5 @@ begin
4
4
  require 'aptible/tasks'
5
5
  Aptible::Tasks.load_tasks
6
6
  rescue LoadError
7
- $stderr.puts 'Skipping Aptible::Tasks initialization...'
7
+ warn 'Skipping Aptible::Tasks initialization...'
8
8
  end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
 
@@ -19,15 +20,16 @@ Gem::Specification.new do |spec|
19
20
  spec.test_files = spec.files.grep(%r{^spec/})
20
21
  spec.require_paths = ['lib']
21
22
 
22
- spec.add_dependency 'aptible-resource', '~> 1.0'
23
23
  spec.add_dependency 'aptible-auth', '~> 1.0'
24
+ spec.add_dependency 'aptible-resource', '~> 1.0'
24
25
  spec.add_dependency 'gem_config'
25
26
 
26
- spec.add_development_dependency 'bundler', '~> 1.3'
27
- spec.add_development_dependency 'aptible-tasks', '>= 0.2.0'
28
27
  spec.add_development_dependency 'activesupport'
29
- spec.add_development_dependency 'rake', '~> 10.5'
30
- spec.add_development_dependency 'rspec', '~> 2.0'
28
+ spec.add_development_dependency 'aptible-tasks', '>= 0.2.0'
29
+ spec.add_development_dependency 'bundler', '~> 1.3'
31
30
  spec.add_development_dependency 'foreman'
32
31
  spec.add_development_dependency 'pry'
32
+ spec.add_development_dependency 'rake', '~> 12.3.3'
33
+ spec.add_development_dependency 'rspec', '~> 3.9.0'
34
+ spec.add_development_dependency 'rspec-its', '~> 1.3.0'
33
35
  end
@@ -12,6 +12,8 @@ module Aptible
12
12
  has_many :disks
13
13
  has_many :services
14
14
  has_many :permissions
15
+ has_many :metric_drains
16
+ has_many :backup_retention_policy
15
17
  embeds_many :log_drains
16
18
 
17
19
  field :id
@@ -50,6 +52,7 @@ module Aptible
50
52
 
51
53
  def organization
52
54
  return @organization if @organization
55
+
53
56
  auth = Aptible::Auth::Organization.new(token: token, headers: headers)
54
57
  @organization = auth.find_by_url(organization_url)
55
58
  end
@@ -58,6 +61,14 @@ module Aptible
58
61
  rand = ('a'..'z').to_a.sample(8).join
59
62
  "#{organization_name.parameterize}-#{plan_id}-#{rand}"
60
63
  end
64
+
65
+ def each_orphaned_backup
66
+ base_href = "#{links['backups'].base_href}?orphaned=true"
67
+ Backup.each_page(href: base_href, headers: headers,
68
+ token: token) do |page|
69
+ page.each { |entry| yield entry }
70
+ end
71
+ end
61
72
  end
62
73
  end
63
74
  end
@@ -14,6 +14,11 @@ module Aptible
14
14
  field :aws_region
15
15
  field :created_at, type: Time
16
16
  field :updated_at, type: Time
17
+
18
+ def database_with_deleted
19
+ db_id = links['database'].href.split('/').last
20
+ Database.find(db_id, with_deleted: true, token: token, headers: headers)
21
+ end
17
22
  end
18
23
  end
19
24
  end
@@ -0,0 +1,16 @@
1
+ module Aptible
2
+ module Api
3
+ class BackupRetentionPolicy < Resource
4
+ belongs_to :account
5
+
6
+ field :id
7
+ field :daily
8
+ field :monthly
9
+ field :make_copy, type: Aptible::Resource::Boolean
10
+ field :created_at, type: Time
11
+ field :updated_at, type: Time
12
+ field :keep_final, type: Aptible::Resource::Boolean
13
+ field :account_id
14
+ end
15
+ end
16
+ end
@@ -4,6 +4,7 @@ module Aptible
4
4
  belongs_to :release
5
5
  belongs_to :vhost
6
6
  belongs_to :log_drain
7
+ belongs_to :metric_drain
7
8
 
8
9
  field :id
9
10
  field :host
@@ -16,6 +17,7 @@ module Aptible
16
17
  field :layer
17
18
  field :aws_instance_id
18
19
  field :port_mapping
20
+ field :mounts
19
21
  end
20
22
  end
21
23
  end
@@ -28,12 +28,27 @@ module Aptible
28
28
  def failed?
29
29
  # TODO: Add failed status at API level
30
30
  return false if provisioned?
31
+
31
32
  operations.select { |o| o.type == 'provision' }.all?(&:failed?)
32
33
  end
33
34
 
34
35
  def provisioned?
35
36
  status == 'provisioned'
36
37
  end
38
+
39
+ def current_configuration_with_deleted
40
+ id = links['current_configuration'].href.split('/').last
41
+ Aptible::Api::Configuration.find(
42
+ id, with_deleted: true, token: token, headers: headers
43
+ )
44
+ end
45
+
46
+ def disk_with_deleted
47
+ id = links['disk'].href.split('/').last
48
+ Aptible::Api::Disk.find(
49
+ id, with_deleted: true, token: token, headers: headers
50
+ )
51
+ end
37
52
  end
38
53
  end
39
54
  end
@@ -0,0 +1,28 @@
1
+ module Aptible
2
+ module Api
3
+ class MetricDrain < Resource
4
+ belongs_to :account
5
+ belongs_to :database
6
+ has_many :operations
7
+ has_many :containers
8
+
9
+ field :id
10
+
11
+ field :handle
12
+ field :status
13
+ field :drain_type
14
+ field :drain_configuration
15
+
16
+ field :aggregator_ca_certificate
17
+ field :aggregator_ca_private_key_blob
18
+ field :aggregator_host
19
+ field :aggregator_port_mapping
20
+ field :aggregator_docker_name
21
+ field :aggregator_instance_id
22
+ field :aggregator_allocation
23
+
24
+ field :created_at, type: Time
25
+ field :updated_at, type: Time
26
+ end
27
+ end
28
+ end
@@ -28,13 +28,14 @@ module Aptible
28
28
  belongs_to :destination_account
29
29
  field :user_name
30
30
  field :user_email
31
+ field :immediate
31
32
  field :created_at, type: Time
32
33
  field :updated_at, type: Time
33
34
 
34
35
  def user
35
36
  auth = Aptible::Auth::User.new(token: token, headers: headers)
36
37
  auth.find_by_url(links['user'].href)
37
- rescue
38
+ rescue StandardError
38
39
  nil
39
40
  end
40
41
 
@@ -35,3 +35,5 @@ require 'aptible/api/stack'
35
35
  require 'aptible/api/database_credential'
36
36
  require 'aptible/api/ephemeral_session'
37
37
  require 'aptible/api/ephemeral_container'
38
+ require 'aptible/api/metric_drain'
39
+ require 'aptible/api/backup_retention_policy'
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Api
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.2.4'.freeze
4
4
  end
5
5
  end
@@ -9,6 +9,8 @@ end
9
9
  # Require library up front
10
10
  require 'aptible/api'
11
11
 
12
+ require 'rspec/its'
13
+
12
14
  RSpec.configure do |config|
13
15
  config.before { Aptible::Api.configuration.reset }
14
16
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2020-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aptible-resource
14
+ name: aptible-auth
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: aptible-auth
28
+ name: aptible-resource
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
@@ -53,19 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bundler
56
+ name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '1.3'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '1.3'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aptible-tasks
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +81,21 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.2.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: activesupport
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: foreman
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -95,61 +109,61 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: rake
112
+ name: pry
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '10.5'
117
+ version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: '10.5'
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: rspec
126
+ name: rake
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: '2.0'
131
+ version: 12.3.3
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: '2.0'
138
+ version: 12.3.3
125
139
  - !ruby/object:Gem::Dependency
126
- name: foreman
140
+ name: rspec
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - ">="
143
+ - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '0'
145
+ version: 3.9.0
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - ">="
150
+ - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '0'
152
+ version: 3.9.0
139
153
  - !ruby/object:Gem::Dependency
140
- name: pry
154
+ name: rspec-its
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - ">="
157
+ - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '0'
159
+ version: 1.3.0
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - ">="
164
+ - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '0'
166
+ version: 1.3.0
153
167
  description: Ruby client for api.aptible.com
154
168
  email:
155
169
  - frank@macreery.com
@@ -157,6 +171,7 @@ executables: []
157
171
  extensions: []
158
172
  extra_rdoc_files: []
159
173
  files:
174
+ - ".github/CODEOWNERS"
160
175
  - ".gitignore"
161
176
  - ".rspec"
162
177
  - ".travis.yml"
@@ -171,6 +186,7 @@ files:
171
186
  - lib/aptible/api/agent.rb
172
187
  - lib/aptible/api/app.rb
173
188
  - lib/aptible/api/backup.rb
189
+ - lib/aptible/api/backup_retention_policy.rb
174
190
  - lib/aptible/api/certificate.rb
175
191
  - lib/aptible/api/configuration.rb
176
192
  - lib/aptible/api/container.rb
@@ -182,6 +198,7 @@ files:
182
198
  - lib/aptible/api/ephemeral_session.rb
183
199
  - lib/aptible/api/image.rb
184
200
  - lib/aptible/api/log_drain.rb
201
+ - lib/aptible/api/metric_drain.rb
185
202
  - lib/aptible/api/operation.rb
186
203
  - lib/aptible/api/permission.rb
187
204
  - lib/aptible/api/release.rb
@@ -201,7 +218,7 @@ homepage: https://github.com/aptible/aptible-api-ruby
201
218
  licenses:
202
219
  - MIT
203
220
  metadata: {}
204
- post_install_message:
221
+ post_install_message:
205
222
  rdoc_options: []
206
223
  require_paths:
207
224
  - lib
@@ -216,9 +233,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
233
  - !ruby/object:Gem::Version
217
234
  version: '0'
218
235
  requirements: []
219
- rubyforge_project:
220
- rubygems_version: 2.6.13
221
- signing_key:
236
+ rubygems_version: 3.0.3
237
+ signing_key:
222
238
  specification_version: 4
223
239
  summary: Ruby client for api.aptible.com
224
240
  test_files: