mirror of
https://github.com/rancher/types.git
synced 2025-09-01 21:32:10 +00:00
update vendor
This commit is contained in:
committed by
Darren Shepherd
parent
ca5555dd00
commit
3cd90ff2f7
10
vendor/github.com/rancher/norman/clientbase/common.go
generated
vendored
10
vendor/github.com/rancher/norman/clientbase/common.go
generated
vendored
@@ -36,6 +36,7 @@ type ClientOpts struct {
|
||||
Timeout time.Duration
|
||||
HTTPClient *http.Client
|
||||
CACerts string
|
||||
Insecure bool
|
||||
}
|
||||
|
||||
func (c *ClientOpts) getAuthHeader() string {
|
||||
@@ -176,6 +177,15 @@ func NewAPIClient(opts *ClientOpts) (APIBaseClient, error) {
|
||||
client.Transport = tr
|
||||
}
|
||||
|
||||
if opts.Insecure {
|
||||
tr := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
InsecureSkipVerify: opts.Insecure,
|
||||
},
|
||||
}
|
||||
client.Transport = tr
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("GET", opts.URL, nil)
|
||||
if err != nil {
|
||||
return result, err
|
||||
|
14
vendor/github.com/rancher/norman/clientbase/ops.go
generated
vendored
14
vendor/github.com/rancher/norman/clientbase/ops.go
generated
vendored
@@ -7,7 +7,6 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"regexp"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rancher/norman/types"
|
||||
@@ -170,16 +169,9 @@ func (a *APIOperations) DoCreate(schemaType string, createObj interface{}, respO
|
||||
return errors.New("Resource type [" + schemaType + "] is not creatable")
|
||||
}
|
||||
|
||||
var collectionURL string
|
||||
collectionURL, ok = schema.Links[COLLECTION]
|
||||
if !ok {
|
||||
// return errors.New("Failed to find collection URL for [" + schemaType + "]")
|
||||
// This is a hack to address https://github.com/rancher/cattle/issues/254
|
||||
re := regexp.MustCompile("schemas.*")
|
||||
collectionURL = re.ReplaceAllString(schema.Links[SELF], schema.PluralName)
|
||||
}
|
||||
|
||||
return a.DoModify("POST", collectionURL, createObj, respObject)
|
||||
// using collection link to post doesn't help the resources under project or cluster, because they need a projectId or clusterId in the path
|
||||
// for example, v3/projects/foo/apps, v3/cluster/bar/namespaces
|
||||
return a.DoModify("POST", a.Opts.URL+"/"+schemaType, createObj, respObject)
|
||||
}
|
||||
|
||||
func (a *APIOperations) DoUpdate(schemaType string, existing *types.Resource, updates interface{}, respObject interface{}) error {
|
||||
|
14
vendor/github.com/rancher/norman/generator/funcs.go
generated
vendored
14
vendor/github.com/rancher/norman/generator/funcs.go
generated
vendored
@@ -11,10 +11,12 @@ import (
|
||||
|
||||
func funcs() template.FuncMap {
|
||||
return template.FuncMap{
|
||||
"capitalize": convert.Capitalize,
|
||||
"upper": strings.ToUpper,
|
||||
"toLower": strings.ToLower,
|
||||
"hasGet": hasGet,
|
||||
"capitalize": convert.Capitalize,
|
||||
"unCapitalize": convert.Uncapitalize,
|
||||
"upper": strings.ToUpper,
|
||||
"toLower": strings.ToLower,
|
||||
"hasGet": hasGet,
|
||||
"hasPost": hasPost,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +28,10 @@ func hasGet(schema *types.Schema) bool {
|
||||
return contains(schema.CollectionMethods, http.MethodGet)
|
||||
}
|
||||
|
||||
func hasPost(schema *types.Schema) bool {
|
||||
return contains(schema.CollectionMethods, http.MethodPost)
|
||||
}
|
||||
|
||||
func contains(list []string, needle string) bool {
|
||||
for _, i := range list {
|
||||
if i == needle {
|
||||
|
2
vendor/github.com/rancher/norman/generator/type_template.go
generated
vendored
2
vendor/github.com/rancher/norman/generator/type_template.go
generated
vendored
@@ -21,7 +21,7 @@ type {{.schema.CodeName}} struct {
|
||||
types.Resource
|
||||
{{- end}}
|
||||
{{- range $key, $value := .structFields}}
|
||||
{{$key}} {{$value.Type}} %BACK%json:"{{$value.Name}},omitempty"%BACK%
|
||||
{{$key}} {{$value.Type}} %BACK%json:"{{$value.Name}},omitempty" yaml:"{{$value.Name}},omitempty"%BACK%
|
||||
{{- end}}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user