Expose the credential type through the API
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
cbb2134f0e
commit
4668461603
3 changed files with 19 additions and 9 deletions
|
|
@ -66,10 +66,10 @@ func init() {
|
|||
|
||||
func formatGithubCredentials(creds []params.GithubCredentials) {
|
||||
t := table.NewWriter()
|
||||
header := table.Row{"Name", "Description", "Base URL", "API URL", "Upload URL"}
|
||||
header := table.Row{"Name", "Description", "Base URL", "API URL", "Upload URL", "Type"}
|
||||
t.AppendHeader(header)
|
||||
for _, val := range creds {
|
||||
t.AppendRow(table.Row{val.Name, val.Description, val.BaseURL, val.APIBaseURL, val.UploadBaseURL})
|
||||
t.AppendRow(table.Row{val.Name, val.Description, val.BaseURL, val.APIBaseURL, val.UploadBaseURL, val.AuthType})
|
||||
t.AppendSeparator()
|
||||
}
|
||||
fmt.Println(t.Render())
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ type (
|
|||
JobStatus string
|
||||
RunnerStatus string
|
||||
WebhookEndpointType string
|
||||
GithubAuthType string
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -89,6 +90,13 @@ const (
|
|||
RunnerActive RunnerStatus = "active"
|
||||
)
|
||||
|
||||
const (
|
||||
// GithubAuthTypePAT is the OAuth token based authentication
|
||||
GithubAuthTypePAT GithubAuthType = "pat"
|
||||
// GithubAuthTypeApp is the GitHub App based authentication
|
||||
GithubAuthTypeApp GithubAuthType = "app"
|
||||
)
|
||||
|
||||
type StatusMessage struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Message string `json:"message"`
|
||||
|
|
@ -421,13 +429,14 @@ type ControllerInfo struct {
|
|||
}
|
||||
|
||||
type GithubCredentials struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
APIBaseURL string `json:"api_base_url"`
|
||||
UploadBaseURL string `json:"upload_base_url"`
|
||||
BaseURL string `json:"base_url"`
|
||||
CABundle []byte `json:"ca_bundle,omitempty"`
|
||||
HTTPClient *http.Client `json:"-"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
APIBaseURL string `json:"api_base_url"`
|
||||
UploadBaseURL string `json:"upload_base_url"`
|
||||
BaseURL string `json:"base_url"`
|
||||
CABundle []byte `json:"ca_bundle,omitempty"`
|
||||
AuthType GithubAuthType `toml:"auth_type" json:"auth-type"`
|
||||
HTTPClient *http.Client `json:"-"`
|
||||
}
|
||||
|
||||
func (g GithubCredentials) RootCertificateBundle() (CertificateBundle, error) {
|
||||
|
|
|
|||
|
|
@ -412,6 +412,7 @@ func (r *Runner) ListCredentials(ctx context.Context) ([]params.GithubCredential
|
|||
BaseURL: val.BaseEndpoint(),
|
||||
APIBaseURL: val.APIEndpoint(),
|
||||
UploadBaseURL: val.UploadEndpoint(),
|
||||
AuthType: params.GithubAuthType(val.AuthType),
|
||||
})
|
||||
}
|
||||
return ret, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue