update frontend backend (#129)

This commit is contained in:
Michael Quigley
2022-12-02 10:46:53 -05:00
parent 9ab7eeebf3
commit 38c83fda92
18 changed files with 1125 additions and 21 deletions

View File

@ -36,6 +36,8 @@ type ClientService interface {
ListFrontends(params *ListFrontendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListFrontendsOK, error)
UpdateFrontend(params *UpdateFrontendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateFrontendOK, error)
SetTransport(transport runtime.ClientTransport)
}
@ -156,6 +158,45 @@ func (a *Client) ListFrontends(params *ListFrontendsParams, authInfo runtime.Cli
panic(msg)
}
/*
UpdateFrontend update frontend API
*/
func (a *Client) UpdateFrontend(params *UpdateFrontendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateFrontendOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUpdateFrontendParams()
}
op := &runtime.ClientOperation{
ID: "updateFrontend",
Method: "PATCH",
PathPattern: "/frontend",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &UpdateFrontendReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*UpdateFrontendOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for updateFrontend: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport