mirror of
https://github.com/rancher/norman.git
synced 2025-04-28 03:20:08 +00:00
32 lines
613 B
Go
32 lines
613 B
Go
package generator
|
|
|
|
var clientTemplate = `package client
|
|
|
|
import (
|
|
"github.com/rancher/norman/clientbase"
|
|
)
|
|
|
|
type Client struct {
|
|
clientbase.APIBaseClient
|
|
|
|
{{range .schemas}}
|
|
{{- if . | hasGet }}{{.CodeName}} {{.CodeName}}Operations
|
|
{{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}}
|
|
{{- if . | hasGet }}client.{{.CodeName}} = new{{.CodeName}}Client(client)
|
|
{{end}}{{end}}
|
|
return client, nil
|
|
}
|
|
`
|