-
Notifications
You must be signed in to change notification settings - Fork 51
/
types.go
60 lines (50 loc) · 1.58 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
package releasereport
import (
"fmt"
"helm.sh/helm/v3/pkg/chart"
)
// NamespaceReleases the releases for a namespace
type NamespaceReleases struct {
Path string `json:"path,omitempty"`
Namespace string `json:"namespace,omitempty"`
Releases []*ReleaseInfo `json:"releases,omitempty"`
}
// ReleaseInfo information about the release
type ReleaseInfo struct {
chart.Metadata
// RepositoryName the chart repository name used in the fully qualified chart name
RepositoryName string `json:"repositoryName,omitempty"`
// RepositoryURL the chart repository URL
RepositoryURL string `json:"repositoryUrl,omitempty"`
// ApplicationURL the ingress URL for the application if available
ApplicationURL string `json:"applicationUrl,omitempty"`
// LogsURL the URL to browse the application logs if available
LogsURL string `json:"logsUrl,omitempty"`
// ResourcesPath the relative path to the kubernetes resources
ResourcesPath string `json:"resourcePath,omitempty"`
// Ingresses the ingress URLs
Ingresses []IngressInfo `json:"ingresses,omitempty"`
}
// IngressInfo details of an ingress
type IngressInfo struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
}
func (i *ReleaseInfo) String() string {
answer := fmt.Sprintf("%s version: %s", i.Name, i.Version)
if i.Home != "" {
answer += " " + i.Home
}
return answer
}
func (i *ReleaseInfo) handleChartMetadata(manifest *chart.Metadata) {
if i.Description == "" {
i.Description = manifest.Description
}
if i.Home == "" {
i.Home = manifest.Home
}
if i.Icon == "" {
i.Icon = manifest.Icon
}
}