cmd/api: add skipVerify remote source option

Add an option to set skipVerify on remote source to disable tls cert
verification on remote source api endpoint
This commit is contained in:
Simone Gotti 2019-05-22 16:28:42 +02:00
parent dd17e7bc14
commit 933dfae658
3 changed files with 7 additions and 0 deletions

View File

@ -40,6 +40,7 @@ type remoteSourceCreateOptions struct {
rsType string
authType string
apiURL string
skipVerify bool
oauth2ClientID string
oauth2ClientSecret string
sshHostKey string
@ -55,6 +56,7 @@ func init() {
flags.StringVar(&remoteSourceCreateOpts.rsType, "type", "", "remotesource type")
flags.StringVar(&remoteSourceCreateOpts.authType, "auth-type", "", "remote source auth type")
flags.StringVar(&remoteSourceCreateOpts.apiURL, "api-url", "", "remotesource api url")
flags.BoolVarP(&remoteSourceCreateOpts.skipVerify, "skip-verify", "", false, "skip remote source api tls certificate verification")
flags.StringVar(&remoteSourceCreateOpts.oauth2ClientID, "clientid", "", "remotesource oauth2 client id")
flags.StringVar(&remoteSourceCreateOpts.oauth2ClientSecret, "secret", "", "remotesource oauth2 secret")
flags.StringVar(&remoteSourceCreateOpts.sshHostKey, "ssh-host-key", "", "remotesource ssh public host key")
@ -82,6 +84,7 @@ func remoteSourceCreate(cmd *cobra.Command, args []string) error {
Type: remoteSourceCreateOpts.rsType,
AuthType: remoteSourceCreateOpts.authType,
APIURL: remoteSourceCreateOpts.apiURL,
SkipVerify: remoteSourceCreateOpts.skipVerify,
Oauth2ClientID: remoteSourceCreateOpts.oauth2ClientID,
Oauth2ClientSecret: remoteSourceCreateOpts.oauth2ClientSecret,
SSHHostKey: remoteSourceCreateOpts.sshHostKey,

View File

@ -48,6 +48,7 @@ func (h *ActionHandler) GetRemoteSources(ctx context.Context, req *GetRemoteSour
type CreateRemoteSourceRequest struct {
Name string
APIURL string
SkipVerify bool
Type string
AuthType string
Oauth2ClientID string
@ -97,6 +98,7 @@ func (h *ActionHandler) CreateRemoteSource(ctx context.Context, req *CreateRemot
Type: types.RemoteSourceType(req.Type),
AuthType: types.RemoteSourceAuthType(req.AuthType),
APIURL: req.APIURL,
SkipVerify: req.SkipVerify,
Oauth2ClientID: req.Oauth2ClientID,
Oauth2ClientSecret: req.Oauth2ClientSecret,
SSHHostKey: req.SSHHostKey,

View File

@ -33,6 +33,7 @@ type CreateRemoteSourceRequest struct {
APIURL string `json:"apiurl"`
Type string `json:"type"`
AuthType string `json:"auth_type"`
SkipVerify bool `json:"skip_verify"`
Oauth2ClientID string `json:"oauth_2_client_id"`
Oauth2ClientSecret string `json:"oauth_2_client_secret"`
SSHHostKey string `json:"ssh_host_key"`
@ -63,6 +64,7 @@ func (h *CreateRemoteSourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
APIURL: req.APIURL,
Type: req.Type,
AuthType: req.AuthType,
SkipVerify: req.SkipVerify,
Oauth2ClientID: req.Oauth2ClientID,
Oauth2ClientSecret: req.Oauth2ClientSecret,
SSHHostKey: req.SSHHostKey,