aptible-cli 0.24.4 → 0.24.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b52a3b2e10513aea9042d2aaa69ce9b224b07ab6eb19bf510a2cad0839d402c
4
- data.tar.gz: 441fe200c9ea43e7b0abebfcab263f940fa3cfb6a381e9432b5f98c2ea603bd6
3
+ metadata.gz: e8868cc991ca4ab8a8c73c66c6a1e5c029afc06b7a9250efdbfe3e2abfe62098
4
+ data.tar.gz: 33a7c0e617e7ef2c64c79187f669e270397c5ee601d5ba8742e7459213a06f25
5
5
  SHA512:
6
- metadata.gz: 55b8a89a9708614233fc95df1cfc9ee27a6653d8f22f3a6781b03bc19d9f6661b32bb86843312a9e22866fc8caee55fa912a2ce473857e3592f3bd8214ef7e90
7
- data.tar.gz: 743783a9426bcd48c1efa2f367d50affdf8d67cac2d838698496ce44c29eb225f4e65577d1d220fed5a916c00b9cf3388806f258e562c45549c84c80ff26298b
6
+ metadata.gz: a1670ce53b02d040aa10253e795e21ef9ff2d6bf460df5f410b1ffd29cd01e05050b628857ae176f0e732fac466cc38d0b44cacb0137bcee81cb74bed74ed3b5
7
+ data.tar.gz: 8bc85cbb726bf02bcb5ea99aed4b9bbbd39950c4fab7fc04a44bdadf2b5dff221e10ea271486719ee3c20295e2e5d9acdbf21a426f34bc0f166a99444c18f676
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aptible-cli (0.24.4)
4
+ aptible-cli (0.24.5)
5
5
  activesupport (>= 4.0, < 6.0)
6
- aptible-api (~> 1.6.5)
6
+ aptible-api (~> 1.8)
7
7
  aptible-auth (~> 1.2.5)
8
8
  aptible-billing (~> 1.0)
9
9
  aptible-resource (~> 1.1)
@@ -28,7 +28,7 @@ GEM
28
28
  tzinfo (~> 1.1)
29
29
  addressable (2.8.0)
30
30
  public_suffix (>= 2.0.2, < 5.0)
31
- aptible-api (1.6.5)
31
+ aptible-api (1.8)
32
32
  aptible-auth
33
33
  aptible-resource
34
34
  gem_config
data/README.md CHANGED
@@ -76,13 +76,13 @@ Commands:
76
76
  aptible environment:list # List all environments
77
77
  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.
78
78
  aptible help [COMMAND] # Describe available commands or one specific command
79
- 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
80
- 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
81
- 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
82
- 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
83
- 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
84
- 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
85
- 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
79
+ aptible log_drain:create:datadog HANDLE --url DATADOG_URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a Datadog Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
80
+ aptible log_drain:create:elasticsearch HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create an Elasticsearch Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
81
+ aptible log_drain:create:https HANDLE --url URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a HTTPS Drain
82
+ aptible log_drain:create:logdna HANDLE --url LOGDNA_URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a LogDNA/Mezmo Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
83
+ aptible log_drain:create:papertrail HANDLE --host PAPERTRAIL_HOST --port PAPERTRAIL_PORT --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a Papertrail Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
84
+ aptible log_drain:create:sumologic HANDLE --url SUMOLOGIC_URL --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a Sumologic Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
85
+ aptible log_drain:create:syslog HANDLE --host SYSLOG_HOST --port SYSLOG_PORT [--token TOKEN] --environment ENVIRONMENT [--drain-apps|--no-drain-apps] [--drain-databases|--no-drain-databases] [--drain-ephemeral-sessions|--no-drain-ephemeral-sessions] [--drain_proxies|--no-drain-proxies] # Create a Syslog Log Drain. By default, App, Database, Ephemeral Session, and Proxy logs will be sent to your chosen destination.
86
86
  aptible log_drain:deprovision HANDLE --environment ENVIRONMENT # Deprovisions a log drain
87
87
  aptible log_drain:list # List all Log Drains
88
88
  aptible login # Log in to Aptible
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 'activesupport', '>= 4.0', '< 6.0'
24
- spec.add_dependency 'aptible-api', '~> 1.6.5'
24
+ spec.add_dependency 'aptible-api', '~> 1.8'
25
25
  spec.add_dependency 'aptible-auth', '~> 1.2.5'
