Skip to content

Commit 197fd88

Browse files
authored
Add shared endpoint management (#388)
* Add shared endpoint management * Fix test * Increment version * Fix dependencies
1 parent 01093dd commit 197fd88

File tree

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
aptible-cli (0.24.8)
4+
aptible-cli (0.24.9)
55
activesupport (>= 4.0, < 6.0)
66
aptible-api (~> 1.8.0)
77
aptible-auth (~> 1.2.5)

lib/aptible/cli/helpers/vhost/option_set_builder.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class OptionSetBuilder
1212
ports
1313
port
1414
alb
15+
shared
1516
).freeze
1617

1718
def initialize(&block)
@@ -122,6 +123,15 @@ def declare_options(thor)
122123
'on this Endpoint'
123124
)
124125
end
126+
127+
if builder.shared?
128+
option(
129+
:shared,
130+
type: :boolean,
131+
desc: "Share this Endpoint's load balancer with other " \
132+
'Endpoints'
133+
)
134+
end
125135
end
126136
end
127137

@@ -192,6 +202,12 @@ def prepare(account, options)
192202
end
193203
params[:load_balancing_algorithm_type] = lba_type
194204
end
205+
206+
if shared?
207+
params[:shared] = options.delete(:shared) do
208+
create? ? false : nil
209+
end
210+
end
195211
end
196212

197213
options.delete(:environment)

lib/aptible/cli/resource_formatter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def inject_vhost(node, vhost, service)
204204
node.value('port', port)
205205
node.value('load_balancing_algorithm_type', vhost
206206
.load_balancing_algorithm_type)
207+
node.value('shared', vhost.shared)
207208
end
208209

209210
node.value('internal', vhost.internal)

lib/aptible/cli/subcommands/endpoints.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def self.included(thor)
160160
port!
161161
tls!
162162
alb!
163+
shared!
163164
end
164165

165166
desc 'endpoints:https:create [--app APP] SERVICE',
@@ -179,6 +180,7 @@ def self.included(thor)
179180
port!
180181
tls!
181182
alb!
183+
shared!
182184
end
183185

184186
desc 'endpoints:https:modify [--app APP] ENDPOINT_HOSTNAME',

lib/aptible/cli/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Aptible
22
module CLI
3-
VERSION = '0.24.8'.freeze
3+
VERSION = '0.24.9'.freeze
44
end
55
end

spec/aptible/cli/resource_formatter_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def capture(m, *args)
2121
ip_whitelist: [],
2222
default: false,
2323
acme: false,
24-
load_balancing_algorithm_type: 'least_outstanding_requests'
24+
load_balancing_algorithm_type: 'least_outstanding_requests',
25+
shared: false
2526
)
2627

2728
expected = [
@@ -32,6 +33,7 @@ def capture(m, *args)
3233
'Type: https',
3334
'Port: default',
3435
'Load Balancing Algorithm Type: least_outstanding_requests',
36+
'Shared: false',
3537
'Internal: false',
3638
'IP Whitelist: all traffic',
3739
'Default Domain Enabled: false',

0 commit comments

Comments
 (0)