/
types.go
92 lines (74 loc) · 3.33 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package services
import (
"fmt"
)
const (
URL_AZUREDEVOPS_ENVIRONMENT = "https://dev.azure.com/{organization}/{project}/_apis/distributedtask/environments?api-version=6.1-preview.1"
URL_AZUREDEVOPS_SERVICE_ENDPOINT_GET = "https://dev.azure.com/{organization}/{project}/_apis/serviceendpoint/endpoints?api-version=7.1-preview.4"
URL_AZUREDEVOPS_SERVICE_ENDPOINT_POST = "https://dev.azure.com/{organization}/_apis/serviceendpoint/endpoints?api-version=7.1-preview.4"
URL_AZUREDEVOPS_PROJECTS = "https://dev.azure.com/{organization}/_apis/projects?api-version=7.1-preview.4"
URL_AZUREDEVOPS_ENVIRONMENT_RESOURCE = "https://dev.azure.com/{organization}/{project}/_apis/distributedtask/environments/{environmentId}/providers/kubernetes?api-version=7.1-preview.1"
KUBERNETES_DEFAULT_CONTEXT_NAME = "default"
)
type ResourceNotFoundError struct {
resource string
}
func (e *ResourceNotFoundError) Error() string {
return fmt.Sprintf("resource %s not found", e.resource)
}
func IgnoreResourceNotFoundError(err error) error {
_, ok := err.(*ResourceNotFoundError)
if ok {
return nil
}
return err
}
type Error string
type AzDevOpsProjectList struct {
Count int `json:"count"`
Value []AzDevOpsProject `json:"value"`
}
type AzDevOpsProject struct {
ID string `json:"id"`
Name string `json:"name"`
}
type AzDevopsEnvironmentInstance struct {
Id int `json:"id"`
Name string `json:"name"`
}
type AzDevopsEnvironmentInstanceList struct {
Count int `json:"count"`
Value []AzDevopsEnvironmentInstance `json:"value"`
}
type AzDevopsServiceEndpoint struct {
Id string `json:"id,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
URL string `json:"url,omitempty"`
Description string `json:"description,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
Authorization AzDevopsServiceEndpointAuthorization `json:"authorization"`
AzServiceEndpointProjectReferences []AzServiceEndpointProjectReferences `json:"serviceEndpointProjectReferences"`
IsShared bool `json:"isShared,omitempty"`
}
type AzServiceEndpointProjectReferences struct {
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
AzureDevopsProjectReference AzDevopsProjectReference `json:"projectReference,omitempty"`
}
type AzDevopsProjectReference struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
type AzDevopsServiceEndpointAuthorization struct {
Parameters AzDevopsServiceEndpointParameters `json:"parameters"`
Scheme string `json:"scheme"`
}
type AzDevopsServiceEndpointParameters struct {
ClusterContext string `json:"clusterContext"`
KubeConfig string `json:"kubeConfig"`
}
type AzDevopsServiceEndpointList struct {
Count int `json:"count"`
Value []AzDevopsServiceEndpoint `json:"value"`
}