26
26
  spec.add_dependency 'aptible-billing', '~> 1.0'
27
27
  spec.add_dependency 'aptible-resource', '~> 1.1'
@@ -67,10 +67,22 @@ module Aptible
67
67
  attach_account(node, account)
68
68
  end
69
69
 
70
- def inject_account(node, account)
70
+ def inject_account(node, account, include_stack = false)
71
71
  node.value('id', account.id)
72
72
  node.value('handle', account.handle)
73
73
  node.value('created_at', account.created_at)
74
+
75
+ if include_stack && account.stack
76
+ node.keyed_object('stack', 'name') do |n|
77
+ n.value('name', account.stack.name)
78
+ n.value('id', account.stack.id)
79
+ n.value('region', account.stack.region)
80
+ n.value(
81
+ 'outbound_ip_addresses',
82
+ account.stack.outbound_ip_addresses
83
+ )
84
+ end
85
+ end
74
86
  end
75
87
 
76
88
  def inject_operation(node, operation)
@@ -145,6 +157,8 @@ module Aptible
145
157
  if database.service
146
158
  node.value('container_size', \
147
159
  database.service.container_memory_limit_mb)
160
+ node.value('container_profile', \
161
+ database.service.instance_class.to_s[/[a-z]/])
148
162
  end
149
163
  end
150
164
 
@@ -309,10 +323,10 @@ module Aptible
309
323
 
310
324
  private
311
325
 
312
- def attach_account(node, account)
326
+ def attach_account(node, account, include_stack = false)
313
327
  return if NO_NESTING.eql?(account)
314
328
  node.keyed_object('environment', 'handle') do |n|
315
- inject_account(n, account)
329
+ inject_account(n, account, include_stack)
316
330
  end
317
331
  end
318
332
 
@@ -19,7 +19,7 @@ module Aptible
19
19
  ) do |node|
20
20
  scoped_environments(options).each do |account|
21
21
  node.object do |n|
22
- ResourceFormatter.inject_account(n, account)
22
+ ResourceFormatter.inject_account(n, account, true)
23
23
  end
24
24
  end
25
25
  end
@@ -10,10 +10,11 @@ module Aptible
10
10
  include Helpers::Telemetry
11
11
 
12
12
  drain_flags = '--environment ENVIRONMENT ' \
13
- '[--drain-apps true/false] ' \
14
- '[--drain_databases true/false] ' \
15
- '[--drain_ephemeral_sessions true/false] ' \
16
- '[--drain_proxies true/false]'
13
+ '[--drain-apps|--no-drain-apps] ' \
14
+ '[--drain-databases|--no-drain-databases] ' \
15
+ '[--drain-ephemeral-sessions|' \
16
+ +'--no-drain-ephemeral-sessions] ' \
17
+ '[--drain_proxies|--no-drain-proxies]'
17
18
 
18
19
  def self.drain_options
19
20
  option :drain_apps, default: true, type: :boolean
@@ -54,7 +55,9 @@ module Aptible
54
55
  desc 'log_drain:create:elasticsearch HANDLE '\
55
56
  '--db DATABASE_HANDLE ' \
56
57
  + drain_flags,
57
- 'Create an Elasticsearch Log Drain'
58
+ 'Create an Elasticsearch Log Drain. By default, App, ' \
59
+ +'Database, Ephemeral Session, and Proxy logs will be sent ' \
60
+ +'to your chosen destination.'
58
61
  drain_options
59
62
  option :db, type: :string
60
63
  option :pipeline, type: :string
@@ -81,7 +84,9 @@ module Aptible
81
84
  desc 'log_drain:create:datadog HANDLE ' \
82
85
  '--url DATADOG_URL ' \
83
86
  + drain_flags,
84
- 'Create a Datadog Log Drain'
87
+ 'Create a Datadog Log Drain. By default, App, Database, ' \
88
+ + 'Ephemeral Session, and Proxy logs will be sent ' \
89
+ + 'to your chosen destination.'
85
90
  drain_options
86
91
  option :url, type: :string
87
92
  define_method 'log_drain:create:datadog' do |handle|
@@ -107,7 +112,9 @@ module Aptible
107
112
  desc 'log_drain:create:sumologic HANDLE ' \
108
113
  '--url SUMOLOGIC_URL ' \
109
114
  + drain_flags,
