Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 18:08:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 18:08:44 +0300
commitb9bac6dbf78a5a7976fba14aaeef96bdeb0da612 (patch)
treeffe277b562256f718b0818e8fd3c8fd8766d0269 /app/finders
parent8c4198cbe631278e87fee04157d23494fbb80cdb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/serverless_domain_finder.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/finders/serverless_domain_finder.rb b/app/finders/serverless_domain_finder.rb
new file mode 100644
index 00000000000..3a8a55022bb
--- /dev/null
+++ b/app/finders/serverless_domain_finder.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class ServerlessDomainFinder
+ attr_reader :match, :serverless_domain_cluster, :environment
+
+ def initialize(uri)
+ @match = ::Serverless::Domain::REGEXP.match(uri)
+ end
+
+ def execute
+ return unless serverless?
+
+ @serverless_domain_cluster = ::Serverless::DomainCluster.for_uuid(serverless_domain_cluster_uuid)
+ return unless serverless_domain_cluster
+
+ @environment = ::Environment.for_id_and_slug(match[:environment_id].to_i(16), match[:environment_slug])
+ return unless environment
+
+ ::Serverless::Domain.new(
+ function_name: match[:function_name],
+ serverless_domain_cluster: serverless_domain_cluster,
+ environment: environment
+ )
+ end
+
+ def serverless_domain_cluster_uuid
+ return unless serverless?
+
+ match[:cluster_left] + match[:cluster_middle] + match[:cluster_right]
+ end
+
+ def serverless?
+ !!match
+ end
+end