Class: Serverless::AssociateDomainService

Inherits:
Object
  • Object
show all
Defined in:
app/services/serverless/associate_domain_service.rb

Constant Summary collapse

PLACEHOLDER_HOSTNAME =
'example.com'

Instance Method Summary collapse

Constructor Details

#initialize(knative, pages_domain_id:, creator:) ⇒ AssociateDomainService

Returns a new instance of AssociateDomainService.


7
8
9
10
11
# File 'app/services/serverless/associate_domain_service.rb', line 7

def initialize(knative, pages_domain_id:, creator:)
  @knative = knative
  @pages_domain_id = pages_domain_id
  @creator = creator
end

Instance Method Details

#executeObject


13
14
15
16
17
18
19
20
# File 'app/services/serverless/associate_domain_service.rb', line 13

def execute
  return if unchanged?

  knative.hostname ||= PLACEHOLDER_HOSTNAME

  knative.pages_domain = knative.find_available_domain(pages_domain_id)
  knative.serverless_domain_cluster.update(creator: creator) if knative.pages_domain
end