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.
18 19 20 |
# File 'lib/terrafying/components/endpointservice.rb', line 18 def initialize super end |
Instance Attribute Details
#fqdn ⇒ Object (readonly)
Returns the value of attribute fqdn.
8 9 10 |
# File 'lib/terrafying/components/endpointservice.rb', line 8 def fqdn @fqdn end |
#load_balancer ⇒ Object (readonly)
Returns the value of attribute load_balancer.
8 9 10 |
# File 'lib/terrafying/components/endpointservice.rb', line 8 def load_balancer @load_balancer end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/terrafying/components/endpointservice.rb', line 8 def name @name end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
8 9 10 |
# File 'lib/terrafying/components/endpointservice.rb', line 8 def service_name @service_name end |
#zone ⇒ Object (readonly)
Returns the value of attribute zone.
8 9 10 |
# File 'lib/terrafying/components/endpointservice.rb', line 8 def zone @zone end |
Class Method Details
.create_for(load_balancer, name, options = {}) ⇒ Object
10 11 12 |
# File 'lib/terrafying/components/endpointservice.rb', line 10 def self.create_for(load_balancer, name, = {}) EndpointService.new.create_for(load_balancer, name, ) end |
.find(service_name) ⇒ Object
14 15 16 |
# File 'lib/terrafying/components/endpointservice.rb', line 14 def self.find(service_name) EndpointService.new.find(service_name) end |
Instance Method Details
#create_for(load_balancer, name, options = {}) ⇒ Object
26 27 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 |
# File 'lib/terrafying/components/endpointservice.rb', line 26 def create_for(load_balancer, name, = {}) = { acceptance_required: true, allowed_principals: [ "arn:aws:iam::#{aws.account_id}:root" ] }.merge() if !load_balancer || (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
54 55 56 57 |
# File 'lib/terrafying/components/endpointservice.rb', line 54 def expose_in(vpc, = {}) name = .fetch(:name, @name) add! Endpoint.create_in(vpc, name, .merge(service: self)) end |
#find(_service_name) ⇒ Object
22 23 24 |
# File 'lib/terrafying/components/endpointservice.rb', line 22 def find(_service_name) raise 'unimplemented' end |