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

domain_response.go « client « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f7145ec0874b3855a37a8761e0875cd8aedd294d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package client

import (
	"errors"
	"strings"
)

type DomainResponse struct {
	Domain      string `json:"domain"`
	Certificate string `json:"certificate"`
	Key         string `json:"certificate_key"`

	LookupPath []LookupPath `json:"lookup_paths"`
}

func (d *DomainResponse) GetPath(path string) (*LookupPath, error) {
	for _, lp := range d.LookupPath {
		if strings.HasPrefix(path, lp.Prefix) || path+"/" == lp.Prefix {
			return &lp, nil
		}
	}

	return nil, errors.New("lookup path not found")
}