1
0
mirror of https://github.com/rancher/norman.git synced 2025-04-28 19:35:09 +00:00
norman/generator/client_template.go

32 lines
613 B
Go
Raw Permalink Normal View History

2017-11-11 04:44:02 +00:00
package generator
var clientTemplate = `package client
import (
"github.com/rancher/norman/clientbase"
)
type Client struct {
clientbase.APIBaseClient
{{range .schemas}}
2017-12-23 06:46:27 +00:00
{{- if . | hasGet }}{{.CodeName}} {{.CodeName}}Operations
2017-11-11 04:44:02 +00:00
{{end}}{{end}}}
func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
baseClient, err := clientbase.NewAPIClient(opts)
if err != nil {
return nil, err
}
client := &Client{
APIBaseClient: baseClient,
}
{{range .schemas}}
2017-12-23 06:46:27 +00:00
{{- if . | hasGet }}client.{{.CodeName}} = new{{.CodeName}}Client(client)
2017-11-11 04:44:02 +00:00
{{end}}{{end}}
return client, nil
}
`