Skip to content

Commit

Permalink
The types outside the command package
Browse files Browse the repository at this point in the history
  • Loading branch information
javier.juarez authored and javier.juarez committed May 31, 2021
1 parent 4433e75 commit 4f3a16d
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions model/kubeconfig.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package model

//
// Cluster configuration structure
//
type Cluster struct {
CertificateAuthorityData string `yaml:"certificate-authority-data,omitempty"`
Server string `yaml:"server,omitempty"`
}

type Clusters []struct {
Cluster Cluster `yaml:"cluster,omitempty"`
Name string `yaml:"name,omitempty"`
}

//
// Context configuration structure
//
type Context struct {
Cluster string `yaml:"cluster,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
User string `yaml:"user,omitempty"`
}

type Contexts []struct {
Context Context `yaml:"context,omitempty"`
Name string `yaml:"name,omitempty"`
}

//
// Users configuration structure
//
type UsersConfig struct {
ClientId string `yaml:"client-id,omitempty"`
ClientSecret string `yaml:"client-secret,omitempty"`
IdToken string `yaml:"id-token,omitempty"`
IdpIssueURL string `yaml:"idp-issuer-url,omitempty"`
RefreshToken string `yaml:"refresh-token,omitempty"`
}

type UsersAuthProvider struct {
Config UsersConfig `yaml:"config,omitempty"`
Name string `yaml:"name,omitempty"`
}

type User struct {
AuthProvider UsersAuthProvider `yaml:"auth-provider,omitempty"`
}

type Users []struct {
Name string `yaml:"name,omitempty"`
User User `yaml:"user,omitempty"`
}

//
// KubeConfig structure
//
type KubeConfig struct {
ApiVersion string `yaml:"apiVersion,omitempty"`
Kind string `yaml:"kind,omitempty"`
Preferences struct{} `yaml:"preferences,omitempty"`
Clusters Clusters `yaml:"clusters,omitempty"`
Contexts Contexts `yaml:"contexts,omitempty"`
CurrentContext string `yaml:"current-context,omitempty"`
Users Users `yaml:"users,omitempty"`
}

0 comments on commit 4f3a16d

Please sign in to comment.