Class: Terrafying::Components::EndpointService
- Inherits:
-
Terrafying::Context
- Object
- Terrafying::Context
- Terrafying::Components::EndpointService
- Defined in:
- lib/terrafying/components/endpointservice.rb
Instance Attribute Summary collapse
-
#fqdn ⇒ Object
readonly
Returns the value of attribute fqdn.
-
#load_balancer ⇒ Object
readonly
Returns the value of attribute load_balancer.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
-
#zone ⇒ Object
readonly
Returns the value of attribute zone.
Class Method Summary collapse
Instance Method Summary collapse
- #create_for(load_balancer, name, options = {}) ⇒ Object
- #expose_in(vpc, options = {}) ⇒ Object
- #find(service_name) ⇒ Object
-
#initialize ⇒ EndpointService
constructor
A new instance of EndpointService.
Constructor Details
#initialize ⇒ EndpointService
Returns a new instance of EndpointService.
20 21 22 |
# File 'lib/terrafying/components/endpointservice.rb', line 20 def initialize super end |
Instance Attribute Details
#fqdn ⇒ Object (readonly)
Returns the value of attribute fqdn.
10 11 12 |
# File 'lib/terrafying/components/endpointservice.rb', line 10 def fqdn @fqdn end |
#load_balancer ⇒ Object (readonly)
Returns the value of attribute load_balancer.
10 11 12 |
# File 'lib/terrafying/components/endpointservice.rb', line 10 def load_balancer @load_balancer end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/terrafying/components/endpointservice.rb', line 10 def name @name end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
10 11 12 |
# File 'lib/terrafying/components/endpointservice.rb', line 10 def service_name @service_name end |
#zone ⇒ Object (readonly)
Returns the value of attribute zone.
10 11 12 |
# File 'lib/terrafying/components/endpointservice.rb', line 10 def zone @zone end |
Class Method Details
.create_for(load_balancer, name, options = {}) ⇒ Object
12 13 14 |
# File 'lib/terrafying/components/endpointservice.rb', line 12 def self.create_for(load_balancer, name, ={}) EndpointService.new.create_for(load_balancer, name, ) end |
.find(service_name) ⇒ Object
16 17 18 |
# File 'lib/terrafying/components/endpointservice.rb', line 16 def self.find(service_name) EndpointService.new.find(service_name) end |
Instance Method Details
#create_for(load_balancer, name, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/terrafying/components/endpointservice.rb', line 28 def create_for(load_balancer, name, ={}) = { acceptance_required: true, allowed_principals: [ "arn:aws:iam::#{aws.account_id}:root", ], }.merge() if ! load_balancer or load_balancer.type != "network" raise "The load balancer needs to be a network load balancer" end @name = name @load_balancer = load_balancer @fqdn = [:fqdn] @zone = [:zone] resource :aws_vpc_endpoint_service, name, { acceptance_required: [:acceptance_required], allowed_principals: [:allowed_principals], network_load_balancer_arns: [load_balancer.id], } @service_name = output_of(:aws_vpc_endpoint_service, name, "service_name") self end |
#expose_in(vpc, options = {}) ⇒ Object
57 58 59 60 |
# File 'lib/terrafying/components/endpointservice.rb', line 57 def expose_in(vpc, ={}) name = .fetch(:name, @name) add! Endpoint.create_in(vpc, name, .merge({ service: self })) end |
#find(service_name) ⇒ Object
24 25 26 |
# File 'lib/terrafying/components/endpointservice.rb', line 24 def find(service_name) raise 'unimplemented' end |