aptible-cli 0.19.4 → 0.19.7

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: f3f0904b2033596eb17ff98125288e5a2adec95ae6e379b95a5b8131b81bfe54
4
- data.tar.gz: 9c002c17e22dd77ff79360671d0057455a70ff4ee2311d1466651a5c39b3c1a2
3
+ metadata.gz: e2a2527ad96cee2818196a7d89f78d9de248a55c322593f8373910fe454a3c50
4
+ data.tar.gz: b542815810f6e0ae3c10152e12574a659772f552ff6671f056ee18de110aed90
5
5
  SHA512:
6
- metadata.gz: 0c1b0857f175135e6d7feb64a9a6a7b9633b73823f1f32100473f2f90c5b529a6dcf041b55bf4af47a92af08c425b24f4ce1abfacce3deea74b1e031e0bf5fa0
7
- data.tar.gz: ccb65684ab24eb9055adee5e17a04d0a9dbf2cdc496ba1b71a9a6a229e83ee092ad43c2ee660f73b5da95b47b875bdf2d0212d6ede3d932455ff67188d4b47c1
6
+ metadata.gz: 387dda9c11cef985806f59db0597e036b7e3d0ab7631a1c52346885631c4404799975c1444f1be537ae18923509655176414f997a02edb7fd233eab35ba37fae
7
+ data.tar.gz: 2fbb10994f0e48bbb02b7658c688f4435fc34284be52cdb17f3bc73ec78807b80c4750bcbacabf50c3c4ac5ae2f96d3faf649e8555dc7a8c71929b685f246d7f
data/.travis.yml CHANGED
@@ -2,11 +2,17 @@ dist: xenial
2
2
  sudo: false
3
3
 
4
4
  rvm:
5
- - "2.0"
6
5
  - "2.1"
7
6
  - "2.2"
8
7
  - "2.3"
8
+ - "2.4"
9
+ - "2.5"
10
+ - "2.6"
11
+ - "2.7"
9
12
 
13
+ before_install:
14
+ - ./cleanup_bundler
15
+ - gem install bundler -v '< 2'
10
16
  script:
11
17
  - bundle exec rake
12
18
  - bundle exec script/sync-readme-usage
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
- # ![](https://raw.github.com/aptible/straptible/master/lib/straptible/rails/templates/public.api/icon-60px.png) Aptible CLI
1
+ <br>
2
+ <img src="https://user-images.githubusercontent.com/4295811/226700092-ffbd0c01-dba1-4880-8b77-a4d26e6228f0.svg" width="64">
2
3
 
