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

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2020-02-12 12:57:18 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2020-02-12 12:58:12 +0300
commite3901d4a4e33ce530e4fd85cc2d7af52e5fec7a6 (patch)
tree039135f4dbb4ea00565045f86959bacbcf8d18c8
parent991e92068de6a48b25a80d5a0c9ae2900bf56e48 (diff)
Add GitLab API definition for serverless serving
-rw-r--r--internal/source/gitlab/api/lookup.go1
-rw-r--r--internal/source/gitlab/api/lookup_path.go30
-rw-r--r--internal/source/gitlab/gitlab.go9
3 files changed, 27 insertions, 13 deletions
diff --git a/internal/source/gitlab/api/lookup.go b/internal/source/gitlab/api/lookup.go
index ff1b1dae..73a3ce43 100644
--- a/internal/source/gitlab/api/lookup.go
+++ b/internal/source/gitlab/api/lookup.go
@@ -2,7 +2,6 @@ package api
// Lookup defines an API lookup action with a response that GitLab sends
type Lookup struct {
- ETag string // TODO
Name string
Error error
Domain *VirtualDomain
diff --git a/internal/source/gitlab/api/lookup_path.go b/internal/source/gitlab/api/lookup_path.go
index b0407638..e9c0038d 100644
--- a/internal/source/gitlab/api/lookup_path.go
+++ b/internal/source/gitlab/api/lookup_path.go
@@ -6,8 +6,30 @@ type LookupPath struct {
AccessControl bool `json:"access_control,omitempty"`
HTTPSOnly bool `json:"https_only,omitempty"`
Prefix string `json:"prefix,omitempty"`
- Source struct {
- Type string `json:"type,omitempty"`
- Path string `json:"path,omitempty"`
- }
+ Source source `json:"source,omitempty"`
+}
+
+type source struct {
+ Type string `json:"type,omitempty"`
+ Path string `json:"path,omitempty"`
+ Serverless serverless `json:"serverless,omitempty"`
+}
+
+type serverless struct {
+ Function function `json:"function,omitempty"`
+ Cluster cluster `json:"cluster,omitempty"`
+}
+
+type function struct {
+ Name string `json:"name,omitempty"`
+ Domain string `json:"domain,omitempty"`
+ Namespace string `json:"namespace,omitempty"`
+}
+
+type cluster struct {
+ Address string `json:"address,omitempty"`
+ Port string `json:"port,omitempty"`
+ Hostname string `json:"hostname,omitempty"`
+ CertificateCert string `json:"cert,omitempty"`
+ CertificateKey string `json:"key,omitempty"`
}
diff --git a/internal/source/gitlab/gitlab.go b/internal/source/gitlab/gitlab.go
index 9a5cb7b1..232239ae 100644
--- a/internal/source/gitlab/gitlab.go
+++ b/internal/source/gitlab/gitlab.go
@@ -6,9 +6,6 @@ import (
"net/http"
"path"
"strings"
- "time"
-
- store "github.com/patrickmn/go-cache"
"gitlab.com/gitlab-org/gitlab-pages/internal/domain"
"gitlab.com/gitlab-org/gitlab-pages/internal/request"
@@ -23,7 +20,6 @@ import (
// information about domains from GitLab instance.
type Gitlab struct {
client api.Resolver
- store *store.Cache
}
// New returns a new instance of gitlab domain source.
@@ -33,10 +29,7 @@ func New(config client.Config) (*Gitlab, error) {
return nil, err
}
- return &Gitlab{
- client: cache.NewCache(client),
- store: store.New(time.Hour, time.Minute),
- }, nil
+ return &Gitlab{client: cache.NewCache(client)}, nil
}
// GetDomain return a representation of a domain that we have fetched from