From 553f798767072832d04f328d827a70b2b98bfac7 Mon Sep 17 00:00:00 2001 From: Ali AKCA Date: Tue, 30 Apr 2024 12:44:19 +0200 Subject: [PATCH] chore: sync generated resources (#305) --- castai/sdk/api.gen.go | 5 ++ castai/sdk/client.gen.go | 110 ++++++++++++++++++++++++++++++++++++++ castai/sdk/mock/client.go | 35 ++++++++++++ 3 files changed, 150 insertions(+) diff --git a/castai/sdk/api.gen.go b/castai/sdk/api.gen.go index 92e984e1..42239eae 100644 --- a/castai/sdk/api.gen.go +++ b/castai/sdk/api.gen.go @@ -1684,6 +1684,11 @@ type NodeconfigV1ListConfigurationsResponse struct { Items *[]NodeconfigV1NodeConfiguration `json:"items,omitempty"` } +// NodeconfigV1ListMaxPodsPresetsResponse defines model for nodeconfig.v1.ListMaxPodsPresetsResponse. +type NodeconfigV1ListMaxPodsPresetsResponse struct { + Presets *[]string `json:"presets,omitempty"` +} + // NodeconfigV1NewNodeConfiguration defines model for nodeconfig.v1.NewNodeConfiguration. type NodeconfigV1NewNodeConfiguration struct { Aks *NodeconfigV1AKSConfig `json:"aks,omitempty"` diff --git a/castai/sdk/client.gen.go b/castai/sdk/client.gen.go index a9f8f23a..43fc96bd 100644 --- a/castai/sdk/client.gen.go +++ b/castai/sdk/client.gen.go @@ -297,6 +297,9 @@ type ClientInterface interface { // ExternalClusterAPICreateClusterToken request ExternalClusterAPICreateClusterToken(ctx context.Context, clusterId string, reqEditors ...RequestEditorFn) (*http.Response, error) + // NodeConfigurationAPIListMaxPodsPresets request + NodeConfigurationAPIListMaxPodsPresets(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + // UsersAPICurrentUserProfile request UsersAPICurrentUserProfile(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1328,6 +1331,18 @@ func (c *Client) ExternalClusterAPICreateClusterToken(ctx context.Context, clust return c.Client.Do(req) } +func (c *Client) NodeConfigurationAPIListMaxPodsPresets(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewNodeConfigurationAPIListMaxPodsPresetsRequest(c.Server) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) UsersAPICurrentUserProfile(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUsersAPICurrentUserProfileRequest(c.Server) if err != nil { @@ -4265,6 +4280,33 @@ func NewExternalClusterAPICreateClusterTokenRequest(server string, clusterId str return req, nil } +// NewNodeConfigurationAPIListMaxPodsPresetsRequest generates requests for NodeConfigurationAPIListMaxPodsPresets +func NewNodeConfigurationAPIListMaxPodsPresetsRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/kubernetes/maxpods-formula-presets") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewUsersAPICurrentUserProfileRequest generates requests for UsersAPICurrentUserProfile func NewUsersAPICurrentUserProfileRequest(server string) (*http.Request, error) { var err error @@ -5766,6 +5808,9 @@ type ClientWithResponsesInterface interface { // ExternalClusterAPICreateClusterToken request ExternalClusterAPICreateClusterTokenWithResponse(ctx context.Context, clusterId string) (*ExternalClusterAPICreateClusterTokenResponse, error) + // NodeConfigurationAPIListMaxPodsPresets request + NodeConfigurationAPIListMaxPodsPresetsWithResponse(ctx context.Context) (*NodeConfigurationAPIListMaxPodsPresetsResponse, error) + // UsersAPICurrentUserProfile request UsersAPICurrentUserProfileWithResponse(ctx context.Context) (*UsersAPICurrentUserProfileResponse, error) @@ -7543,6 +7588,36 @@ func (r ExternalClusterAPICreateClusterTokenResponse) GetBody() []byte { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +type NodeConfigurationAPIListMaxPodsPresetsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *NodeconfigV1ListMaxPodsPresetsResponse +} + +// Status returns HTTPResponse.Status +func (r NodeConfigurationAPIListMaxPodsPresetsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r NodeConfigurationAPIListMaxPodsPresetsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r NodeConfigurationAPIListMaxPodsPresetsResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + type UsersAPICurrentUserProfileResponse struct { Body []byte HTTPResponse *http.Response @@ -9164,6 +9239,15 @@ func (c *ClientWithResponses) ExternalClusterAPICreateClusterTokenWithResponse(c return ParseExternalClusterAPICreateClusterTokenResponse(rsp) } +// NodeConfigurationAPIListMaxPodsPresetsWithResponse request returning *NodeConfigurationAPIListMaxPodsPresetsResponse +func (c *ClientWithResponses) NodeConfigurationAPIListMaxPodsPresetsWithResponse(ctx context.Context) (*NodeConfigurationAPIListMaxPodsPresetsResponse, error) { + rsp, err := c.NodeConfigurationAPIListMaxPodsPresets(ctx) + if err != nil { + return nil, err + } + return ParseNodeConfigurationAPIListMaxPodsPresetsResponse(rsp) +} + // UsersAPICurrentUserProfileWithResponse request returning *UsersAPICurrentUserProfileResponse func (c *ClientWithResponses) UsersAPICurrentUserProfileWithResponse(ctx context.Context) (*UsersAPICurrentUserProfileResponse, error) { rsp, err := c.UsersAPICurrentUserProfile(ctx) @@ -10960,6 +11044,32 @@ func ParseExternalClusterAPICreateClusterTokenResponse(rsp *http.Response) (*Ext return response, nil } +// ParseNodeConfigurationAPIListMaxPodsPresetsResponse parses an HTTP response from a NodeConfigurationAPIListMaxPodsPresetsWithResponse call +func ParseNodeConfigurationAPIListMaxPodsPresetsResponse(rsp *http.Response) (*NodeConfigurationAPIListMaxPodsPresetsResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &NodeConfigurationAPIListMaxPodsPresetsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest NodeconfigV1ListMaxPodsPresetsResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseUsersAPICurrentUserProfileResponse parses an HTTP response from a UsersAPICurrentUserProfileWithResponse call func ParseUsersAPICurrentUserProfileResponse(rsp *http.Response) (*UsersAPICurrentUserProfileResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) diff --git a/castai/sdk/mock/client.go b/castai/sdk/mock/client.go index 1a1fa6c9..830709eb 100644 --- a/castai/sdk/mock/client.go +++ b/castai/sdk/mock/client.go @@ -1195,6 +1195,26 @@ func (mr *MockClientInterfaceMockRecorder) NodeConfigurationAPIListConfiguration return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeConfigurationAPIListConfigurations", reflect.TypeOf((*MockClientInterface)(nil).NodeConfigurationAPIListConfigurations), varargs...) } +// NodeConfigurationAPIListMaxPodsPresets mocks base method. +func (m *MockClientInterface) NodeConfigurationAPIListMaxPodsPresets(ctx context.Context, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "NodeConfigurationAPIListMaxPodsPresets", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NodeConfigurationAPIListMaxPodsPresets indicates an expected call of NodeConfigurationAPIListMaxPodsPresets. +func (mr *MockClientInterfaceMockRecorder) NodeConfigurationAPIListMaxPodsPresets(ctx interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeConfigurationAPIListMaxPodsPresets", reflect.TypeOf((*MockClientInterface)(nil).NodeConfigurationAPIListMaxPodsPresets), varargs...) +} + // NodeConfigurationAPISetDefault mocks base method. func (m *MockClientInterface) NodeConfigurationAPISetDefault(ctx context.Context, clusterId, id string, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { m.ctrl.T.Helper() @@ -3318,6 +3338,21 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) NodeConfigurationAPIList return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeConfigurationAPIListConfigurationsWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).NodeConfigurationAPIListConfigurationsWithResponse), ctx, clusterId) } +// NodeConfigurationAPIListMaxPodsPresetsWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) NodeConfigurationAPIListMaxPodsPresetsWithResponse(ctx context.Context) (*sdk.NodeConfigurationAPIListMaxPodsPresetsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NodeConfigurationAPIListMaxPodsPresetsWithResponse", ctx) + ret0, _ := ret[0].(*sdk.NodeConfigurationAPIListMaxPodsPresetsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NodeConfigurationAPIListMaxPodsPresetsWithResponse indicates an expected call of NodeConfigurationAPIListMaxPodsPresetsWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) NodeConfigurationAPIListMaxPodsPresetsWithResponse(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeConfigurationAPIListMaxPodsPresetsWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).NodeConfigurationAPIListMaxPodsPresetsWithResponse), ctx) +} + // NodeConfigurationAPISetDefaultWithResponse mocks base method. func (m *MockClientWithResponsesInterface) NodeConfigurationAPISetDefaultWithResponse(ctx context.Context, clusterId, id string) (*sdk.NodeConfigurationAPISetDefaultResponse, error) { m.ctrl.T.Helper()