3
- [![Gem Version](https://badge.fury.io/rb/aptible-cli.png)](https://rubygems.org/gems/aptible-cli)
4
- [![Build Status](https://travis-ci.org/aptible/aptible-cli.png?branch=master)](https://travis-ci.org/aptible/aptible-cli)
5
- [![Dependency Status](https://gemnasium.com/aptible/aptible-cli.png)](https://gemnasium.com/aptible/aptible-cli)
6
- [![Roadmap](https://badge.waffle.io/aptible/aptible-cli.svg?label=ready&title=roadmap)](http://waffle.io/aptible/aptible-cli)
4
+ # Aptible CLI
7
5
 
8
6
  Command-line interface for Aptible services.
9
7
 
@@ -11,8 +9,8 @@ Command-line interface for Aptible services.
11
9
 
12
10
  **NOTE: To install the `aptible` tool as a system-level binary, Aptible
13
11
  recommends you install the
14
- [Aptible Toolbelt](https://support.aptible.com/toolbelt/)**, which is faster
15
- and more robust.
12
+ [Aptible CLI](https://www.aptible.com/docs/cli)** directly, which is
13
+ faster and more robust.
16
14
 
17
15
  Add the following line to your application's Gemfile.
18
16
 
@@ -28,75 +26,79 @@ From `aptible help`:
28
26
  <!-- BEGIN USAGE -->
29
27
  ```
30
28
  Commands:
31
- aptible apps # List all applications
32
- aptible apps:create HANDLE # Create a new application
33
- aptible apps:deprovision # Deprovision an app
34
- aptible apps:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE] # Rename an app handle. In order for the new app handle to appear in log drain and metric drain destinations, you must restart the app.
35
- aptible apps:scale SERVICE [--container-count COUNT] [--container-size SIZE_MB] # Scale a service
36
- aptible backup:list DB_HANDLE # List backups for a database
37
- aptible backup:orphaned # List backups associated with deprovisioned databases
38
- aptible backup:purge BACKUP_ID # Permanently delete a backup and any copies of it
39
- 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
40
- aptible config # Print an app's current configuration
41
- aptible config:add [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
42
- aptible config:rm [VAR1] [VAR2] [...] # Remove an ENV variable from an app
43
- aptible config:set [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
44
- aptible config:unset [VAR1] [VAR2] [...] # Remove an ENV variable from an app
45
- aptible db:backup HANDLE # Backup a database
46
- aptible db:clone SOURCE DEST # Clone a database to create a new one
47
- aptible db:create HANDLE [--type TYPE] [--version VERSION] [--container-size SIZE_MB] [--disk-size SIZE_GB] [--key-arn KEY_ARN] # Create a new database
48
- aptible db:deprovision HANDLE # Deprovision a database
49
- aptible db:dump HANDLE [pg_dump options] # Dump a remote database to file
50
- aptible db:execute HANDLE SQL_FILE [--on-error-stop] # Executes sql against a database
51
- aptible db:list # List all databases
52
- aptible db:modify HANDLE [--iops IOPS] [--volume-type [gp2, gp3]] # Modify a database disk
53
- aptible db:reload HANDLE # Reload a database
54
- aptible db:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE] # Rename a database handle. In order for the new database handle to appear in log drain and metric drain destinations, you must reload the database.
55
- aptible db:replicate HANDLE REPLICA_HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--logical --version VERSION] [--key-arn KEY_ARN] # Create a replica/follower of a database
56
- aptible db:restart HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--iops IOPS] [--volume-type [gp2, gp3]] # Restart a database
57
- aptible db:tunnel HANDLE # Create a local tunnel to a database
58
- aptible db:url HANDLE # Display a database URL
59
- aptible db:versions # List available database versions
60
- aptible deploy [OPTIONS] [VAR1=VAL1] [VAR2=VAL2] [...] # Deploy an app
61
- aptible endpoints:database:create DATABASE # Create a Database Endpoint
62
- aptible endpoints:database:modify --database DATABASE ENDPOINT_HOSTNAME # Modify a Database Endpoint
63
- aptible endpoints:deprovision [--app APP | --database DATABASE] ENDPOINT_HOSTNAME # Deprovision an App or Database Endpoint
64
- aptible endpoints:https:create [--app APP] SERVICE # Create an App HTTPS Endpoint
65
- aptible endpoints:https:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App HTTPS Endpoint
66
- aptible endpoints:list [--app APP | --database DATABASE] # List Endpoints for an App or Database
67
- aptible endpoints:renew [--app APP] ENDPOINT_HOSTNAME # Renew an App Managed TLS Endpoint
68
- aptible endpoints:tcp:create [--app APP] SERVICE # Create an App TCP Endpoint
69
- aptible endpoints:tcp:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TCP Endpoint
70
- aptible endpoints:tls:create [--app APP] SERVICE # Create an App TLS Endpoint
71
- aptible endpoints:tls:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TLS Endpoint
72
- aptible environment:ca_cert # Retrieve the CA certificate associated with the environment
73
- aptible environment:list # List all environments
74
- aptible environment:rename OLD_HANDLE NEW_HANDLE # Rename an environment handle. In order for the new environment handle to appear in log drain/metric destinations, you must restart the apps/databases in this environment.
75
- aptible help [COMMAND] # Describe available commands or one specific command
76
- aptible log_drain:create:datadog HANDLE --url DATADOG_URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a Datadog Log Drain
77
- aptible log_drain:create:elasticsearch HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create an Elasticsearch Log Drain
78
- aptible log_drain:create:https HANDLE --url URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a HTTPS Drain
79
- aptible log_drain:create:logdna HANDLE --url LOGDNA_URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a LogDNA Log Drain
80
- aptible log_drain:create:papertrail HANDLE --host PAPERTRAIL_HOST --port PAPERTRAIL_PORT --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a Papertrail Log Drain
81
- aptible log_drain:create:sumologic HANDLE --url SUMOLOGIC_URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a Sumologic Drain
82
- aptible log_drain:create:syslog HANDLE --host SYSLOG_HOST --port SYSLOG_PORT [--token TOKEN] --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a Papertrail Log Drain
83
- aptible log_drain:deprovision HANDLE --environment ENVIRONMENT # Deprovisions a log drain
84
- aptible log_drain:list # List all Log Drains
85
- aptible login # Log in to Aptible
86
- aptible logs [--app APP | --database DATABASE] # Follows logs from a running app or database
87
- aptible metric_drain:create:datadog HANDLE --api_key DATADOG_API_KEY --site DATADOG_SITE --environment ENVIRONMENT # Create a Datadog Metric Drain
88
- aptible metric_drain:create:influxdb HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT # Create an InfluxDB Metric Drain
89
- aptible metric_drain:create:influxdb:custom HANDLE --username USERNAME --password PASSWORD --url URL_INCLUDING_PORT --db INFLUX_DATABASE_NAME --environment ENVIRONMENT # Create an InfluxDB Metric Drain
90
- aptible metric_drain:deprovision HANDLE --environment ENVIRONMENT # Deprovisions a Metric Drain
91
- aptible metric_drain:list # List all Metric Drains
92
- aptible operation:cancel OPERATION_ID # Cancel a running operation
93
- aptible operation:follow OPERATION_ID # Follow logs of a running operation
94
- aptible operation:logs OPERATION_ID # View logs for given operation
95
- aptible rebuild # Rebuild an app, and restart its services
96
- aptible restart # Restart all services associated with an app
97
- aptible services # List Services for an App
98
- aptible ssh [COMMAND] # Run a command against an app
99
- aptible version # Print Aptible CLI version
29
+ aptible apps # List all applications
30
+ aptible apps:create HANDLE # Create a new application
31
+ aptible apps:deprovision # Deprovision an app
32
+ aptible apps:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE] # Rename an app handle. In order for the new app handle to appear in log drain and metric drain destinations, you must restart the app.
33
+ aptible apps:scale SERVICE [--container-count COUNT] [--container-size SIZE_MB] # Scale a service
34
+ aptible backup:list DB_HANDLE # List backups for a database
35
+ aptible backup:orphaned # List backups associated with deprovisioned databases
36
+ aptible backup:purge BACKUP_ID # Permanently delete a backup and any copies of it
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
+ aptible config # Print an app's current configuration
39
+ aptible config:add [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
40
+ aptible config:rm [VAR1] [VAR2] [...] # Remove an ENV variable from an app
41
+ aptible config:set [VAR1=VAL1] [VAR2=VAL2] [...] # Add an ENV variable to an app
42
+ aptible config:unset [VAR1] [VAR2] [...] # Remove an ENV variable from an app
43
+ aptible db:backup HANDLE # Backup a database
44
+ aptible db:clone SOURCE DEST # Clone a database to create a new one
45
+ aptible db:create HANDLE [--type TYPE] [--version VERSION] [--container-size SIZE_MB] [--disk-size SIZE_GB] [--key-arn KEY_ARN] # Create a new database
46
+ aptible db:deprovision HANDLE # Deprovision a database
47
+ aptible db:dump HANDLE [pg_dump options] # Dump a remote database to file
48
+ aptible db:execute HANDLE SQL_FILE [--on-error-stop] # Executes sql against a database
49
+ aptible db:list # List all databases
50
+ aptible db:modify HANDLE [--iops IOPS] [--volume-type [gp2, gp3]] # Modify a database disk
51
+ aptible db:reload HANDLE # Reload a database
52
+ aptible db:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE] # Rename a database handle. In order for the new database handle to appear in log drain and metric drain destinations, you must reload the database.
53
+ aptible db:replicate HANDLE REPLICA_HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--logical --version VERSION] [--key-arn KEY_ARN] # Create a replica/follower of a database
54
+ aptible db:restart HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--iops IOPS] [--volume-type [gp2, gp3]] # Restart a database
55
+ aptible db:tunnel HANDLE # Create a local tunnel to a database
56
+ aptible db:url HANDLE # Display a database URL
57
+ aptible db:versions # List available database versions
58
+ aptible deploy [OPTIONS] [VAR1=VAL1] [VAR2=VAL2] [...] # Deploy an app
59
+ aptible endpoints:database:create DATABASE # Create a Database Endpoint
60
+ aptible endpoints:database:modify --database DATABASE ENDPOINT_HOSTNAME # Modify a Database Endpoint
61
+ aptible endpoints:deprovision [--app APP | --database DATABASE] ENDPOINT_HOSTNAME # Deprovision an App or Database Endpoint
62
+ aptible endpoints:https:create [--app APP] SERVICE # Create an App HTTPS Endpoint
63
+ aptible endpoints:https:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App HTTPS Endpoint
64
+ aptible endpoints:list [--app APP | --database DATABASE] # List Endpoints for an App or Database
65
+ aptible endpoints:renew [--app APP] ENDPOINT_HOSTNAME # Renew an App Managed TLS Endpoint
66
+ aptible endpoints:tcp:create [--app APP] SERVICE # Create an App TCP Endpoint
67
+ aptible endpoints:tcp:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TCP Endpoint
68
+ aptible endpoints:tls:create [--app APP] SERVICE # Create an App TLS Endpoint
69
+ aptible endpoints:tls:modify [--app APP] ENDPOINT_HOSTNAME # Modify an App TLS Endpoint
70
+ aptible environment:ca_cert # Retrieve the CA certificate associated with the environment
71
+ aptible environment:list # List all environments
72
+ aptible environment:rename OLD_HANDLE NEW_HANDLE # Rename an environment handle. In order for the new environment handle to appear in log drain/metric destinations, you must restart the apps/databases in this environment.
73
+ aptible help [COMMAND] # Describe available commands or one specific command
74
+ aptible log_drain:create:datadog HANDLE --url DATADOG_URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a Datadog Log Drain
75
+ aptible log_drain:create:elasticsearch HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create an Elasticsearch Log Drain
76
+ aptible log_drain:create:https HANDLE --url URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a HTTPS Drain
77
+ aptible log_drain:create:logdna HANDLE --url LOGDNA_URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a LogDNA Log Drain
78
+ aptible log_drain:create:papertrail HANDLE --host PAPERTRAIL_HOST --port PAPERTRAIL_PORT --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a Papertrail Log Drain
79
+ aptible log_drain:create:sumologic HANDLE --url SUMOLOGIC_URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a Sumologic Drain
80
+ aptible log_drain:create:syslog HANDLE --host SYSLOG_HOST --port SYSLOG_PORT [--token TOKEN] --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false] # Create a Papertrail Log Drain
81
+ aptible log_drain:deprovision HANDLE --environment ENVIRONMENT # Deprovisions a log drain
82
+ aptible log_drain:list # List all Log Drains
83
+ aptible login # Log in to Aptible
84
+ aptible logs [--app APP | --database DATABASE] # Follows logs from a running app or database
85
+ aptible logs_from_archive --bucket NAME --region REGION --stack NAME [ --decryption-keys ONE [OR MORE] ] [ --download-location LOCATION ] [ [ --string-matches ONE [OR MORE] ] | [ --app-id ID | --database-id ID | --endpoint-id ID | --container-id ID ] [ --start-date YYYY-MM-DD --end-date YYYY-MM-DD ] ] --bucket=BUCKET --region=REGION --stack=STACK # Retrieves container logs from an S3 archive in your own AWS account. You must provide your AWS credentials via the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
86
+ aptible maintenance:apps # List Apps impacted by maintenance schedules where restarts are required
87
+ aptible maintenance:dbs # List Databases impacted by maintenance schedules where restarts are required
88
+ aptible metric_drain:create:datadog HANDLE --api_key DATADOG_API_KEY --site DATADOG_SITE --environment ENVIRONMENT # Create a Datadog Metric Drain
89
+ aptible metric_drain:create:influxdb HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT # Create an InfluxDB Metric Drain
90
+ aptible metric_drain:create:influxdb:custom HANDLE --username USERNAME --password PASSWORD --url URL_INCLUDING_PORT --db INFLUX_DATABASE_NAME --environment ENVIRONMENT # Create an InfluxDB Metric Drain
91
+ aptible metric_drain:create:influxdb:customv2 HANDLE --org ORGANIZATION --token INFLUX_TOKEN --url URL_INCLUDING_PORT --bucket INFLUX_BUCKET_NAME --environment ENVIRONMENT # Create an InfluxDB v2 Metric Drain
92
+ aptible metric_drain:deprovision HANDLE --environment ENVIRONMENT # Deprovisions a Metric Drain
93
+ aptible metric_drain:list # List all Metric Drains
94
+ aptible operation:cancel OPERATION_ID # Cancel a running operation
95
+ aptible operation:follow OPERATION_ID # Follow logs of a running operation
96
+ aptible operation:logs OPERATION_ID # View logs for given operation
97
+ aptible rebuild # Rebuild an app, and restart its services
98
+ aptible restart # Restart all services associated with an app
99
+ aptible services # List Services for an App
100
+ aptible ssh [COMMAND] # Run a command against an app
101
+ aptible version # Print Aptible CLI version
100
102
  ```
101
103
  <!-- END USAGE -->
102
104
 
data/SECURITY.md ADDED
@@ -0,0 +1,23 @@
1
+ # Aptible Open Source Security Policies and Procedures
2
+
3
+ This document outlines security procedures and general policies for the Aptible open source projects as found on https://github.com/aptible.
4
+
5
+ * [Reporting a Vulnerability](#reporting-a-vulnerability)
6
+ * [Responsible Disclosure Policy](#responsible-disclosure-policy)
7
+
8
+ ## Reporting a Vulnerability
9
+
10
+ The Aptible team and community take all security vulnerabilities
11
+ seriously. Thank you for improving the security of our open source software. We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions.
12
+
13
+ Report security vulnerabilities by emailing the Aptible security team at:
14
+
15
+ security@aptible.com
16
+
17
+ Security researchers can also privately report security vulnerabilities to repository maintainers using the GitHub "Report a Vulnerability" feature. [See how-to here](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability).
18
+
19
+ The Aptible team will acknowledge your email within 24 business hours and send a detailed response within 48 business hours indicating the next steps in handling your report. The Aptible security team will keep you informed of the progress and may ask for additional information or guidance.
20
+
21
+ ## Responsible Disclosure Policy
22
+
23
+ Please see Aptible's Responsible Disclosure Policy here: https://www.aptible.com/legal/responsible-disclosure/
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.2'
24
+ spec.add_dependency 'aptible-api', '~> 1.4'
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'
@@ -29,6 +29,8 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency 'term-ansicolor'
30
30
  spec.add_dependency 'chronic_duration', '~> 0.10.6'
31
31
  spec.add_dependency 'cbor'
32
+ spec.add_dependency 'aws-sdk', '~> 2.0'
33
+ spec.add_dependency 'bigdecimal', '~> 1.3.5' # https://github.com/ruby/bigdecimal#which-version-should-you-select
32
34
 
33
35
  # Temporarily pin ffi until https://github.com/ffi/ffi/issues/868 is fixed
34
36
  spec.add_dependency 'ffi', '<= 1.14.1' if Gem.win_platform?
data/cleanup_bundler ADDED
@@ -0,0 +1,14 @@
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
@@ -21,6 +21,9 @@ require_relative 'helpers/security_key'
21
21
  require_relative 'helpers/config_path'
22
22
  require_relative 'helpers/log_drain'
23
23
  require_relative 'helpers/metric_drain'
24
+ require_relative 'helpers/date_helpers'
25
+ require_relative 'helpers/s3_log_helpers'
26
+ require_relative 'helpers/maintenance'
24
27
 
25
28
  require_relative 'subcommands/apps'
26
29
  require_relative 'subcommands/config'
@@ -38,6 +41,7 @@ require_relative 'subcommands/inspect'
38
41
  require_relative 'subcommands/endpoints'
39
42
  require_relative 'subcommands/log_drain'
40
43
  require_relative 'subcommands/metric_drain'
44
+ require_relative 'subcommands/maintenance'
41
45
 
42
46
  module Aptible
43
47
  module CLI
@@ -48,6 +52,7 @@ module Aptible
48
52
  include Helpers::Ssh
49
53
  include Helpers::System
50
54
  include Helpers::ConfigPath
55
+ include Helpers::DateHelpers
51
56
  include Subcommands::Apps
52
57
  include Subcommands::Config
53
58
  include Subcommands::DB
@@ -64,6 +69,7 @@ module Aptible
64
69
  include Subcommands::Endpoints
65
70
  include Subcommands::LogDrain
66
71
  include Subcommands::MetricDrain
72
+ include Subcommands::Maintenance
67
73
 
68
74
  # Forward return codes on failures.
69
75
  def self.exit_on_failure?
@@ -0,0 +1,34 @@
1
+ module Aptible
2
+ module CLI
3
+ module Helpers
4
+ module DateHelpers
5
+ # This should only be used by the method processing user date input in
6
+ # S3LogHelpers. It is used to process a user-provided string into UTC.
7
+ def utc_date(date_string)
8
+ t_fmt = '%Y-%m-%d %Z'
9
+ Time.strptime("#{date_string} UTC", t_fmt)
10
+ rescue ArgumentError
11
+ raise Thor::Error, 'Please provide dates in YYYY-MM-DD format'
12
+ end
13
+
14
+ # This should only be used by the method processing timestamps from S3
15
+ # file names in S3LogHelpers. The file name does not include any time
16
+ # zone information, but we know it to be in UTC, so we add the "Z"
17
+ def utc_datetime(datetime_string)
18
+ Time.parse("#{datetime_string}Z")
19
+ rescue ArgumentError
20
+ nil
21
+ end
22
+
23
+ # This is used to format timestamps returned by our API into a more
24
+ # readable format.
25
+ # EG, "2023-09-05T22:00:00.000Z" returns "2023-09-05 22:00:00 UTC"
26
+ def utc_string(datetime_string)
27
+ Time.parse(datetime_string)
28
+ rescue ArgumentError
29
+ nil
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,19 @@
1
+ require 'aptible/api'
2
+
3
+ module Aptible
4
+ module CLI
5
+ module Helpers
6
+ module Maintenance
7
+ include Helpers::Token
8
+
9
+ def maintenance_apps
10
+ Aptible::Api::MaintenanceApp.all(token: fetch_token)
11
+ end
12
+
13
+ def maintenance_databases
14
+ Aptible::Api::MaintenanceDatabase.all(token: fetch_token)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end