110
- 'Create a Sumologic Drain'
115
+ 'Create a Sumologic Drain. By default, App, Database, ' \
116
+ + 'Ephemeral Session, and Proxy logs will be sent ' \
117
+ + 'to your chosen destination.'
111
118
  option :url, type: :string
112
119
  drain_options
113
120
  define_method 'log_drain:create:sumologic' do |handle|
@@ -118,7 +125,9 @@ module Aptible
118
125
  desc 'log_drain:create:logdna HANDLE ' \
119
126
  '--url LOGDNA_URL ' \
120
127
  + drain_flags,
121
- 'Create a LogDNA Log Drain'
128
+ 'Create a LogDNA/Mezmo Log Drain. By default, App, ' \
129
+ + 'Database, Ephemeral Session, and Proxy logs ' \
130
+ + 'will be sent to your chosen destination.'
122
131
  option :url, type: :string
123
132
  drain_options
124
133
  define_method 'log_drain:create:logdna' do |handle|
@@ -132,7 +141,9 @@ module Aptible
132
141
  desc 'log_drain:create:papertrail HANDLE ' \
133
142
  '--host PAPERTRAIL_HOST --port PAPERTRAIL_PORT ' \
134
143
  + drain_flags,
135
- 'Create a Papertrail Log Drain'
144
+ 'Create a Papertrail Log Drain. By default, App, Database, ' \
145
+ + 'Ephemeral Session, and Proxy logs will be sent ' \
146
+ + 'to your chosen destination.'
136
147
  option :host, type: :string
137
148
  option :port, type: :string
138
149
  drain_options
@@ -145,7 +156,9 @@ module Aptible
145
156
  '--host SYSLOG_HOST --port SYSLOG_PORT ' \
146
157
  '[--token TOKEN] ' \
147
158
  + drain_flags,
148
- 'Create a Papertrail Log Drain'
159
+ 'Create a Syslog Log Drain. By default, App, Database, ' \
160
+ + 'Ephemeral Session, and Proxy logs will be sent ' \
161
+ + 'to your chosen destination.'
149
162
  option :host, type: :string
150
163
  option :port, type: :string
151
164
  option :token, type: :string
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module CLI
3
- VERSION = '0.24.4'.freeze
3
+ VERSION = '0.24.5'.freeze
4
4
  end
5
5
  end
@@ -184,7 +184,7 @@ describe Aptible::CLI::Helpers::S3LogHelpers do
184
184
  ]
185
185
  )
186
186
  before do
187
- subject.stub(:s3_client) do
187
+ allow(subject).to receive(:s3_client) do
188
188
  Aws::S3::Resource.new(region: 'us-east-1', client: client_stub)
189
189
  end
190
190
  end
@@ -227,7 +227,7 @@ describe Aptible::CLI::Helpers::S3LogHelpers do
227
227
  { key: v3app }
228
228
  ]
229
229
  )
230
- subject.stub(:s3_client) do
230
+ allow(subject).to receive(:s3_client) do
231
231
  Aws::S3::Resource.new(region: 'us-east-1', client: client_stub)
232
232
  end
233
233
  end
@@ -23,7 +23,7 @@ describe Aptible::CLI::Agent do
23
23
  allow(Aptible::Api::Account).to receive(:all).and_return([account])
24
24
  end
25
25
  before do
26
- subject.stub(:validate_image_type) { true }
26
+ allow(subject).to receive(:validate_image_type).and_return(true)
27
27
  end
28
28
 
29
29
  def expect_provision_database(create_opts, provision_opts = {})
@@ -19,12 +19,58 @@ describe Aptible::CLI::Agent do
19
19
  end
20
20
 
21
21
  describe('#environment:list') do
22
- it 'lists avaliable environments' do
22
+ it 'lists available environments' do
23
23
  subject.send('environment:list')
24
24
 
25
25
  expect(captured_output_text.split("\n")).to include('foo')
26
26
  expect(captured_output_text.split("\n")).to include('bar')
27
27
  end
