diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-10-11 11:36:05 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-10-11 11:58:03 +0300 |
commit | 0916e35d9f321602aee35cd34d78598d37412972 (patch) | |
tree | 3cab17ad9105deda3e1ed774496742ba7a735d64 | |
parent | 3c29449eb26e28385145424e4ca9f00c99aa1f69 (diff) |
Add scaffold of gitlab domains config source
-rw-r--r-- | go.mod | 6 | ||||
-rw-r--r-- | go.sum | 8 | ||||
-rw-r--r-- | internal/source/gitlab/client.go | 7 | ||||
-rw-r--r-- | internal/source/gitlab/gitlab.go | 30 | ||||
-rw-r--r-- | internal/source/gitlab/lookup.go | 19 | ||||
-rw-r--r-- | internal/source/source.go | 1 |
6 files changed, 65 insertions, 6 deletions
@@ -13,6 +13,8 @@ require ( github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 github.com/karrick/godirwalk v1.10.12 github.com/kr/pretty v0.1.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect github.com/namsral/flag v1.7.4-pre github.com/prometheus/client_golang v1.1.0 github.com/rs/cors v1.7.0 @@ -22,9 +24,9 @@ require ( gitlab.com/gitlab-org/labkit v0.0.0-20190902063225-3253d7975ca7 gitlab.com/lupine/go-mimedb v0.0.0-20180307000149-e8af1d659877 golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7 - golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac + golang.org/x/lint v0.0.0-20190930215403-16217165b5de golang.org/x/net v0.0.0-20190909003024-a7b16738d86b golang.org/x/sys v0.0.0-20190910064555-bbd175535a8b - golang.org/x/tools v0.0.0-20190917032747-2dc213d980bc + golang.org/x/tools v0.0.0-20191010201905-e5ffc44a6fee gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) @@ -139,8 +139,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7 h1:0hQKqeLdqlt5iIwVOBErRisrHJAN57yOiPRQItI20fU= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac h1:8R1esu+8QioDxo4E4mX6bFztO+dMTM49DNAaWfO5OeY= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -175,8 +175,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190917032747-2dc213d980bc h1:AzQrNvr65FlhSjBpg0eVCY43QLsuOqtzWGtjcBqT6J8= -golang.org/x/tools v0.0.0-20190917032747-2dc213d980bc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191010201905-e5ffc44a6fee h1:Cgj5oVkw7Gktu56MAiU0r1u0jyuT6jmtOzcAJwLj89c= +golang.org/x/tools v0.0.0-20191010201905-e5ffc44a6fee/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/internal/source/gitlab/client.go b/internal/source/gitlab/client.go new file mode 100644 index 00000000..73abfaa7 --- /dev/null +++ b/internal/source/gitlab/client.go @@ -0,0 +1,7 @@ +package gitlab + +// client is an internal HTTP client used for communication with GitLab +// instance +type client interface { + Resolve(domain string) *Lookup +} diff --git a/internal/source/gitlab/gitlab.go b/internal/source/gitlab/gitlab.go new file mode 100644 index 00000000..5eccff17 --- /dev/null +++ b/internal/source/gitlab/gitlab.go @@ -0,0 +1,30 @@ +package gitlab + +import "gitlab.com/gitlab-org/gitlab-pages/internal/domain" + +// Gitlab source represent a new domains configuration source. We fetch all the +// information about domains from GitLab instance. +type Gitlab struct { + client + lookups []Lookup +} + +// GetDomain return a representation of a domain that we have fetched from +// GitLab +func (g *Gitlab) GetDomain(name string) *domain.Domain { + return nil +} + +// HasDomain checks if a domain is known to GitLab +func (g *Gitlab) HasDomain(name string) bool { + return false +} + +// Watch starts Gitlab domains source +func (g *Gitlab) Watch(rootDomain string) { +} + +// Ready checks if Gitlab domains source can be used +func (g *Gitlab) Ready() bool { + return false +} diff --git a/internal/source/gitlab/lookup.go b/internal/source/gitlab/lookup.go new file mode 100644 index 00000000..6e2e0c7c --- /dev/null +++ b/internal/source/gitlab/lookup.go @@ -0,0 +1,19 @@ +package gitlab + +// Lookup defines a response that GitLab can send, which we can unmarshall +type Lookup struct { + Domain string + CertificateCert string + CertificateKey string + Serving string + Prefix string + LookupPaths []struct { + ProjectID int + HTTPSOnly bool + AccessControl bool + Source struct { + Type string + Path string + } + } +} diff --git a/internal/source/source.go b/internal/source/source.go index 18577493..ffde0c90 100644 --- a/internal/source/source.go +++ b/internal/source/source.go @@ -2,6 +2,7 @@ package source import "gitlab.com/gitlab-org/gitlab-pages/internal/domain" +// Source represents an abstract interface of a domains configuration source type Source interface { GetDomain(string) *domain.Domain HasDomain(string) bool |