c442eb5bcb
Upgraded openapi generator version to 5.1.0 for the support of nullable values for optional fields; Added missing "Disabled" enum value to the BootSourceOverrideEnabled model in the openapi schema. Signed-off-by: James Gu <james.gu@att.com> Change-Id: Ia3e0b018be13079d2085ef61ed2e797bcfd25fd7
54 lines
928 B
Go
54 lines
928 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
|
|
. "opendev.org/airship/go-redfish/client"
|
|
)
|
|
|
|
func main() {
|
|
|
|
header := `
|
|
package client
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
client "opendev.org/airship/go-redfish/client"
|
|
)
|
|
|
|
//go:generate mockery --name=RedfishAPI --output ./mocks
|
|
type RedfishAPI interface {
|
|
`
|
|
|
|
apiServiceType := reflect.TypeOf(&DefaultApiService{})
|
|
|
|
fmt.Println(header)
|
|
for i := 0; i < apiServiceType.NumMethod(); i++ {
|
|
method := apiServiceType.Method(i)
|
|
|
|
// Get args of method
|
|
args := ""
|
|
for n_in := 1; n_in < method.Type.NumIn(); n_in++ {
|
|
args += method.Type.In(n_in).String()
|
|
args += ",\n"
|
|
}
|
|
|
|
// Get return type of method
|
|
rets := ""
|
|
for n_out := 0; n_out < method.Type.NumOut(); n_out++ {
|
|
rets += method.Type.Out(n_out).String()
|
|
rets += ",\n"
|
|
}
|
|
|
|
func_sig := fmt.Sprintf("%s(%s) (%s)", method.Name, args, rets)
|
|
fmt.Println(func_sig)
|
|
fmt.Println("")
|
|
}
|
|
|
|
fmt.Println("}")
|
|
|
|
}
|