// NewHTTPClient creates a new todo list HTTP client. func NewHTTPClient(formats strfmt.Registry) *TodoList { if formats == nil { formats = strfmt.Default } transport := httptransport.New("localhost", "/", []string{"http", "https"}) return New(transport, formats) }
// NewHTTPClient creates a new client HTTP client. func NewHTTPClient(formats strfmt.Registry) *Client { if formats == nil { formats = strfmt.Default } transport := httptransport.New("quay.io", "/", []string{"https"}) return New(transport, formats) }
// NewHTTPClient creates a new task tracker HTTP client. func NewHTTPClient(formats strfmt.Registry) *TaskTracker { if formats == nil { formats = strfmt.Default } transport := httptransport.New("localhost:8322", "/api", []string{"https", "http"}) return New(transport, formats) }
// NewHTTPClient creates a new postnord HTTP client. func NewHTTPClient(formats strfmt.Registry) *Postnord { if formats == nil { formats = strfmt.Default } transport := httptransport.New("api2.postnord.com", "/", []string{"https"}) return New(transport, formats) }
// NewHTTPClient creates a new bill forward HTTP client. func NewHTTPClient(formats strfmt.Registry) *BillForward { if formats == nil { formats = strfmt.Default } transport := httptransport.New("localhost:8080", "/RestAPI", []string{"https"}) return New(transport, formats) }
func TestNodeGetOperation(t *testing.T) { // create the transport transport := rc.New("localhost:9090", "/api/1.1", []string{"http"}) // configure the host. include port with environment variable. For instance the vagrant image would be localhost:9090 if os.Getenv("GORACKHD_ENDPOINT") != "" { transport.Host = os.Getenv("GORACKHD_ENDPOINT") } // create the API client, with the transport client := apiclient.New(transport, strfmt.Default) //use any function to do REST operations resp, err := client.Nodes.GetNodes(nil, nil) if err != nil { log.Fatal(err) } fmt.Printf("%#v\n", resp.Payload) }
func TestNodePostOperation(t *testing.T) { // create the transport transport := rc.New("localhost:9090", "/api/1.1", []string{"http"}) // configure the host if os.Getenv("GORACKHD_ENDPOINT") != "" { transport.Host = os.Getenv("GORACKHD_ENDPOINT") } // create the API client, with the transport client := apiclient.New(transport, strfmt.Default) c := &Node{ ID: "1234abcd1234abcd1234abcd", Name: "somename", Type: "compute", ObmSettings: []*ObmSettings{&ObmSettings{ Service: "ipmi-obm-service", Config: &ObmConfig{ Host: "1.2.3.4", User: "******", Password: "******", }, }}, } b, err := json.Marshal(c) if err != nil { log.Fatal(err) } fmt.Println(string(b)) params := nodes.NewPostNodesParams() params = params.WithIdentifiers(c) resp, err := client.Nodes.PostNodes(params, nil) if err != nil { log.Fatal(err) } fmt.Printf("%#v\n", resp.Payload) }
func TestNodeDeleteOperation(t *testing.T) { // create the transport transport := rc.New("localhost:9090", "/api/1.1", []string{"http"}) // configure the host. include port with environment variable. For instance the vagrant image would be localhost:9090 if os.Getenv("GORACKHD_ENDPOINT") != "" { transport.Host = os.Getenv("GORACKHD_ENDPOINT") } // create the API client, with the transport client := apiclient.New(transport, strfmt.Default) params := nodes.NewDeleteNodesIdentifierParams() params = params.WithIdentifier("1234abcd1234abcd1234abcd") resp, err := client.Nodes.DeleteNodesIdentifier(params, nil) if err != nil { log.Fatal(err) } fmt.Printf("%#v\n", resp) }
func TestNodeLookupOperation(t *testing.T) { // create the transport transport := rc.New("localhost:9090", "/api/1.1", []string{"http"}) // configure the host. include port with environment variable. For instance the vagrant image would be localhost:9090 if os.Getenv("GORACKHD_ENDPOINT") != "" { transport.Host = os.Getenv("GORACKHD_ENDPOINT") } // create the API client, with the transport client := apiclient.New(transport, strfmt.Default) nodeId := "56dde3441722c192796e3a38" params := lookups.NewGetLookupsParams() params = params.WithQ(&nodeId) //use any function to do REST operations resp, err := client.Lookups.GetLookups(params, nil) if err != nil { log.Fatal(err) } fmt.Printf("%#v\n", resp.Payload) }