/
gkeCredentials.go
30 lines (25 loc) · 1.17 KB
/
gkeCredentials.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
package main
// GKECredentials represents the credentials of type kubernetes-engine as defined in the server config and passed to this trusted image
type GKECredentials struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
AdditionalProperties GKECredentialAdditionalProperties `json:"additionalProperties,omitempty"`
}
// GKECredentialAdditionalProperties contains the non standard fields for this type of credentials
type GKECredentialAdditionalProperties struct {
Project string `json:"project,omitempty"`
Cluster string `json:"cluster,omitempty"`
Region string `json:"region,omitempty"`
Zone string `json:"zone,omitempty"`
ServiceAccountKeyfile string `json:"serviceAccountKeyfile,omitempty"`
Defaults *Params `json:"defaults,omitempty"`
}
// GetCredentialsByName returns a credential if the name exists
func GetCredentialsByName(c []GKECredentials, credentialName string) *GKECredentials {
for _, cred := range c {
if cred.Name == credentialName {
return &cred
}
}
return nil
}