28
+
29
+ it 'includes stack information in JSON output' do
30
+ stack1 = Fabricate(
31
+ :stack,
32
+ name: 'stack1',
33
+ region: 'us-east-1',
34
+ outbound_ip_addresses: ['1.1.1.1']
35
+ )
36
+ stack2 = Fabricate(
37
+ :stack,
38
+ name: 'stack2',
39
+ region: 'us-west-1',
40
+ outbound_ip_addresses: ['2.2.2.2']
41
+ )
42
+ a1.stack = stack1
43
+ a2.stack = stack2
44
+
45
+ subject.send('environment:list')
46
+
47
+ expected_json = [
48
+ {
49
+ 'id' => a1.id,
50
+ 'handle' => 'foo',
51
+ 'created_at' => fmt_time(a1.created_at),
52
+ 'stack' => {
53
+ 'id' => stack1.id,
54
+ 'name' => 'stack1',
55
+ 'region' => 'us-east-1',
56
+ 'outbound_ip_addresses' => ['1.1.1.1']
57
+ }
58
+ },
59
+ {
60
+ 'id' => a2.id,
61
+ 'handle' => 'bar',
62
+ 'created_at' => fmt_time(a2.created_at),
63
+ 'stack' => {
64
+ 'id' => stack2.id,
65
+ 'name' => 'stack2',
66
+ 'region' => 'us-west-1',
67
+ 'outbound_ip_addresses' => ['2.2.2.2']
68
+ }
69
+ }
70
+ ]
71
+
72
+ expect(captured_output_json).to eq(expected_json)
73
+ end
28
74
  end
29
75
 
30
76
  describe('#environment:ca_cert') do
@@ -46,8 +92,9 @@ describe Aptible::CLI::Agent do
46
92
  'created_at' => fmt_time(a2.created_at)
47
93
  }
48
94
  ]
49
- expect(captured_output_json.map! { |account| account.except('id') })
50
- .to eq(expected_accounts)
95
+ expect(
96
+ captured_output_json.map! { |account| account.except('id', 'stack') }
97
+ ).to eq(expected_accounts)
51
98
  end
52
99
 
53
100
  it 'fetches certs for specified environment' do
@@ -73,8 +73,9 @@ describe Aptible::CLI::Agent do
73
73
  string_matches: 'foo',
74
74
  download_location: './'
75
75
  }
76
- subject.stub(:info_from_path) { { shasum: 'foo' } }
77
- subject.stub(:encryption_key) { subject.options[:decryption_keys] }
76
+ allow(subject).to receive(:info_from_path).and_return(shasum: 'foo')
77
+ allow(subject).to receive(:encryption_key)
78
+ .and_return(subject.options[:decryption_keys])
78
79
  end
79
80
 
80
81
  it 'download all files' do
@@ -116,8 +117,9 @@ describe Aptible::CLI::Agent do
116
117
  app_id: 123,
117
118
  download_location: './'
118
119
  }
119
- subject.stub(:info_from_path) { { shasum: 'foo' } }
120
- subject.stub(:encryption_key) { subject.options[:decryption_keys] }
120
+ allow(subject).to receive(:info_from_path).and_return(shasum: 'foo')
121
+ allow(subject).to receive(:encryption_key)
122
+ .and_return(subject.options[:decryption_keys])
121
123
  end
122
124
 
123
125
  it 'download all files' do
@@ -161,8 +163,9 @@ describe Aptible::CLI::Agent do
161
163
  '9080b96447f98b31ef9831d5fd98b09e3c5c545269734e2e825644571152457c',
162
164
  download_location: './'
163
165
  }
164
- subject.stub(:info_from_path) { { shasum: 'foo' } }
165
- subject.stub(:encryption_key) { subject.options[:decryption_keys] }
166
+ allow(subject).to receive(:info_from_path).and_return(shasum: 'foo')
167
+ allow(subject).to receive(:encryption_key)
168
+ .and_return(subject.options[:decryption_keys])
166
169
  end
167
170
 
168
171
  it 'download all files' do
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.24.4
4
+ version: 0.24.5
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: 2025-02-13 00:00:00.000000000 Z
11
+ date: 2025-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 1.6.5
39
+ version: '1.8'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 1.6.5
46
+ version: '1.8'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aptible-auth
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -473,7 +473,7 @@ homepage: https://github.com/aptible/aptible-cli
473
473
  licenses:
474
474
  - MIT
475
475
  metadata: {}
476
- post_install_message:
476
+ post_install_message:
477
477
  rdoc_options: []
478
478
  require_paths:
479
479
  - lib
@@ -489,7 +489,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
489
489
  version: '0'
490
490
  requirements: []
491
491
  rubygems_version: 3.0.3.1
492
- signing_key:
492
+ signing_key:
493
493
  specification_version: 4
494
494
  summary: Command-line interface for Aptible services
495
495
  test_files: