aptible-cli 0.19.9 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +20 -0
- data/.gitignore +0 -1
- data/.travis.yml +2 -1
- data/Dockerfile +21 -4
- data/Gemfile.lock +184 -0
- data/Makefile +10 -0
- data/README.md +1 -1
- data/aptible-cli.gemspec +1 -1
- data/docker-compose.yml +3 -3
- data/lib/aptible/cli/subcommands/backup_retention_policy.rb +34 -22
- data/lib/aptible/cli/version.rb +1 -1
- metadata +8 -6
- data/cleanup_bundler +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 985fa3322948f2656c41b9b6e7ed378625424554dcf26d1db461386586f488a9
|
4
|
+
data.tar.gz: 71150a291daf6e6a054979d6308e9a919654679b88b9581d51959c3100cf9a07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3551dbb8cff5d22404f022652c70dadf2407f46f11443c84b36eeaa9ba1ec2cb13260d3fd613402c24532e366daf25d9516e19c05a3017f605d5fb8d8a5d5059
|
7
|
+
data.tar.gz: 7ef21a787bbb1c81587fd3ad4ef4adee351a10de48d9b80299d8f7f83912a67d1a54c835c856be2b79d93783c6c45e7211d6abb7f5eb7531f80bc834eadbfcf1
|
data/.dockerignore
ADDED
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Dockerfile
CHANGED
@@ -1,10 +1,27 @@
|
|
1
1
|
FROM ruby:2.7.8
|
2
2
|
|
3
|
+
# Install and use an compatible bundler
|
4
|
+
ENV BUNDLER_VERSION=1.17.3
|
5
|
+
RUN gem install bundler -v "${BUNDLER_VERSION}"
|
6
|
+
|
7
|
+
# Install required gems before copying in code
|
8
|
+
# to avoid re-installing gems when developing
|
3
9
|
WORKDIR /app
|
4
|
-
COPY
|
10
|
+
COPY Gemfile /app
|
11
|
+
COPY Gemfile.lock /app
|
12
|
+
COPY aptible-cli.gemspec /app
|
13
|
+
|
14
|
+
# We reference the version, so copy that in, too
|
15
|
+
CMD mkdir -p /app/lib/aptible/cli/
|
16
|
+
COPY lib/aptible/cli/version.rb /app/lib/aptible/cli/
|
5
17
|
|
6
|
-
RUN ./cleanup_bundler
|
7
|
-
RUN gem install bundler -v '< 2'
|
8
18
|
RUN bundle install
|
9
19
|
|
10
|
-
|
20
|
+
COPY . /app
|
21
|
+
|
22
|
+
# Save on typing while testing
|
23
|
+
RUN echo '#!/bin/bash' > /usr/bin/aptible \
|
24
|
+
&& echo 'bundle exec bin/aptible $@' >> /usr/bin/aptible \
|
25
|
+
&& chmod +x /usr/bin/aptible
|
26
|
+
|
27
|
+
CMD ["aptible"]
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/fancyremarker/pry.git
|
3
|
+
revision: be3823aa4ffc51260f2f3ce84f0984da3dc6dd10
|
4
|
+
branch: aptible
|
5
|
+
specs:
|
6
|
+
pry (0.10.0)
|
7
|
+
coderay (~> 1.1.0)
|
8
|
+
method_source (~> 0.8.1)
|
9
|
+
slop (~> 3.4)
|
10
|
+
|
11
|
+
PATH
|
12
|
+
remote: .
|
13
|
+
specs:
|
14
|
+
aptible-cli (0.20.0)
|
15
|
+
activesupport (>= 4.0, < 6.0)
|
16
|
+
aptible-api (~> 1.5.3)
|
17
|
+
aptible-auth (~> 1.2.4)
|
18
|
+
aptible-billing (~> 1.0)
|
19
|
+
aptible-resource (~> 1.1)
|
20
|
+
aws-sdk (~> 2.0)
|
21
|
+
bigdecimal (~> 1.3.5)
|
22
|
+
cbor
|
23
|
+
chronic_duration (~> 0.10.6)
|
24
|
+
git (< 1.10)
|
25
|
+
term-ansicolor
|
26
|
+
thor (~> 0.20.0)
|
27
|
+
|
28
|
+
GEM
|
29
|
+
remote: https://rubygems.org/
|
30
|
+
specs:
|
31
|
+
activesupport (4.2.11.3)
|
32
|
+
i18n (~> 0.7)
|
33
|
+
minitest (~> 5.1)
|
34
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
35
|
+
tzinfo (~> 1.1)
|
36
|
+
addressable (2.8.0)
|
37
|
+
public_suffix (>= 2.0.2, < 5.0)
|
38
|
+
aptible-api (1.5.3)
|
39
|
+
aptible-auth (~> 1.0)
|
40
|
+
aptible-resource (~> 1.0)
|
41
|
+
gem_config
|
42
|
+
multipart-post (< 2.2.0)
|
43
|
+
aptible-auth (1.2.5)
|
44
|
+
aptible-resource (~> 1.0)
|
45
|
+
gem_config
|
46
|
+
multipart-post (= 2.1.1)
|
47
|
+
oauth2 (= 1.4.7)
|
48
|
+
aptible-billing (1.0.1)
|
49
|
+
activesupport (>= 4.0, < 6.0)
|
50
|
+
aptible-resource (~> 1.0)
|
51
|
+
stripe (>= 1.13.0)
|
52
|
+
aptible-resource (1.1.2)
|
53
|
+
activesupport
|
54
|
+
fridge
|
55
|
+
gem_config (~> 0.3.1)
|
56
|
+
httpclient (~> 2.8)
|
57
|
+
json
|
58
|
+
uri_template (>= 0.5.2)
|
59
|
+
aptible-tasks (0.5.9)
|
60
|
+
rake (>= 10, < 13.0)
|
61
|
+
rubocop (= 0.42.0)
|
62
|
+
ast (2.4.2)
|
63
|
+
aws-eventstream (1.1.1)
|
64
|
+
aws-sdk (2.11.632)
|
65
|
+
aws-sdk-resources (= 2.11.632)
|
66
|
+
aws-sdk-core (2.11.632)
|
67
|
+
aws-sigv4 (~> 1.0)
|
68
|
+
jmespath (~> 1.0)
|
69
|
+
aws-sdk-resources (2.11.632)
|
70
|
+
aws-sdk-core (= 2.11.632)
|
71
|
+
aws-sigv4 (1.2.4)
|
72
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
73
|
+
bigdecimal (1.3.5)
|
74
|
+
cbor (0.5.9.8)
|
75
|
+
chronic_duration (0.10.6)
|
76
|
+
numerizer (~> 0.1.1)
|
77
|
+
climate_control (0.0.3)
|
78
|
+
activesupport (>= 3.0)
|
79
|
+
coderay (1.1.3)
|
80
|
+
concurrent-ruby (1.1.9)
|
81
|
+
connection_pool (2.2.3)
|
82
|
+
crack (1.0.0)
|
83
|
+
bigdecimal
|
84
|
+
rexml
|
85
|
+
diff-lcs (1.5.1)
|
86
|
+
fabrication (2.15.2)
|
87
|
+
faraday (0.17.6)
|
88
|
+
multipart-post (>= 1.2, < 3)
|
89
|
+
fridge (0.2.2)
|
90
|
+
gem_config
|
91
|
+
jwt
|
92
|
+
gem_config (0.3.2)
|
93
|
+
git (1.7.0)
|
94
|
+
rchardet (~> 1.8)
|
95
|
+
hashdiff (1.1.0)
|
96
|
+
httpclient (2.8.3)
|
97
|
+
i18n (0.9.5)
|
98
|
+
concurrent-ruby (~> 1.0)
|
99
|
+
jmespath (1.6.2)
|
100
|
+
json (2.5.1)
|
101
|
+
jwt (2.3.0)
|
102
|
+
method_source (0.8.2)
|
103
|
+
minitest (5.12.0)
|
104
|
+
multi_json (1.15.0)
|
105
|
+
multi_xml (0.6.0)
|
106
|
+
multipart-post (2.1.1)
|
107
|
+
net-http-persistent (3.1.0)
|
108
|
+
connection_pool (~> 2.2)
|
109
|
+
numerizer (0.1.1)
|
110
|
+
oauth2 (1.4.7)
|
111
|
+
faraday (>= 0.8, < 2.0)
|
112
|
+
jwt (>= 1.0, < 3.0)
|
113
|
+
multi_json (~> 1.3)
|
114
|
+
multi_xml (~> 0.5)
|
115
|
+
rack (>= 1.2, < 3)
|
116
|
+
parser (2.7.2.0)
|
117
|
+
ast (~> 2.4.1)
|
118
|
+
powerpack (0.1.3)
|
119
|
+
public_suffix (3.1.1)
|
120
|
+
rack (1.6.13)
|
121
|
+
rainbow (2.2.2)
|
122
|
+
rake
|
123
|
+
rake (12.3.3)
|
124
|
+
rchardet (1.8.0)
|
125
|
+
rexml (3.2.5)
|
126
|
+
rspec (3.13.0)
|
127
|
+
rspec-core (~> 3.13.0)
|
128
|
+
rspec-expectations (~> 3.13.0)
|
129
|
+
rspec-mocks (~> 3.13.0)
|
130
|
+
rspec-core (3.13.0)
|
131
|
+
rspec-support (~> 3.13.0)
|
132
|
+
rspec-expectations (3.13.0)
|
133
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
134
|
+
rspec-support (~> 3.13.0)
|
135
|
+
rspec-mocks (3.13.1)
|
136
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
137
|
+
rspec-support (~> 3.13.0)
|
138
|
+
rspec-support (3.13.1)
|
139
|
+
rubocop (0.42.0)
|
140
|
+
parser (>= 2.3.1.1, < 3.0)
|
141
|
+
powerpack (~> 0.1)
|
142
|
+
rainbow (>= 1.99.1, < 3.0)
|
143
|
+
ruby-progressbar (~> 1.7)
|
144
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
145
|
+
ruby-progressbar (1.13.0)
|
146
|
+
slop (3.6.0)
|
147
|
+
stripe (4.24.0)
|
148
|
+
faraday (~> 0.13)
|
149
|
+
net-http-persistent (~> 3.0)
|
150
|
+
sync (0.5.0)
|
151
|
+
term-ansicolor (1.8.0)
|
152
|
+
tins (~> 1.0)
|
153
|
+
thor (0.20.3)
|
154
|
+
thread_safe (0.3.6)
|
155
|
+
tins (1.33.0)
|
156
|
+
bigdecimal
|
157
|
+
sync
|
158
|
+
tzinfo (1.2.11)
|
159
|
+
thread_safe (~> 0.1)
|
160
|
+
unicode-display_width (1.8.0)
|
161
|
+
uri_template (0.7.0)
|
162
|
+
webmock (3.16.2)
|
163
|
+
addressable (>= 2.8.0)
|
164
|
+
crack (>= 0.3.2)
|
165
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
166
|
+
|
167
|
+
PLATFORMS
|
168
|
+
ruby
|
169
|
+
|
170
|
+
DEPENDENCIES
|
171
|
+
activesupport (~> 4.0)
|
172
|
+
aptible-cli!
|
173
|
+
aptible-tasks (~> 0.5.8)
|
174
|
+
bundler (~> 1.3)
|
175
|
+
climate_control (= 0.0.3)
|
176
|
+
fabrication (~> 2.15.2)
|
177
|
+
pry!
|
178
|
+
rack (~> 1.0)
|
179
|
+
rake
|
180
|
+
rspec (~> 3.2)
|
181
|
+
webmock
|
182
|
+
|
183
|
+
BUNDLED WITH
|
184
|
+
1.17.3
|
data/Makefile
ADDED
data/README.md
CHANGED
@@ -36,7 +36,7 @@ Commands:
|
|
36
36
|
aptible backup:purge BACKUP_ID # Permanently delete a backup and any copies of it
|
37
37
|
aptible backup:restore BACKUP_ID [--environment ENVIRONMENT_HANDLE] [--handle HANDLE] [--container-size SIZE_MB] [--disk-size SIZE_GB] [--key-arn KEY_ARN] # Restore a backup
|
38
38
|
aptible backup_retention_policy [ENVIRONMENT_HANDLE] # Show the current backup retention policy for the environment
|
39
|
-
aptible backup_retention_policy:set [ENVIRONMENT_HANDLE] [--daily DAILY_BACKUPS] [--monthly MONTHLY_BACKUPS] [--yearly YEARLY_BACKUPS] [--make-copy|--no-make-copy] [--keep-final|--no-keep-final] #
|
39
|
+
aptible backup_retention_policy:set [ENVIRONMENT_HANDLE] [--daily DAILY_BACKUPS] [--monthly MONTHLY_BACKUPS] [--yearly YEARLY_BACKUPS] [--make-copy|--no-make-copy] [--keep-final|--no-keep-final] # Change the environemnt's backup retention policy
|
40
40
|
aptible config # Print an app's current configuration
|
41
41
|
aptible config:add [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
|
42
42
|
aptible config:get [VAR1] # Print a specific key within an app's current configuration
|
data/aptible-cli.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
23
|
spec.add_dependency 'aptible-resource', '~> 1.1'
|
24
|
-
spec.add_dependency 'aptible-api', '~> 1.
|
24
|
+
spec.add_dependency 'aptible-api', '~> 1.5.3'
|
25
25
|
spec.add_dependency 'aptible-auth', '~> 1.2.4'
|
26
26
|
spec.add_dependency 'aptible-billing', '~> 1.0'
|
27
27
|
spec.add_dependency 'thor', '~> 0.20.0'
|
data/docker-compose.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
services:
|
2
|
-
# docker compose run cli bash
|
3
|
-
# export APTIBLE_ACCESS_TOKEN=xxx
|
4
|
-
# bundle exec ./bin/aptible help
|
5
2
|
cli:
|
6
3
|
build: .
|
7
4
|
volumes:
|
8
5
|
- type: bind
|
9
6
|
source: .
|
10
7
|
target: /app
|
8
|
+
- type: bind
|
9
|
+
source: $HOME/.aptible/tokens.json
|
10
|
+
target: /root/.aptible/tokens.json
|
@@ -17,14 +17,8 @@ module Aptible
|
|
17
17
|
account = ensure_environment(environment: env)
|
18
18
|
policy = account.backup_retention_policies.first
|
19
19
|
unless policy
|
20
|
-
#
|
21
|
-
|
22
|
-
policy.attributes[:id] = 'default'
|
23
|
-
policy.attributes[:daily] = 90
|
24
|
-
policy.attributes[:monthly] = 72
|
25
|
-
policy.attributes[:yearly] = 0
|
26
|
-
policy.attributes[:make_copy] = true
|
27
|
-
policy.attributes[:keep_final] = true
|
20
|
+
raise Thor::Error, "Environment #{env} does not have a " \
|
21
|
+
'custom backup retention policy'
|
28
22
|
end
|
29
23
|
|
30
24
|
Formatter.render(Renderer.current) do |root|
|
@@ -40,34 +34,52 @@ module Aptible
|
|
40
34
|
'[--daily DAILY_BACKUPS] [--monthly MONTHLY_BACKUPS] ' \
|
41
35
|
'[--yearly YEARLY_BACKUPS] [--make-copy|--no-make-copy] ' \
|
42
36
|
'[--keep-final|--no-keep-final]',
|
43
|
-
"
|
37
|
+
"Change the environemnt's backup retention policy"
|
44
38
|
option :daily, type: :numeric,
|
45
|
-
desc: 'Number of daily backups to retain'
|
46
|
-
default: 90
|
39
|
+
desc: 'Number of daily backups to retain'
|
47
40
|
option :monthly, type: :numeric,
|
48
|
-
desc: 'Number of monthly backups to retain'
|
49
|
-
default: 72
|
41
|
+
desc: 'Number of monthly backups to retain'
|
50
42
|
option :yearly, type: :numeric,
|
51
|
-
desc: 'Number of
|
52
|
-
default: 0
|
43
|
+
desc: 'Number of yearly backups to retain'
|
53
44
|
option :make_copy, type: :boolean,
|
54
|
-
desc: 'If backup copies should be created'
|
55
|
-
default: true
|
45
|
+
desc: 'If backup copies should be created'
|
56
46
|
option(
|
57
47
|
:keep_final,
|
58
48
|
type: :boolean,
|
59
|
-
desc: 'If final backups should be kept when databases are '\
|
60
|
-
'deprovisioned'
|
61
|
-
default: true
|
49
|
+
desc: 'If final backups should be kept when databases are ' \
|
50
|
+
'deprovisioned'
|
62
51
|
)
|
63
52
|
define_method 'backup_retention_policy:set' do |env|
|
53
|
+
if options.empty?
|
54
|
+
raise Thor::Error,
|
55
|
+
'Please specify at least one attribute to change'
|
56
|
+
end
|
57
|
+
|
64
58
|
account = ensure_environment(environment: env)
|
65
|
-
|
59
|
+
current_policy = account.backup_retention_policies.first
|
60
|
+
|
61
|
+
# If an attribute isn't provided, use the value from the current
|
62
|
+
# policy
|
63
|
+
attrs = {}
|
64
|
+
%i(daily monthly yearly make_copy keep_final).each do |a|
|
65
|
+
opt = options[a]
|
66
|
+
attrs[a] = opt.nil? ? current_policy.try(a) : opt
|
67
|
+
end
|
68
|
+
|
69
|
+
# If any of the attribues are missing, raise an error so that
|
70
|
+
# we're not relying on the server's defaults
|
71
|
+
if attrs.values.any?(&:nil?)
|
72
|
+
raise Thor::Error, "Environemnt #{env} does not have a " \
|
73
|
+
'custom backup retention policy. Please ' \
|
74
|
+
'specify all attributes to create one.'
|
75
|
+
end
|
76
|
+
|
77
|
+
new_policy = account.create_backup_retention_policy!(**attrs)
|
66
78
|
|
67
79
|
Formatter.render(Renderer.current) do |root|
|
68
80
|
root.object do |node|
|
69
81
|
ResourceFormatter.inject_backup_retention_policy(
|
70
|
-
node,
|
82
|
+
node, new_policy.reload, account
|
71
83
|
)
|
72
84
|
end
|
73
85
|
end
|
data/lib/aptible/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aptible-resource
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.5.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.5.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: aptible-auth
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -290,20 +290,22 @@ executables:
|
|
290
290
|
extensions: []
|
291
291
|
extra_rdoc_files: []
|
292
292
|
files:
|
293
|
+
- ".dockerignore"
|
293
294
|
- ".github/CODEOWNERS"
|
294
295
|
- ".gitignore"
|
295
296
|
- ".rspec"
|
296
297
|
- ".travis.yml"
|
297
298
|
- Dockerfile
|
298
299
|
- Gemfile
|
300
|
+
- Gemfile.lock
|
299
301
|
- LICENSE.md
|
302
|
+
- Makefile
|
300
303
|
- README.md
|
301
304
|
- Rakefile
|
302
305
|
- SECURITY.md
|
303
306
|
- appveyor.yml
|
304
307
|
- aptible-cli.gemspec
|
305
308
|
- bin/aptible
|
306
|
-
- cleanup_bundler
|
307
309
|
- codecov.yml
|
308
310
|
- docker-compose.yml
|
309
311
|
- lib/aptible/cli.rb
|
@@ -440,7 +442,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
440
442
|
- !ruby/object:Gem::Version
|
441
443
|
version: '0'
|
442
444
|
requirements: []
|
443
|
-
rubygems_version: 3.1
|
445
|
+
rubygems_version: 3.0.3.1
|
444
446
|
signing_key:
|
445
447
|
specification_version: 4
|
446
448
|
summary: Command-line interface for Aptible services
|
data/cleanup_bundler
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Newer rubies have Bundler 2.x installed as default so it can't be deleted
|
4
|
-
# We need Bundler 1.x
|
5
|
-
|
6
|
-
gempaths = `gem env gempath`.split(':')
|
7
|
-
gempaths.each do |gempath|
|
8
|
-
# lookup bundler-*.gemspec files and delete them
|
9
|
-
# this is the only way to completely cleanup default bundler
|
10
|
-
# Note: the bundler gemspecs' paths are different for CRuby and JRuby
|
11
|
-
Dir.glob(gempath.strip + '/specifications/**/bundler-*.gemspec').each do |p|
|
12
|
-
File.delete(p)
|
13
|
-
end
|
14
|
-
end
|