From 62d06739c52f7f5db3b353ccc113e2985a965270 Mon Sep 17 00:00:00 2001 From: Ahmad Malik Ibrahim Date: Mon, 9 Dec 2024 08:23:49 -0800 Subject: [PATCH] PE-5483: Implement hybrid APIs (#139) * feat: implement EnableClusterHybridSettings * feat: implement PutHybridConfig function * feat: add CreateAwsHybridMachinePool func * feat: add UpdateAwsHybridMachinePool and DeleteAwsHybridMachinePool funcs * feat: implement GetAwsHybridMachinePools func --- api/client/v1/v1_client.go | 108 ++++-- ...v1_dashboard_edgehosts_search_responses.go | 2 +- .../v1/v1_edge_hosts_metadata_responses.go | 2 +- ...rs_get_hybrid_pools_metadata_parameters.go | 136 ++++++++ ...ers_get_hybrid_pools_metadata_responses.go | 70 ++++ ...v1_spectro_clusters_tags_get_parameters.go | 113 +++++++ .../v1_spectro_clusters_tags_get_responses.go | 70 ++++ api/models/v1_aws_cloud_config_spec.go | 2 +- api/models/v1_aws_hybrid_machine_pool.go | 75 +++++ api/models/v1_backup_status_config.go | 25 +- api/models/v1_cloud_config_meta.go | 34 +- api/models/v1_cluster_backup_config.go | 25 +- api/models/v1_cluster_restore_config.go | 25 +- api/models/v1_edge_cluster_object_entity.go | 77 +++++ api/models/v1_edge_host_device_status.go | 34 +- api/models/v1_edge_hosts_metadata_status.go | 34 +- api/models/v1_hybrid_cluster_meta.go | 46 +++ ...ative_machine_pool_config_update_entity.go | 25 ++ api/models/v1_hybrid_machine_pool.go | 86 +++++ .../v1_hybrid_machine_pool_cluster_health.go | 46 +++ api/models/v1_hybrid_machine_pool_status.go | 74 +++++ .../v1_include_cluster_resource_mode.go | 69 ++++ api/models/v1_pack_ref.go | 7 +- ...1_spectro_cluster_hybrid_pools_metadata.go | 192 +++++++++++ api/models/v1_spectro_cluster_tags.go | 43 +++ api/models/v1_subnet.go | 6 + .../v1_workspace_backup_status_config.go | 25 +- api/models/v1_workspace_restore_config.go | 25 +- api/spec/palette-apis-spec.json | 311 ++++++++++++++---- api/spec/palette.json | 311 ++++++++++++++---- client/hybrid.go | 72 ++++ 31 files changed, 1991 insertions(+), 179 deletions(-) create mode 100644 api/client/v1/v1_spectro_clusters_get_hybrid_pools_metadata_parameters.go create mode 100644 api/client/v1/v1_spectro_clusters_get_hybrid_pools_metadata_responses.go create mode 100644 api/client/v1/v1_spectro_clusters_tags_get_parameters.go create mode 100644 api/client/v1/v1_spectro_clusters_tags_get_responses.go create mode 100644 api/models/v1_aws_hybrid_machine_pool.go create mode 100644 api/models/v1_edge_cluster_object_entity.go create mode 100644 api/models/v1_hybrid_cluster_meta.go create mode 100644 api/models/v1_hybrid_machine_pool.go create mode 100644 api/models/v1_hybrid_machine_pool_cluster_health.go create mode 100644 api/models/v1_hybrid_machine_pool_status.go create mode 100644 api/models/v1_include_cluster_resource_mode.go create mode 100644 api/models/v1_spectro_cluster_hybrid_pools_metadata.go create mode 100644 api/models/v1_spectro_cluster_tags.go create mode 100644 client/hybrid.go diff --git a/api/client/v1/v1_client.go b/api/client/v1/v1_client.go index 9dee3a1d..6427bb43 100644 --- a/api/client/v1/v1_client.go +++ b/api/client/v1/v1_client.go @@ -484,8 +484,6 @@ type ClientService interface { V1AwsCloudConfigsEdgeNativeMachinePoolUpdate(params *V1AwsCloudConfigsEdgeNativeMachinePoolUpdateParams) (*V1AwsCloudConfigsEdgeNativeMachinePoolUpdateNoContent, error) - V1AwsCloudConfigsEdgeNativeUIDClusterConfig(params *V1AwsCloudConfigsEdgeNativeUIDClusterConfigParams) (*V1AwsCloudConfigsEdgeNativeUIDClusterConfigNoContent, error) - V1AwsCloudConfigsUIDHybridConfig(params *V1AwsCloudConfigsUIDHybridConfigParams) (*V1AwsCloudConfigsUIDHybridConfigNoContent, error) V1AwsCloudCost(params *V1AwsCloudCostParams) (*V1AwsCloudCostOK, error) @@ -1496,6 +1494,8 @@ type ClientService interface { V1SpectroClustersGet(params *V1SpectroClustersGetParams) (*V1SpectroClustersGetOK, error) + V1SpectroClustersGetHybridPoolsMetadata(params *V1SpectroClustersGetHybridPoolsMetadataParams) (*V1SpectroClustersGetHybridPoolsMetadataOK, error) + V1SpectroClustersGetProfileUpdates(params *V1SpectroClustersGetProfileUpdatesParams) (*V1SpectroClustersGetProfileUpdatesOK, error) V1SpectroClustersGetProfiles(params *V1SpectroClustersGetProfilesParams) (*V1SpectroClustersGetProfilesOK, error) @@ -1560,6 +1560,8 @@ type ClientService interface { V1SpectroClustersSummaryUIDOverview(params *V1SpectroClustersSummaryUIDOverviewParams) (*V1SpectroClustersSummaryUIDOverviewOK, error) + V1SpectroClustersTagsGet(params *V1SpectroClustersTagsGetParams) (*V1SpectroClustersTagsGetOK, error) + V1SpectroClustersTkeCreate(params *V1SpectroClustersTkeCreateParams) (*V1SpectroClustersTkeCreateCreated, error) V1SpectroClustersTkeRate(params *V1SpectroClustersTkeRateParams) (*V1SpectroClustersTkeRateOK, error) @@ -9797,40 +9799,6 @@ func (a *Client) V1AwsCloudConfigsEdgeNativeMachinePoolUpdate(params *V1AwsCloud panic(msg) } -/* -V1AwsCloudConfigsEdgeNativeUIDClusterConfig updates the cluster configuration information of edge native cluster deployed through hybrid a w s cluster -*/ -func (a *Client) V1AwsCloudConfigsEdgeNativeUIDClusterConfig(params *V1AwsCloudConfigsEdgeNativeUIDClusterConfigParams) (*V1AwsCloudConfigsEdgeNativeUIDClusterConfigNoContent, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewV1AwsCloudConfigsEdgeNativeUIDClusterConfigParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "v1AwsCloudConfigsEdgeNativeUidClusterConfig", - Method: "PUT", - PathPattern: "/v1/cloudconfigs/aws/{configUid}/edge-native/machinePools/{machinePoolName}/clusterConfig", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &V1AwsCloudConfigsEdgeNativeUIDClusterConfigReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - success, ok := result.(*V1AwsCloudConfigsEdgeNativeUIDClusterConfigNoContent) - 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 v1AwsCloudConfigsEdgeNativeUidClusterConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - /* V1AwsCloudConfigsUIDHybridConfig updates the hybrid configuration information of a w s cluster */ @@ -27061,6 +27029,40 @@ func (a *Client) V1SpectroClustersGet(params *V1SpectroClustersGetParams) (*V1Sp panic(msg) } +/* +V1SpectroClustersGetHybridPoolsMetadata returns the metadata of all hybrid pools associated with the specified cluster +*/ +func (a *Client) V1SpectroClustersGetHybridPoolsMetadata(params *V1SpectroClustersGetHybridPoolsMetadataParams) (*V1SpectroClustersGetHybridPoolsMetadataOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1SpectroClustersGetHybridPoolsMetadataParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "v1SpectroClustersGetHybridPoolsMetadata", + Method: "GET", + PathPattern: "/v1/spectroclusters/{uid}/hybridPools/metadata", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &V1SpectroClustersGetHybridPoolsMetadataReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*V1SpectroClustersGetHybridPoolsMetadataOK) + 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 v1SpectroClustersGetHybridPoolsMetadata: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* V1SpectroClustersGetProfileUpdates returns the profile updates of a specified cluster */ @@ -28149,6 +28151,40 @@ func (a *Client) V1SpectroClustersSummaryUIDOverview(params *V1SpectroClustersSu panic(msg) } +/* +V1SpectroClustersTagsGet retrieves a list of spectrocluster tags +*/ +func (a *Client) V1SpectroClustersTagsGet(params *V1SpectroClustersTagsGetParams) (*V1SpectroClustersTagsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1SpectroClustersTagsGetParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "v1SpectroClustersTagsGet", + Method: "GET", + PathPattern: "/v1/spectroclusters/tags", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &V1SpectroClustersTagsGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*V1SpectroClustersTagsGetOK) + 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 v1SpectroClustersTagsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* V1SpectroClustersTkeCreate creates a tke cluster */ diff --git a/api/client/v1/v1_dashboard_edgehosts_search_responses.go b/api/client/v1/v1_dashboard_edgehosts_search_responses.go index a931c7e4..87d76e38 100644 --- a/api/client/v1/v1_dashboard_edgehosts_search_responses.go +++ b/api/client/v1/v1_dashboard_edgehosts_search_responses.go @@ -43,7 +43,7 @@ func NewV1DashboardEdgehostsSearchOK() *V1DashboardEdgehostsSearchOK { /* V1DashboardEdgehostsSearchOK handles this case with default header values. -An array of edgehost summary items +An array of edgenative pair summary items */ type V1DashboardEdgehostsSearchOK struct { Payload *models.V1EdgeHostsSearchSummary diff --git a/api/client/v1/v1_edge_hosts_metadata_responses.go b/api/client/v1/v1_edge_hosts_metadata_responses.go index 12c391a1..9c8f96d3 100644 --- a/api/client/v1/v1_edge_hosts_metadata_responses.go +++ b/api/client/v1/v1_edge_hosts_metadata_responses.go @@ -43,7 +43,7 @@ func NewV1EdgeHostsMetadataOK() *V1EdgeHostsMetadataOK { /* V1EdgeHostsMetadataOK handles this case with default header values. -An array of edgehost summary items +An array of edgenative pair summary items */ type V1EdgeHostsMetadataOK struct { Payload *models.V1EdgeHostsMetadataSummary diff --git a/api/client/v1/v1_spectro_clusters_get_hybrid_pools_metadata_parameters.go b/api/client/v1/v1_spectro_clusters_get_hybrid_pools_metadata_parameters.go new file mode 100644 index 00000000..18fb0008 --- /dev/null +++ b/api/client/v1/v1_spectro_clusters_get_hybrid_pools_metadata_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package v1 + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1SpectroClustersGetHybridPoolsMetadataParams creates a new V1SpectroClustersGetHybridPoolsMetadataParams object +// with the default values initialized. +func NewV1SpectroClustersGetHybridPoolsMetadataParams() *V1SpectroClustersGetHybridPoolsMetadataParams { + var () + return &V1SpectroClustersGetHybridPoolsMetadataParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewV1SpectroClustersGetHybridPoolsMetadataParamsWithTimeout creates a new V1SpectroClustersGetHybridPoolsMetadataParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewV1SpectroClustersGetHybridPoolsMetadataParamsWithTimeout(timeout time.Duration) *V1SpectroClustersGetHybridPoolsMetadataParams { + var () + return &V1SpectroClustersGetHybridPoolsMetadataParams{ + + timeout: timeout, + } +} + +// NewV1SpectroClustersGetHybridPoolsMetadataParamsWithContext creates a new V1SpectroClustersGetHybridPoolsMetadataParams object +// with the default values initialized, and the ability to set a context for a request +func NewV1SpectroClustersGetHybridPoolsMetadataParamsWithContext(ctx context.Context) *V1SpectroClustersGetHybridPoolsMetadataParams { + var () + return &V1SpectroClustersGetHybridPoolsMetadataParams{ + + Context: ctx, + } +} + +// NewV1SpectroClustersGetHybridPoolsMetadataParamsWithHTTPClient creates a new V1SpectroClustersGetHybridPoolsMetadataParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewV1SpectroClustersGetHybridPoolsMetadataParamsWithHTTPClient(client *http.Client) *V1SpectroClustersGetHybridPoolsMetadataParams { + var () + return &V1SpectroClustersGetHybridPoolsMetadataParams{ + HTTPClient: client, + } +} + +/* +V1SpectroClustersGetHybridPoolsMetadataParams contains all the parameters to send to the API endpoint +for the v1 spectro clusters get hybrid pools metadata operation typically these are written to a http.Request +*/ +type V1SpectroClustersGetHybridPoolsMetadataParams struct { + + /*UID + Cluster uid + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the v1 spectro clusters get hybrid pools metadata params +func (o *V1SpectroClustersGetHybridPoolsMetadataParams) WithTimeout(timeout time.Duration) *V1SpectroClustersGetHybridPoolsMetadataParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 spectro clusters get hybrid pools metadata params +func (o *V1SpectroClustersGetHybridPoolsMetadataParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 spectro clusters get hybrid pools metadata params +func (o *V1SpectroClustersGetHybridPoolsMetadataParams) WithContext(ctx context.Context) *V1SpectroClustersGetHybridPoolsMetadataParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 spectro clusters get hybrid pools metadata params +func (o *V1SpectroClustersGetHybridPoolsMetadataParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 spectro clusters get hybrid pools metadata params +func (o *V1SpectroClustersGetHybridPoolsMetadataParams) WithHTTPClient(client *http.Client) *V1SpectroClustersGetHybridPoolsMetadataParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 spectro clusters get hybrid pools metadata params +func (o *V1SpectroClustersGetHybridPoolsMetadataParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUID adds the uid to the v1 spectro clusters get hybrid pools metadata params +func (o *V1SpectroClustersGetHybridPoolsMetadataParams) WithUID(uid string) *V1SpectroClustersGetHybridPoolsMetadataParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the v1 spectro clusters get hybrid pools metadata params +func (o *V1SpectroClustersGetHybridPoolsMetadataParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *V1SpectroClustersGetHybridPoolsMetadataParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/client/v1/v1_spectro_clusters_get_hybrid_pools_metadata_responses.go b/api/client/v1/v1_spectro_clusters_get_hybrid_pools_metadata_responses.go new file mode 100644 index 00000000..f8b78437 --- /dev/null +++ b/api/client/v1/v1_spectro_clusters_get_hybrid_pools_metadata_responses.go @@ -0,0 +1,70 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package v1 + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/spectrocloud/palette-sdk-go/api/models" +) + +// V1SpectroClustersGetHybridPoolsMetadataReader is a Reader for the V1SpectroClustersGetHybridPoolsMetadata structure. +type V1SpectroClustersGetHybridPoolsMetadataReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1SpectroClustersGetHybridPoolsMetadataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1SpectroClustersGetHybridPoolsMetadataOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewV1SpectroClustersGetHybridPoolsMetadataOK creates a V1SpectroClustersGetHybridPoolsMetadataOK with default headers values +func NewV1SpectroClustersGetHybridPoolsMetadataOK() *V1SpectroClustersGetHybridPoolsMetadataOK { + return &V1SpectroClustersGetHybridPoolsMetadataOK{} +} + +/* +V1SpectroClustersGetHybridPoolsMetadataOK handles this case with default header values. + +OK +*/ +type V1SpectroClustersGetHybridPoolsMetadataOK struct { + Payload *models.V1SpectroClusterHybridPoolsMetadata +} + +func (o *V1SpectroClustersGetHybridPoolsMetadataOK) Error() string { + return fmt.Sprintf("[GET /v1/spectroclusters/{uid}/hybridPools/metadata][%d] v1SpectroClustersGetHybridPoolsMetadataOK %+v", 200, o.Payload) +} + +func (o *V1SpectroClustersGetHybridPoolsMetadataOK) GetPayload() *models.V1SpectroClusterHybridPoolsMetadata { + return o.Payload +} + +func (o *V1SpectroClustersGetHybridPoolsMetadataOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1SpectroClusterHybridPoolsMetadata) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/api/client/v1/v1_spectro_clusters_tags_get_parameters.go b/api/client/v1/v1_spectro_clusters_tags_get_parameters.go new file mode 100644 index 00000000..9e0e42a1 --- /dev/null +++ b/api/client/v1/v1_spectro_clusters_tags_get_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package v1 + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1SpectroClustersTagsGetParams creates a new V1SpectroClustersTagsGetParams object +// with the default values initialized. +func NewV1SpectroClustersTagsGetParams() *V1SpectroClustersTagsGetParams { + + return &V1SpectroClustersTagsGetParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewV1SpectroClustersTagsGetParamsWithTimeout creates a new V1SpectroClustersTagsGetParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewV1SpectroClustersTagsGetParamsWithTimeout(timeout time.Duration) *V1SpectroClustersTagsGetParams { + + return &V1SpectroClustersTagsGetParams{ + + timeout: timeout, + } +} + +// NewV1SpectroClustersTagsGetParamsWithContext creates a new V1SpectroClustersTagsGetParams object +// with the default values initialized, and the ability to set a context for a request +func NewV1SpectroClustersTagsGetParamsWithContext(ctx context.Context) *V1SpectroClustersTagsGetParams { + + return &V1SpectroClustersTagsGetParams{ + + Context: ctx, + } +} + +// NewV1SpectroClustersTagsGetParamsWithHTTPClient creates a new V1SpectroClustersTagsGetParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewV1SpectroClustersTagsGetParamsWithHTTPClient(client *http.Client) *V1SpectroClustersTagsGetParams { + + return &V1SpectroClustersTagsGetParams{ + HTTPClient: client, + } +} + +/* +V1SpectroClustersTagsGetParams contains all the parameters to send to the API endpoint +for the v1 spectro clusters tags get operation typically these are written to a http.Request +*/ +type V1SpectroClustersTagsGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the v1 spectro clusters tags get params +func (o *V1SpectroClustersTagsGetParams) WithTimeout(timeout time.Duration) *V1SpectroClustersTagsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 spectro clusters tags get params +func (o *V1SpectroClustersTagsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 spectro clusters tags get params +func (o *V1SpectroClustersTagsGetParams) WithContext(ctx context.Context) *V1SpectroClustersTagsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 spectro clusters tags get params +func (o *V1SpectroClustersTagsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 spectro clusters tags get params +func (o *V1SpectroClustersTagsGetParams) WithHTTPClient(client *http.Client) *V1SpectroClustersTagsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 spectro clusters tags get params +func (o *V1SpectroClustersTagsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1SpectroClustersTagsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/client/v1/v1_spectro_clusters_tags_get_responses.go b/api/client/v1/v1_spectro_clusters_tags_get_responses.go new file mode 100644 index 00000000..25e55fb0 --- /dev/null +++ b/api/client/v1/v1_spectro_clusters_tags_get_responses.go @@ -0,0 +1,70 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package v1 + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/spectrocloud/palette-sdk-go/api/models" +) + +// V1SpectroClustersTagsGetReader is a Reader for the V1SpectroClustersTagsGet structure. +type V1SpectroClustersTagsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1SpectroClustersTagsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1SpectroClustersTagsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewV1SpectroClustersTagsGetOK creates a V1SpectroClustersTagsGetOK with default headers values +func NewV1SpectroClustersTagsGetOK() *V1SpectroClustersTagsGetOK { + return &V1SpectroClustersTagsGetOK{} +} + +/* +V1SpectroClustersTagsGetOK handles this case with default header values. + +An array of spectrocluster tags +*/ +type V1SpectroClustersTagsGetOK struct { + Payload *models.V1SpectroClusterTags +} + +func (o *V1SpectroClustersTagsGetOK) Error() string { + return fmt.Sprintf("[GET /v1/spectroclusters/tags][%d] v1SpectroClustersTagsGetOK %+v", 200, o.Payload) +} + +func (o *V1SpectroClustersTagsGetOK) GetPayload() *models.V1SpectroClusterTags { + return o.Payload +} + +func (o *V1SpectroClustersTagsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1SpectroClusterTags) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/api/models/v1_aws_cloud_config_spec.go b/api/models/v1_aws_cloud_config_spec.go index b810c97b..ab1fe42a 100644 --- a/api/models/v1_aws_cloud_config_spec.go +++ b/api/models/v1_aws_cloud_config_spec.go @@ -25,7 +25,7 @@ type V1AwsCloudConfigSpec struct { ClusterConfig *V1AwsClusterConfig `json:"clusterConfig,omitempty"` // hybrid machine pools - HybridMachinePools []*V1EksHybridMachinePool `json:"hybridMachinePools"` + HybridMachinePools []*V1AwsHybridMachinePool `json:"hybridMachinePools"` // machine pool config MachinePoolConfig []*V1AwsMachinePoolConfig `json:"machinePoolConfig"` diff --git a/api/models/v1_aws_hybrid_machine_pool.go b/api/models/v1_aws_hybrid_machine_pool.go new file mode 100644 index 00000000..f2c56531 --- /dev/null +++ b/api/models/v1_aws_hybrid_machine_pool.go @@ -0,0 +1,75 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// V1AwsHybridMachinePool Machine pool reference of cloud config of cluster deployed by hybrid cluster +// +// swagger:model v1AwsHybridMachinePool +type V1AwsHybridMachinePool struct { + + // pool cloud type + PoolCloudType V1HybridPoolClusterCloudType `json:"poolCloudType,omitempty"` + + // Machine pool name + PoolName string `json:"poolName,omitempty"` + + // Machine pool uid + PoolUID string `json:"poolUid,omitempty"` +} + +// Validate validates this v1 aws hybrid machine pool +func (m *V1AwsHybridMachinePool) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePoolCloudType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1AwsHybridMachinePool) validatePoolCloudType(formats strfmt.Registry) error { + + if swag.IsZero(m.PoolCloudType) { // not required + return nil + } + + if err := m.PoolCloudType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poolCloudType") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1AwsHybridMachinePool) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1AwsHybridMachinePool) UnmarshalBinary(b []byte) error { + var res V1AwsHybridMachinePool + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_backup_status_config.go b/api/models/v1_backup_status_config.go index bcf1518b..61b91fc2 100644 --- a/api/models/v1_backup_status_config.go +++ b/api/models/v1_backup_status_config.go @@ -20,7 +20,10 @@ type V1BackupStatusConfig struct { // include all disks IncludeAllDisks bool `json:"includeAllDisks,omitempty"` - // include cluster resources + // include cluster resource mode + IncludeClusterResourceMode V1IncludeClusterResourceMode `json:"includeClusterResourceMode,omitempty"` + + // Deprecated. Use includeClusterResourceMode IncludeClusterResources bool `json:"includeClusterResources,omitempty"` // namespaces @@ -32,6 +35,10 @@ type V1BackupStatusConfig struct { func (m *V1BackupStatusConfig) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateIncludeClusterResourceMode(formats); err != nil { + res = append(res, err) + } + if err := m.validateNamespaces(formats); err != nil { res = append(res, err) } @@ -42,6 +49,22 @@ func (m *V1BackupStatusConfig) Validate(formats strfmt.Registry) error { return nil } +func (m *V1BackupStatusConfig) validateIncludeClusterResourceMode(formats strfmt.Registry) error { + + if swag.IsZero(m.IncludeClusterResourceMode) { // not required + return nil + } + + if err := m.IncludeClusterResourceMode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("includeClusterResourceMode") + } + return err + } + + return nil +} + func (m *V1BackupStatusConfig) validateNamespaces(formats strfmt.Registry) error { if swag.IsZero(m.Namespaces) { // not required diff --git a/api/models/v1_cloud_config_meta.go b/api/models/v1_cloud_config_meta.go index c2e1c086..fab8107d 100644 --- a/api/models/v1_cloud_config_meta.go +++ b/api/models/v1_cloud_config_meta.go @@ -21,7 +21,10 @@ type V1CloudConfigMeta struct { // cloud type CloudType string `json:"cloudType,omitempty"` - // Machine pool meta information + // Hybrid Machine pools meta information + HybridMachinePools []*V1MachinePoolMeta `json:"hybridMachinePools"` + + // Machine pools meta information MachinePools []*V1MachinePoolMeta `json:"machinePools"` // Cluster's cloud config uid @@ -32,6 +35,10 @@ type V1CloudConfigMeta struct { func (m *V1CloudConfigMeta) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateHybridMachinePools(formats); err != nil { + res = append(res, err) + } + if err := m.validateMachinePools(formats); err != nil { res = append(res, err) } @@ -42,6 +49,31 @@ func (m *V1CloudConfigMeta) Validate(formats strfmt.Registry) error { return nil } +func (m *V1CloudConfigMeta) validateHybridMachinePools(formats strfmt.Registry) error { + + if swag.IsZero(m.HybridMachinePools) { // not required + return nil + } + + for i := 0; i < len(m.HybridMachinePools); i++ { + if swag.IsZero(m.HybridMachinePools[i]) { // not required + continue + } + + if m.HybridMachinePools[i] != nil { + if err := m.HybridMachinePools[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hybridMachinePools" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *V1CloudConfigMeta) validateMachinePools(formats strfmt.Registry) error { if swag.IsZero(m.MachinePools) { // not required diff --git a/api/models/v1_cluster_backup_config.go b/api/models/v1_cluster_backup_config.go index 82e42d5e..95868061 100644 --- a/api/models/v1_cluster_backup_config.go +++ b/api/models/v1_cluster_backup_config.go @@ -35,7 +35,10 @@ type V1ClusterBackupConfig struct { // include all disks IncludeAllDisks bool `json:"includeAllDisks,omitempty"` - // include cluster resources + // include cluster resource mode + IncludeClusterResourceMode V1IncludeClusterResourceMode `json:"includeClusterResourceMode,omitempty"` + + // Deprecated. Use includeClusterResourceMode IncludeClusterResources bool `json:"includeClusterResources,omitempty"` // location type @@ -53,6 +56,10 @@ type V1ClusterBackupConfig struct { func (m *V1ClusterBackupConfig) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateIncludeClusterResourceMode(formats); err != nil { + res = append(res, err) + } + if err := m.validateNamespaces(formats); err != nil { res = append(res, err) } @@ -67,6 +74,22 @@ func (m *V1ClusterBackupConfig) Validate(formats strfmt.Registry) error { return nil } +func (m *V1ClusterBackupConfig) validateIncludeClusterResourceMode(formats strfmt.Registry) error { + + if swag.IsZero(m.IncludeClusterResourceMode) { // not required + return nil + } + + if err := m.IncludeClusterResourceMode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("includeClusterResourceMode") + } + return err + } + + return nil +} + func (m *V1ClusterBackupConfig) validateNamespaces(formats strfmt.Registry) error { if swag.IsZero(m.Namespaces) { // not required diff --git a/api/models/v1_cluster_restore_config.go b/api/models/v1_cluster_restore_config.go index 818522d9..c3417a71 100644 --- a/api/models/v1_cluster_restore_config.go +++ b/api/models/v1_cluster_restore_config.go @@ -29,7 +29,10 @@ type V1ClusterRestoreConfig struct { // Required: true DestinationClusterUID *string `json:"destinationClusterUid"` - // include cluster resources + // include cluster resource mode + IncludeClusterResourceMode V1IncludeClusterResourceMode `json:"includeClusterResourceMode,omitempty"` + + // Deprecated. Use includeClusterResourceMode IncludeClusterResources bool `json:"includeClusterResources,omitempty"` // include namespaces @@ -59,6 +62,10 @@ func (m *V1ClusterRestoreConfig) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateIncludeClusterResourceMode(formats); err != nil { + res = append(res, err) + } + if err := m.validateIncludeNamespaces(formats); err != nil { res = append(res, err) } @@ -96,6 +103,22 @@ func (m *V1ClusterRestoreConfig) validateDestinationClusterUID(formats strfmt.Re return nil } +func (m *V1ClusterRestoreConfig) validateIncludeClusterResourceMode(formats strfmt.Registry) error { + + if swag.IsZero(m.IncludeClusterResourceMode) { // not required + return nil + } + + if err := m.IncludeClusterResourceMode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("includeClusterResourceMode") + } + return err + } + + return nil +} + func (m *V1ClusterRestoreConfig) validateIncludeNamespaces(formats strfmt.Registry) error { if swag.IsZero(m.IncludeNamespaces) { // not required diff --git a/api/models/v1_edge_cluster_object_entity.go b/api/models/v1_edge_cluster_object_entity.go new file mode 100644 index 00000000..62bf02d4 --- /dev/null +++ b/api/models/v1_edge_cluster_object_entity.go @@ -0,0 +1,77 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// V1EdgeClusterObjectEntity Object identity meta of the cluster +// +// swagger:model v1EdgeClusterObjectEntity +type V1EdgeClusterObjectEntity struct { + + // In case of hybrid edge clusters, it provides the object identity meta of hybrid cluster + HybridCluster *V1HybridClusterMeta `json:"hybridCluster,omitempty"` + + // Name of the cluster + Name string `json:"name,omitempty"` + + // Uid of the cluster + UID string `json:"uid,omitempty"` +} + +// Validate validates this v1 edge cluster object entity +func (m *V1EdgeClusterObjectEntity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHybridCluster(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1EdgeClusterObjectEntity) validateHybridCluster(formats strfmt.Registry) error { + + if swag.IsZero(m.HybridCluster) { // not required + return nil + } + + if m.HybridCluster != nil { + if err := m.HybridCluster.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hybridCluster") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1EdgeClusterObjectEntity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1EdgeClusterObjectEntity) UnmarshalBinary(b []byte) error { + var res V1EdgeClusterObjectEntity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_edge_host_device_status.go b/api/models/v1_edge_host_device_status.go index 8ad86606..9454f632 100644 --- a/api/models/v1_edge_host_device_status.go +++ b/api/models/v1_edge_host_device_status.go @@ -23,9 +23,12 @@ type V1EdgeHostDeviceStatus struct { // health Health *V1EdgeHostHealth `json:"health,omitempty"` - // in use clusters + // Deprecated. Use inUseClustersRef InUseClusters []*V1ObjectEntity `json:"inUseClusters"` + // in use clusters ref + InUseClustersRef []*V1EdgeClusterObjectEntity `json:"inUseClustersRef"` + // packs Packs []*V1ClusterPackStatus `json:"packs"` @@ -52,6 +55,10 @@ func (m *V1EdgeHostDeviceStatus) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateInUseClustersRef(formats); err != nil { + res = append(res, err) + } + if err := m.validatePacks(formats); err != nil { res = append(res, err) } @@ -113,6 +120,31 @@ func (m *V1EdgeHostDeviceStatus) validateInUseClusters(formats strfmt.Registry) return nil } +func (m *V1EdgeHostDeviceStatus) validateInUseClustersRef(formats strfmt.Registry) error { + + if swag.IsZero(m.InUseClustersRef) { // not required + return nil + } + + for i := 0; i < len(m.InUseClustersRef); i++ { + if swag.IsZero(m.InUseClustersRef[i]) { // not required + continue + } + + if m.InUseClustersRef[i] != nil { + if err := m.InUseClustersRef[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("inUseClustersRef" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *V1EdgeHostDeviceStatus) validatePacks(formats strfmt.Registry) error { if swag.IsZero(m.Packs) { // not required diff --git a/api/models/v1_edge_hosts_metadata_status.go b/api/models/v1_edge_hosts_metadata_status.go index dd45331a..60ad0e9c 100644 --- a/api/models/v1_edge_hosts_metadata_status.go +++ b/api/models/v1_edge_hosts_metadata_status.go @@ -21,9 +21,12 @@ type V1EdgeHostsMetadataStatus struct { // health Health *V1EdgeHostHealth `json:"health,omitempty"` - // in use clusters + // Deprecated. Use inUseClustersRef InUseClusters []*V1ObjectEntity `json:"inUseClusters"` + // in use clusters ref + InUseClustersRef []*V1EdgeClusterObjectEntity `json:"inUseClustersRef"` + // state State V1EdgeHostState `json:"state,omitempty"` } @@ -40,6 +43,10 @@ func (m *V1EdgeHostsMetadataStatus) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateInUseClustersRef(formats); err != nil { + res = append(res, err) + } + if err := m.validateState(formats); err != nil { res = append(res, err) } @@ -93,6 +100,31 @@ func (m *V1EdgeHostsMetadataStatus) validateInUseClusters(formats strfmt.Registr return nil } +func (m *V1EdgeHostsMetadataStatus) validateInUseClustersRef(formats strfmt.Registry) error { + + if swag.IsZero(m.InUseClustersRef) { // not required + return nil + } + + for i := 0; i < len(m.InUseClustersRef); i++ { + if swag.IsZero(m.InUseClustersRef[i]) { // not required + continue + } + + if m.InUseClustersRef[i] != nil { + if err := m.InUseClustersRef[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("inUseClustersRef" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *V1EdgeHostsMetadataStatus) validateState(formats strfmt.Registry) error { if swag.IsZero(m.State) { // not required diff --git a/api/models/v1_hybrid_cluster_meta.go b/api/models/v1_hybrid_cluster_meta.go new file mode 100644 index 00000000..d2d3181e --- /dev/null +++ b/api/models/v1_hybrid_cluster_meta.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// V1HybridClusterMeta Object identity meta of hybrid cluster +// +// swagger:model v1HybridClusterMeta +type V1HybridClusterMeta struct { + + // Name of the hybrid cluster + Name string `json:"name,omitempty"` + + // Uid of the hybrid cluster + UID string `json:"uid,omitempty"` +} + +// Validate validates this v1 hybrid cluster meta +func (m *V1HybridClusterMeta) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1HybridClusterMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1HybridClusterMeta) UnmarshalBinary(b []byte) error { + var res V1HybridClusterMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_hybrid_edge_native_machine_pool_config_update_entity.go b/api/models/v1_hybrid_edge_native_machine_pool_config_update_entity.go index 5bb8d4e5..a0cb9446 100644 --- a/api/models/v1_hybrid_edge_native_machine_pool_config_update_entity.go +++ b/api/models/v1_hybrid_edge_native_machine_pool_config_update_entity.go @@ -19,6 +19,9 @@ type V1HybridEdgeNativeMachinePoolConfigUpdateEntity struct { // cloud config CloudConfig *V1EdgeNativeHybridMachineConfigEntity `json:"cloudConfig,omitempty"` + // cluster config + ClusterConfig *V1EdgeNativeHybridClusterConfig `json:"clusterConfig,omitempty"` + // pool config PoolConfig *V1MachinePoolConfigEntity `json:"poolConfig,omitempty"` } @@ -31,6 +34,10 @@ func (m *V1HybridEdgeNativeMachinePoolConfigUpdateEntity) Validate(formats strfm res = append(res, err) } + if err := m.validateClusterConfig(formats); err != nil { + res = append(res, err) + } + if err := m.validatePoolConfig(formats); err != nil { res = append(res, err) } @@ -59,6 +66,24 @@ func (m *V1HybridEdgeNativeMachinePoolConfigUpdateEntity) validateCloudConfig(fo return nil } +func (m *V1HybridEdgeNativeMachinePoolConfigUpdateEntity) validateClusterConfig(formats strfmt.Registry) error { + + if swag.IsZero(m.ClusterConfig) { // not required + return nil + } + + if m.ClusterConfig != nil { + if err := m.ClusterConfig.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clusterConfig") + } + return err + } + } + + return nil +} + func (m *V1HybridEdgeNativeMachinePoolConfigUpdateEntity) validatePoolConfig(formats strfmt.Registry) error { if swag.IsZero(m.PoolConfig) { // not required diff --git a/api/models/v1_hybrid_machine_pool.go b/api/models/v1_hybrid_machine_pool.go new file mode 100644 index 00000000..75bdb198 --- /dev/null +++ b/api/models/v1_hybrid_machine_pool.go @@ -0,0 +1,86 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// V1HybridMachinePool Metadata information related to a hybrid machine pool launched as part of an hybrid cluster +// +// swagger:model v1HybridMachinePool +type V1HybridMachinePool struct { + + // Cloud config uid associated with the hybrid machine pool + CloudConfigUID string `json:"cloudConfigUid,omitempty"` + + // Cloud type of the hybrid machine pool + CloudType string `json:"cloudType,omitempty"` + + // Uid of the hybrid machine pool cluster + ClusterUID string `json:"clusterUid,omitempty"` + + // Name of the hybrid machine pool + Name string `json:"name,omitempty"` + + // status + Status *V1HybridMachinePoolStatus `json:"status,omitempty"` + + // Uid of the hybrid machine pool + UID string `json:"uid,omitempty"` +} + +// Validate validates this v1 hybrid machine pool +func (m *V1HybridMachinePool) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1HybridMachinePool) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status) { // not required + return nil + } + + if m.Status != nil { + if err := m.Status.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1HybridMachinePool) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1HybridMachinePool) UnmarshalBinary(b []byte) error { + var res V1HybridMachinePool + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_hybrid_machine_pool_cluster_health.go b/api/models/v1_hybrid_machine_pool_cluster_health.go new file mode 100644 index 00000000..02ee7692 --- /dev/null +++ b/api/models/v1_hybrid_machine_pool_cluster_health.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// V1HybridMachinePoolClusterHealth Machine pool cluster meta health information +// +// swagger:model v1HybridMachinePoolClusterHealth +type V1HybridMachinePoolClusterHealth struct { + + // is heart beat failed + IsHeartBeatFailed bool `json:"isHeartBeatFailed"` + + // state + State string `json:"state,omitempty"` +} + +// Validate validates this v1 hybrid machine pool cluster health +func (m *V1HybridMachinePoolClusterHealth) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1HybridMachinePoolClusterHealth) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1HybridMachinePoolClusterHealth) UnmarshalBinary(b []byte) error { + var res V1HybridMachinePoolClusterHealth + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_hybrid_machine_pool_status.go b/api/models/v1_hybrid_machine_pool_status.go new file mode 100644 index 00000000..d5809d66 --- /dev/null +++ b/api/models/v1_hybrid_machine_pool_status.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// V1HybridMachinePoolStatus Get the hybrid machine pool's cluster status +// +// swagger:model v1HybridMachinePoolStatus +type V1HybridMachinePoolStatus struct { + + // Health of the hybrid machine pool + Health *V1HybridMachinePoolClusterHealth `json:"health,omitempty"` + + // State of the hybrid machine pool + State string `json:"state,omitempty"` +} + +// Validate validates this v1 hybrid machine pool status +func (m *V1HybridMachinePoolStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHealth(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1HybridMachinePoolStatus) validateHealth(formats strfmt.Registry) error { + + if swag.IsZero(m.Health) { // not required + return nil + } + + if m.Health != nil { + if err := m.Health.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("health") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1HybridMachinePoolStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1HybridMachinePoolStatus) UnmarshalBinary(b []byte) error { + var res V1HybridMachinePoolStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_include_cluster_resource_mode.go b/api/models/v1_include_cluster_resource_mode.go new file mode 100644 index 00000000..43035919 --- /dev/null +++ b/api/models/v1_include_cluster_resource_mode.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// V1IncludeClusterResourceMode Specifies the scope of cluster-wide resources to include in the backup based on the flag'--include-cluster-resources': +// - "Always": --include-cluster-resources=true, which includes all cluster-wide resources; restores only on the original cluster. +// - "Auto": don't specify --include-cluster-resources, which exclude general cluster-wide resources, but includes PersistentVolumes linked to selected namespaces. +// - "Never": --include-cluster-resources=false, exclude all cluster-wide resources, including PersistentVolumes. +// +// swagger:model v1IncludeClusterResourceMode +type V1IncludeClusterResourceMode string + +const ( + + // V1IncludeClusterResourceModeAlways captures enum value "Always" + V1IncludeClusterResourceModeAlways V1IncludeClusterResourceMode = "Always" + + // V1IncludeClusterResourceModeAuto captures enum value "Auto" + V1IncludeClusterResourceModeAuto V1IncludeClusterResourceMode = "Auto" + + // V1IncludeClusterResourceModeNever captures enum value "Never" + V1IncludeClusterResourceModeNever V1IncludeClusterResourceMode = "Never" +) + +// for schema +var v1IncludeClusterResourceModeEnum []interface{} + +func init() { + var res []V1IncludeClusterResourceMode + if err := json.Unmarshal([]byte(`["Always","Auto","Never"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + v1IncludeClusterResourceModeEnum = append(v1IncludeClusterResourceModeEnum, v) + } +} + +func (m V1IncludeClusterResourceMode) validateV1IncludeClusterResourceModeEnum(path, location string, value V1IncludeClusterResourceMode) error { + if err := validate.EnumCase(path, location, value, v1IncludeClusterResourceModeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this v1 include cluster resource mode +func (m V1IncludeClusterResourceMode) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateV1IncludeClusterResourceModeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/models/v1_pack_ref.go b/api/models/v1_pack_ref.go index 3da6b84d..76f57084 100644 --- a/api/models/v1_pack_ref.go +++ b/api/models/v1_pack_ref.go @@ -69,7 +69,7 @@ type V1PackRef struct { Tag string `json:"tag,omitempty"` // type of the pack - // Enum: [spectro helm manifest] + // Enum: [spectro helm manifest oci] Type string `json:"type,omitempty"` // values represents the values.yaml used as input parameters either Params OR Values should be used, not both If both applied at the same time, will only use Values @@ -256,7 +256,7 @@ var v1PackRefTypeTypePropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["spectro","helm","manifest"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["spectro","helm","manifest","oci"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -274,6 +274,9 @@ const ( // V1PackRefTypeManifest captures enum value "manifest" V1PackRefTypeManifest string = "manifest" + + // V1PackRefTypeOci captures enum value "oci" + V1PackRefTypeOci string = "oci" ) // prop value enum diff --git a/api/models/v1_spectro_cluster_hybrid_pools_metadata.go b/api/models/v1_spectro_cluster_hybrid_pools_metadata.go new file mode 100644 index 00000000..55ecb111 --- /dev/null +++ b/api/models/v1_spectro_cluster_hybrid_pools_metadata.go @@ -0,0 +1,192 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// V1SpectroClusterHybridPoolsMetadata Metadata of clusters launched as hybrid machine pools +// +// swagger:model v1SpectroClusterHybridPoolsMetadata +type V1SpectroClusterHybridPoolsMetadata struct { + + // metadata + Metadata *V1ObjectMeta `json:"metadata,omitempty"` + + // spec + Spec *V1SpectroClusterHybridPoolsMetadataSpec `json:"spec,omitempty"` + + // status + Status *V1SpectroClusterStatus `json:"status,omitempty"` +} + +// Validate validates this v1 spectro cluster hybrid pools metadata +func (m *V1SpectroClusterHybridPoolsMetadata) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMetadata(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSpec(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1SpectroClusterHybridPoolsMetadata) validateMetadata(formats strfmt.Registry) error { + + if swag.IsZero(m.Metadata) { // not required + return nil + } + + if m.Metadata != nil { + if err := m.Metadata.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metadata") + } + return err + } + } + + return nil +} + +func (m *V1SpectroClusterHybridPoolsMetadata) validateSpec(formats strfmt.Registry) error { + + if swag.IsZero(m.Spec) { // not required + return nil + } + + if m.Spec != nil { + if err := m.Spec.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("spec") + } + return err + } + } + + return nil +} + +func (m *V1SpectroClusterHybridPoolsMetadata) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status) { // not required + return nil + } + + if m.Status != nil { + if err := m.Status.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1SpectroClusterHybridPoolsMetadata) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1SpectroClusterHybridPoolsMetadata) UnmarshalBinary(b []byte) error { + var res V1SpectroClusterHybridPoolsMetadata + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// V1SpectroClusterHybridPoolsMetadataSpec v1 spectro cluster hybrid pools metadata spec +// +// swagger:model V1SpectroClusterHybridPoolsMetadataSpec +type V1SpectroClusterHybridPoolsMetadataSpec struct { + + // Cluster's cloud type + CloudType string `json:"cloudType,omitempty"` + + // hybrid pools + HybridPools []*V1HybridMachinePool `json:"hybridPools"` +} + +// Validate validates this v1 spectro cluster hybrid pools metadata spec +func (m *V1SpectroClusterHybridPoolsMetadataSpec) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHybridPools(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1SpectroClusterHybridPoolsMetadataSpec) validateHybridPools(formats strfmt.Registry) error { + + if swag.IsZero(m.HybridPools) { // not required + return nil + } + + for i := 0; i < len(m.HybridPools); i++ { + if swag.IsZero(m.HybridPools[i]) { // not required + continue + } + + if m.HybridPools[i] != nil { + if err := m.HybridPools[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("spec" + "." + "hybridPools" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1SpectroClusterHybridPoolsMetadataSpec) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1SpectroClusterHybridPoolsMetadataSpec) UnmarshalBinary(b []byte) error { + var res V1SpectroClusterHybridPoolsMetadataSpec + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_spectro_cluster_tags.go b/api/models/v1_spectro_cluster_tags.go new file mode 100644 index 00000000..00a4fbfe --- /dev/null +++ b/api/models/v1_spectro_cluster_tags.go @@ -0,0 +1,43 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// V1SpectroClusterTags v1 spectro cluster tags +// +// swagger:model v1SpectroClusterTags +type V1SpectroClusterTags struct { + + // tags + Tags []string `json:"tags"` +} + +// Validate validates this v1 spectro cluster tags +func (m *V1SpectroClusterTags) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1SpectroClusterTags) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1SpectroClusterTags) UnmarshalBinary(b []byte) error { + var res V1SpectroClusterTags + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_subnet.go b/api/models/v1_subnet.go index 35f19af9..81a09e99 100644 --- a/api/models/v1_subnet.go +++ b/api/models/v1_subnet.go @@ -21,6 +21,12 @@ type V1Subnet struct { // name Name string `json:"name,omitempty"` + // Network security group of the subnet + NetworkSecurityGroup string `json:"networkSecurityGroup,omitempty"` + + // Resource group associated with a subnet + ResourceGroup string `json:"resourceGroup,omitempty"` + // Network Security Group(NSG) to be attached to subnet. NSG for a control plane subnet, should allow inbound to port 6443, as port 6443 is used by kubeadm to bootstrap the control planes SecurityGroupName string `json:"securityGroupName,omitempty"` } diff --git a/api/models/v1_workspace_backup_status_config.go b/api/models/v1_workspace_backup_status_config.go index 33245c9d..f6256570 100644 --- a/api/models/v1_workspace_backup_status_config.go +++ b/api/models/v1_workspace_backup_status_config.go @@ -26,7 +26,10 @@ type V1WorkspaceBackupStatusConfig struct { // include all disks IncludeAllDisks bool `json:"includeAllDisks,omitempty"` - // include cluster resources + // include cluster resource mode + IncludeClusterResourceMode V1IncludeClusterResourceMode `json:"includeClusterResourceMode,omitempty"` + + // Deprecated. Use includeClusterResourceMode IncludeClusterResources bool `json:"includeClusterResources,omitempty"` // namespaces @@ -38,6 +41,10 @@ type V1WorkspaceBackupStatusConfig struct { func (m *V1WorkspaceBackupStatusConfig) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateIncludeClusterResourceMode(formats); err != nil { + res = append(res, err) + } + if err := m.validateNamespaces(formats); err != nil { res = append(res, err) } @@ -48,6 +55,22 @@ func (m *V1WorkspaceBackupStatusConfig) Validate(formats strfmt.Registry) error return nil } +func (m *V1WorkspaceBackupStatusConfig) validateIncludeClusterResourceMode(formats strfmt.Registry) error { + + if swag.IsZero(m.IncludeClusterResourceMode) { // not required + return nil + } + + if err := m.IncludeClusterResourceMode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("includeClusterResourceMode") + } + return err + } + + return nil +} + func (m *V1WorkspaceBackupStatusConfig) validateNamespaces(formats strfmt.Registry) error { if swag.IsZero(m.Namespaces) { // not required diff --git a/api/models/v1_workspace_restore_config.go b/api/models/v1_workspace_restore_config.go index 8998d1ff..529e5956 100644 --- a/api/models/v1_workspace_restore_config.go +++ b/api/models/v1_workspace_restore_config.go @@ -21,7 +21,10 @@ type V1WorkspaceRestoreConfig struct { // Required: true BackupName *string `json:"backupName"` - // include cluster resources + // include cluster resource mode + IncludeClusterResourceMode V1IncludeClusterResourceMode `json:"includeClusterResourceMode,omitempty"` + + // Deprecated. Use includeClusterResourceMode IncludeClusterResources bool `json:"includeClusterResources,omitempty"` // include namespaces @@ -47,6 +50,10 @@ func (m *V1WorkspaceRestoreConfig) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateIncludeClusterResourceMode(formats); err != nil { + res = append(res, err) + } + if err := m.validateIncludeNamespaces(formats); err != nil { res = append(res, err) } @@ -70,6 +77,22 @@ func (m *V1WorkspaceRestoreConfig) validateBackupName(formats strfmt.Registry) e return nil } +func (m *V1WorkspaceRestoreConfig) validateIncludeClusterResourceMode(formats strfmt.Registry) error { + + if swag.IsZero(m.IncludeClusterResourceMode) { // not required + return nil + } + + if err := m.IncludeClusterResourceMode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("includeClusterResourceMode") + } + return err + } + + return nil +} + func (m *V1WorkspaceRestoreConfig) validateIncludeNamespaces(formats strfmt.Registry) error { if swag.IsZero(m.IncludeNamespaces) { // not required diff --git a/api/spec/palette-apis-spec.json b/api/spec/palette-apis-spec.json index d2e31bf9..b9f6e8f6 100644 --- a/api/spec/palette-apis-spec.json +++ b/api/spec/palette-apis-spec.json @@ -4056,45 +4056,6 @@ } ] }, - "/v1/cloudconfigs/aws/{configUid}/edge-native/machinePools/{machinePoolName}/clusterConfig": { - "put": { - "tags": [ - "v1" - ], - "summary": "Updates the cluster configuration information of Edge-Native cluster deployed through Hybrid AWS cluster", - "operationId": "v1AwsCloudConfigsEdgeNativeUidClusterConfig", - "parameters": [ - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/v1HybridEdgeNativeClusterConfigEntity" - } - } - ], - "responses": { - "204": { - "description": "The resource was updated successfully" - } - } - }, - "parameters": [ - { - "type": "string", - "description": "Hybrid AWS Cluster's cloud config uid", - "name": "configUid", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Edge-Native machine pool name", - "name": "machinePoolName", - "in": "path", - "required": true - } - ] - }, "/v1/cloudconfigs/aws/{configUid}/machinePools": { "post": { "tags": [ @@ -13465,7 +13426,7 @@ ], "responses": { "200": { - "description": "An array of edgehost summary items", + "description": "An array of edgenative pair summary items", "schema": { "$ref": "#/definitions/v1EdgeHostsMetadataSummary" } @@ -13731,7 +13692,7 @@ ], "responses": { "200": { - "description": "An array of edgehost summary items", + "description": "An array of edgenative pair summary items", "schema": { "$ref": "#/definitions/v1EdgeHostsSearchSummary" } @@ -21570,6 +21531,23 @@ } } }, + "/v1/spectroclusters/tags": { + "get": { + "tags": [ + "v1" + ], + "summary": "Retrieves a list of spectrocluster tags", + "operationId": "v1SpectroClustersTagsGet", + "responses": { + "200": { + "description": "An array of spectrocluster tags", + "schema": { + "$ref": "#/definitions/v1SpectroClusterTags" + } + } + } + } + }, "/v1/spectroclusters/tke": { "post": { "tags": [ @@ -23808,6 +23786,32 @@ } ] }, + "/v1/spectroclusters/{uid}/hybridPools/metadata": { + "get": { + "tags": [ + "v1" + ], + "summary": "Returns the metadata of all hybrid pools associated with the specified cluster", + "operationId": "v1SpectroClustersGetHybridPoolsMetadata", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1SpectroClusterHybridPoolsMetadata" + } + } + } + }, + "parameters": [ + { + "type": "string", + "description": "Cluster uid", + "name": "uid", + "in": "path", + "required": true + } + ] + }, "/v1/spectroclusters/{uid}/hybridSettings": { "patch": { "tags": [ @@ -31944,7 +31948,7 @@ "hybridMachinePools": { "type": "array", "items": { - "$ref": "#/definitions/v1EksHybridMachinePool" + "$ref": "#/definitions/v1AwsHybridMachinePool" } }, "machinePoolConfig": { @@ -32184,6 +32188,23 @@ } } }, + "v1AwsHybridMachinePool": { + "description": "Machine pool reference of cloud config of cluster deployed by hybrid cluster", + "type": "object", + "properties": { + "poolCloudType": { + "$ref": "#/definitions/v1HybridPoolClusterCloudType" + }, + "poolName": { + "description": "Machine pool name", + "type": "string" + }, + "poolUid": { + "description": "Machine pool uid", + "type": "string" + } + } + }, "v1AwsIamPolicy": { "description": "Aws policy", "type": "object", @@ -33934,7 +33955,11 @@ "includeAllDisks": { "type": "boolean" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "namespaces": { @@ -34340,8 +34365,15 @@ "cloudType": { "type": "string" }, + "hybridMachinePools": { + "description": "Hybrid Machine pools meta information", + "type": "array", + "items": { + "$ref": "#/definitions/v1MachinePoolMeta" + } + }, "machinePools": { - "description": "Machine pool meta information", + "description": "Machine pools meta information", "type": "array", "items": { "$ref": "#/definitions/v1MachinePoolMeta" @@ -34540,7 +34572,11 @@ "includeAllDisks": { "type": "boolean" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "locationType": { @@ -36901,7 +36937,11 @@ "destinationClusterUid": { "type": "string" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "includeNamespaces": { @@ -39014,6 +39054,24 @@ } } }, + "v1EdgeClusterObjectEntity": { + "description": "Object identity meta of the cluster", + "type": "object", + "properties": { + "hybridCluster": { + "description": "In case of hybrid edge clusters, it provides the object identity meta of hybrid cluster", + "$ref": "#/definitions/v1HybridClusterMeta" + }, + "name": { + "description": "Name of the cluster", + "type": "string" + }, + "uid": { + "description": "Uid of the cluster", + "type": "string" + } + } + }, "v1EdgeHost": { "description": "EdgeHost is the underlying appliance", "type": "object", @@ -39198,11 +39256,18 @@ "$ref": "#/definitions/v1EdgeHostHealth" }, "inUseClusters": { + "description": "Deprecated. Use inUseClustersRef", "type": "array", "items": { "$ref": "#/definitions/v1ObjectEntity" } }, + "inUseClustersRef": { + "type": "array", + "items": { + "$ref": "#/definitions/v1EdgeClusterObjectEntity" + } + }, "packs": { "type": "array", "items": { @@ -39505,11 +39570,18 @@ "$ref": "#/definitions/v1EdgeHostHealth" }, "inUseClusters": { + "description": "Deprecated. Use inUseClustersRef", "type": "array", "items": { "$ref": "#/definitions/v1ObjectEntity" } }, + "inUseClustersRef": { + "type": "array", + "items": { + "$ref": "#/definitions/v1EdgeClusterObjectEntity" + } + }, "state": { "$ref": "#/definitions/v1EdgeHostState" } @@ -40392,23 +40464,6 @@ } } }, - "v1EksHybridMachinePool": { - "description": "Machine pool reference of cloud config of cluster deployed by hybrid EKS cluster", - "type": "object", - "properties": { - "poolCloudType": { - "$ref": "#/definitions/v1HybridPoolClusterCloudType" - }, - "poolName": { - "description": "Machine pool name", - "type": "string" - }, - "poolUid": { - "description": "Machine pool uid", - "type": "string" - } - } - }, "v1EksMachineCloudConfigEntity": { "properties": { "awsLaunchTemplate": { @@ -42357,11 +42412,16 @@ } } }, - "v1HybridEdgeNativeClusterConfigEntity": { - "description": "Hybrid Edge-Native cluster's configuration request payload", + "v1HybridClusterMeta": { + "description": "Object identity meta of hybrid cluster", "properties": { - "clusterConfig": { - "$ref": "#/definitions/v1EdgeNativeHybridClusterConfig" + "name": { + "description": "Name of the hybrid cluster", + "type": "string" + }, + "uid": { + "description": "Uid of the hybrid cluster", + "type": "string" } } }, @@ -42418,11 +42478,68 @@ "cloudConfig": { "$ref": "#/definitions/v1EdgeNativeHybridMachineConfigEntity" }, + "clusterConfig": { + "$ref": "#/definitions/v1EdgeNativeHybridClusterConfig" + }, "poolConfig": { "$ref": "#/definitions/v1MachinePoolConfigEntity" } } }, + "v1HybridMachinePool": { + "description": "Metadata information related to a hybrid machine pool launched as part of an hybrid cluster", + "properties": { + "cloudConfigUid": { + "description": "Cloud config uid associated with the hybrid machine pool", + "type": "string" + }, + "cloudType": { + "description": "Cloud type of the hybrid machine pool", + "type": "string" + }, + "clusterUid": { + "description": "Uid of the hybrid machine pool cluster", + "type": "string" + }, + "name": { + "description": "Name of the hybrid machine pool", + "type": "string" + }, + "status": { + "$ref": "#/definitions/v1HybridMachinePoolStatus" + }, + "uid": { + "description": "Uid of the hybrid machine pool", + "type": "string" + } + } + }, + "v1HybridMachinePoolClusterHealth": { + "description": "Machine pool cluster meta health information", + "type": "object", + "properties": { + "isHeartBeatFailed": { + "type": "boolean", + "x-omitempty": false + }, + "state": { + "type": "string" + } + } + }, + "v1HybridMachinePoolStatus": { + "description": "Get the hybrid machine pool's cluster status", + "properties": { + "health": { + "description": "Health of the hybrid machine pool", + "$ref": "#/definitions/v1HybridMachinePoolClusterHealth" + }, + "state": { + "description": "State of the hybrid machine pool", + "type": "string" + } + } + }, "v1HybridPoolClusterCloudType": { "description": "Flag to indicate whether the pool is deployed in any cloud or an edge environment", "type": "string", @@ -42553,6 +42670,15 @@ } } }, + "v1IncludeClusterResourceMode": { + "description": "Specifies the scope of cluster-wide resources to include in the backup based on the flag'--include-cluster-resources':\n- \"Always\": --include-cluster-resources=true, which includes all cluster-wide resources; restores only on the original cluster.\n- \"Auto\": don't specify --include-cluster-resources, which exclude general cluster-wide resources, but includes PersistentVolumes linked to selected namespaces.\n- \"Never\": --include-cluster-resources=false, exclude all cluster-wide resources, including PersistentVolumes.\n", + "type": "string", + "enum": [ + "Always", + "Auto", + "Never" + ] + }, "v1InfraLBConfig": { "type": "object", "properties": { @@ -47214,7 +47340,8 @@ "enum": [ "spectro", "helm", - "manifest" + "manifest", + "oci" ] }, "values": { @@ -51104,6 +51231,33 @@ } } }, + "v1SpectroClusterHybridPoolsMetadata": { + "description": "Metadata of clusters launched as hybrid machine pools", + "type": "object", + "properties": { + "metadata": { + "$ref": "#/definitions/v1ObjectMeta" + }, + "spec": { + "type": "object", + "properties": { + "cloudType": { + "description": "Cluster's cloud type", + "type": "string" + }, + "hybridPools": { + "type": "array", + "items": { + "$ref": "#/definitions/v1HybridMachinePool" + } + } + } + }, + "status": { + "$ref": "#/definitions/v1SpectroClusterStatus" + } + } + }, "v1SpectroClusterK8sCertificate": { "description": "K8 Certificates for all the cluster's control plane nodes", "type": "object", @@ -51951,6 +52105,17 @@ } } }, + "v1SpectroClusterTags": { + "type": "object", + "properties": { + "tags": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "v1SpectroClusterUidStatusSummary": { "description": "Spectro cluster status summary", "properties": { @@ -53053,6 +53218,14 @@ "name": { "type": "string" }, + "networkSecurityGroup": { + "description": "Network security group of the subnet", + "type": "string" + }, + "resourceGroup": { + "description": "Resource group associated with a subnet", + "type": "string" + }, "securityGroupName": { "description": "Network Security Group(NSG) to be attached to subnet. NSG for a control plane subnet, should allow inbound to port 6443, as port 6443 is used by kubeadm to bootstrap the control planes", "type": "string" @@ -60397,7 +60570,11 @@ "includeAllDisks": { "type": "boolean" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "namespaces": { @@ -60921,7 +61098,11 @@ "backupName": { "type": "string" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "includeNamespaces": { diff --git a/api/spec/palette.json b/api/spec/palette.json index d15e85b9..ef73dcf3 100644 --- a/api/spec/palette.json +++ b/api/spec/palette.json @@ -4056,45 +4056,6 @@ } ] }, - "/v1/cloudconfigs/aws/{configUid}/edge-native/machinePools/{machinePoolName}/clusterConfig": { - "put": { - "tags": [ - "v1" - ], - "summary": "Updates the cluster configuration information of Edge-Native cluster deployed through Hybrid AWS cluster", - "operationId": "v1AwsCloudConfigsEdgeNativeUidClusterConfig", - "parameters": [ - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/v1HybridEdgeNativeClusterConfigEntity" - } - } - ], - "responses": { - "204": { - "description": "The resource was updated successfully" - } - } - }, - "parameters": [ - { - "type": "string", - "description": "Hybrid AWS Cluster's cloud config uid", - "name": "configUid", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Edge-Native machine pool name", - "name": "machinePoolName", - "in": "path", - "required": true - } - ] - }, "/v1/cloudconfigs/aws/{configUid}/machinePools": { "post": { "tags": [ @@ -13465,7 +13426,7 @@ ], "responses": { "200": { - "description": "An array of edgehost summary items", + "description": "An array of edgenative pair summary items", "schema": { "$ref": "#/definitions/v1EdgeHostsMetadataSummary" } @@ -13731,7 +13692,7 @@ ], "responses": { "200": { - "description": "An array of edgehost summary items", + "description": "An array of edgenative pair summary items", "schema": { "$ref": "#/definitions/v1EdgeHostsSearchSummary" } @@ -21570,6 +21531,23 @@ } } }, + "/v1/spectroclusters/tags": { + "get": { + "tags": [ + "v1" + ], + "summary": "Retrieves a list of spectrocluster tags", + "operationId": "v1SpectroClustersTagsGet", + "responses": { + "200": { + "description": "An array of spectrocluster tags", + "schema": { + "$ref": "#/definitions/v1SpectroClusterTags" + } + } + } + } + }, "/v1/spectroclusters/tke": { "post": { "tags": [ @@ -23808,6 +23786,32 @@ } ] }, + "/v1/spectroclusters/{uid}/hybridPools/metadata": { + "get": { + "tags": [ + "v1" + ], + "summary": "Returns the metadata of all hybrid pools associated with the specified cluster", + "operationId": "v1SpectroClustersGetHybridPoolsMetadata", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1SpectroClusterHybridPoolsMetadata" + } + } + } + }, + "parameters": [ + { + "type": "string", + "description": "Cluster uid", + "name": "uid", + "in": "path", + "required": true + } + ] + }, "/v1/spectroclusters/{uid}/hybridSettings": { "patch": { "tags": [ @@ -31961,7 +31965,7 @@ "hybridMachinePools": { "type": "array", "items": { - "$ref": "#/definitions/v1EksHybridMachinePool" + "$ref": "#/definitions/v1AwsHybridMachinePool" } }, "machinePoolConfig": { @@ -32201,6 +32205,23 @@ } } }, + "v1AwsHybridMachinePool": { + "description": "Machine pool reference of cloud config of cluster deployed by hybrid cluster", + "type": "object", + "properties": { + "poolCloudType": { + "$ref": "#/definitions/v1HybridPoolClusterCloudType" + }, + "poolName": { + "description": "Machine pool name", + "type": "string" + }, + "poolUid": { + "description": "Machine pool uid", + "type": "string" + } + } + }, "v1AwsIamPolicy": { "description": "Aws policy", "type": "object", @@ -33951,7 +33972,11 @@ "includeAllDisks": { "type": "boolean" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "namespaces": { @@ -34357,8 +34382,15 @@ "cloudType": { "type": "string" }, + "hybridMachinePools": { + "description": "Hybrid Machine pools meta information", + "type": "array", + "items": { + "$ref": "#/definitions/v1MachinePoolMeta" + } + }, "machinePools": { - "description": "Machine pool meta information", + "description": "Machine pools meta information", "type": "array", "items": { "$ref": "#/definitions/v1MachinePoolMeta" @@ -34557,7 +34589,11 @@ "includeAllDisks": { "type": "boolean" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "locationType": { @@ -36918,7 +36954,11 @@ "destinationClusterUid": { "type": "string" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "includeNamespaces": { @@ -39031,6 +39071,24 @@ } } }, + "v1EdgeClusterObjectEntity": { + "description": "Object identity meta of the cluster", + "type": "object", + "properties": { + "hybridCluster": { + "description": "In case of hybrid edge clusters, it provides the object identity meta of hybrid cluster", + "$ref": "#/definitions/v1HybridClusterMeta" + }, + "name": { + "description": "Name of the cluster", + "type": "string" + }, + "uid": { + "description": "Uid of the cluster", + "type": "string" + } + } + }, "v1EdgeHost": { "description": "EdgeHost is the underlying appliance", "type": "object", @@ -39215,11 +39273,18 @@ "$ref": "#/definitions/v1EdgeHostHealth" }, "inUseClusters": { + "description": "Deprecated. Use inUseClustersRef", "type": "array", "items": { "$ref": "#/definitions/v1ObjectEntity" } }, + "inUseClustersRef": { + "type": "array", + "items": { + "$ref": "#/definitions/v1EdgeClusterObjectEntity" + } + }, "packs": { "type": "array", "items": { @@ -39522,11 +39587,18 @@ "$ref": "#/definitions/v1EdgeHostHealth" }, "inUseClusters": { + "description": "Deprecated. Use inUseClustersRef", "type": "array", "items": { "$ref": "#/definitions/v1ObjectEntity" } }, + "inUseClustersRef": { + "type": "array", + "items": { + "$ref": "#/definitions/v1EdgeClusterObjectEntity" + } + }, "state": { "$ref": "#/definitions/v1EdgeHostState" } @@ -40409,23 +40481,6 @@ } } }, - "v1EksHybridMachinePool": { - "description": "Machine pool reference of cloud config of cluster deployed by hybrid EKS cluster", - "type": "object", - "properties": { - "poolCloudType": { - "$ref": "#/definitions/v1HybridPoolClusterCloudType" - }, - "poolName": { - "description": "Machine pool name", - "type": "string" - }, - "poolUid": { - "description": "Machine pool uid", - "type": "string" - } - } - }, "v1EksMachineCloudConfigEntity": { "properties": { "awsLaunchTemplate": { @@ -42374,11 +42429,16 @@ } } }, - "v1HybridEdgeNativeClusterConfigEntity": { - "description": "Hybrid Edge-Native cluster's configuration request payload", + "v1HybridClusterMeta": { + "description": "Object identity meta of hybrid cluster", "properties": { - "clusterConfig": { - "$ref": "#/definitions/v1EdgeNativeHybridClusterConfig" + "name": { + "description": "Name of the hybrid cluster", + "type": "string" + }, + "uid": { + "description": "Uid of the hybrid cluster", + "type": "string" } } }, @@ -42435,11 +42495,68 @@ "cloudConfig": { "$ref": "#/definitions/v1EdgeNativeHybridMachineConfigEntity" }, + "clusterConfig": { + "$ref": "#/definitions/v1EdgeNativeHybridClusterConfig" + }, "poolConfig": { "$ref": "#/definitions/v1MachinePoolConfigEntity" } } }, + "v1HybridMachinePool": { + "description": "Metadata information related to a hybrid machine pool launched as part of an hybrid cluster", + "properties": { + "cloudConfigUid": { + "description": "Cloud config uid associated with the hybrid machine pool", + "type": "string" + }, + "cloudType": { + "description": "Cloud type of the hybrid machine pool", + "type": "string" + }, + "clusterUid": { + "description": "Uid of the hybrid machine pool cluster", + "type": "string" + }, + "name": { + "description": "Name of the hybrid machine pool", + "type": "string" + }, + "status": { + "$ref": "#/definitions/v1HybridMachinePoolStatus" + }, + "uid": { + "description": "Uid of the hybrid machine pool", + "type": "string" + } + } + }, + "v1HybridMachinePoolClusterHealth": { + "description": "Machine pool cluster meta health information", + "type": "object", + "properties": { + "isHeartBeatFailed": { + "type": "boolean", + "x-omitempty": false + }, + "state": { + "type": "string" + } + } + }, + "v1HybridMachinePoolStatus": { + "description": "Get the hybrid machine pool's cluster status", + "properties": { + "health": { + "description": "Health of the hybrid machine pool", + "$ref": "#/definitions/v1HybridMachinePoolClusterHealth" + }, + "state": { + "description": "State of the hybrid machine pool", + "type": "string" + } + } + }, "v1HybridPoolClusterCloudType": { "description": "Flag to indicate whether the pool is deployed in any cloud or an edge environment", "type": "string", @@ -42570,6 +42687,15 @@ } } }, + "v1IncludeClusterResourceMode": { + "description": "Specifies the scope of cluster-wide resources to include in the backup based on the flag'--include-cluster-resources':\n- \"Always\": --include-cluster-resources=true, which includes all cluster-wide resources; restores only on the original cluster.\n- \"Auto\": don't specify --include-cluster-resources, which exclude general cluster-wide resources, but includes PersistentVolumes linked to selected namespaces.\n- \"Never\": --include-cluster-resources=false, exclude all cluster-wide resources, including PersistentVolumes.\n", + "type": "string", + "enum": [ + "Always", + "Auto", + "Never" + ] + }, "v1InfraLBConfig": { "type": "object", "properties": { @@ -47231,7 +47357,8 @@ "enum": [ "spectro", "helm", - "manifest" + "manifest", + "oci" ] }, "values": { @@ -51121,6 +51248,33 @@ } } }, + "v1SpectroClusterHybridPoolsMetadata": { + "description": "Metadata of clusters launched as hybrid machine pools", + "type": "object", + "properties": { + "metadata": { + "$ref": "#/definitions/v1ObjectMeta" + }, + "spec": { + "type": "object", + "properties": { + "cloudType": { + "description": "Cluster's cloud type", + "type": "string" + }, + "hybridPools": { + "type": "array", + "items": { + "$ref": "#/definitions/v1HybridMachinePool" + } + } + } + }, + "status": { + "$ref": "#/definitions/v1SpectroClusterStatus" + } + } + }, "v1SpectroClusterK8sCertificate": { "description": "K8 Certificates for all the cluster's control plane nodes", "type": "object", @@ -51968,6 +52122,17 @@ } } }, + "v1SpectroClusterTags": { + "type": "object", + "properties": { + "tags": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "v1SpectroClusterUidStatusSummary": { "description": "Spectro cluster status summary", "properties": { @@ -53070,6 +53235,14 @@ "name": { "type": "string" }, + "networkSecurityGroup": { + "description": "Network security group of the subnet", + "type": "string" + }, + "resourceGroup": { + "description": "Resource group associated with a subnet", + "type": "string" + }, "securityGroupName": { "description": "Network Security Group(NSG) to be attached to subnet. NSG for a control plane subnet, should allow inbound to port 6443, as port 6443 is used by kubeadm to bootstrap the control planes", "type": "string" @@ -60414,7 +60587,11 @@ "includeAllDisks": { "type": "boolean" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "namespaces": { @@ -60938,7 +61115,11 @@ "backupName": { "type": "string" }, + "includeClusterResourceMode": { + "$ref": "#/definitions/v1IncludeClusterResourceMode" + }, "includeClusterResources": { + "description": "Deprecated. Use includeClusterResourceMode", "type": "boolean" }, "includeNamespaces": { diff --git a/client/hybrid.go b/client/hybrid.go new file mode 100644 index 00000000..b48533ac --- /dev/null +++ b/client/hybrid.go @@ -0,0 +1,72 @@ +package client + +import ( + clientv1 "github.com/spectrocloud/palette-sdk-go/api/client/v1" + "github.com/spectrocloud/palette-sdk-go/api/models" +) + +// EnableClusterHybridSettings enables hybrid mode on a cluster. +func (h *V1Client) EnableClusterHybridSettings(uid string) error { + params := clientv1.NewV1SpectroClustersUIDHybridSettingsParamsWithContext(h.ctx). + WithBody(&models.V1ClusterHybridSettingsEntity{ + Enable: true, + }).WithUID(uid) + + _, err := h.Client.V1SpectroClustersUIDHybridSettings(params) + return err +} + +// PutAwsHybridConfig updates the AWS hybrid config for a cluster. +func (h *V1Client) PutAwsHybridConfig(configUID string, hybridConfig *models.V1AwsCloudHybridConfigEntity) error { + params := clientv1.NewV1AwsCloudConfigsUIDHybridConfigParamsWithContext(h.ctx). + WithBody(hybridConfig). + WithConfigUID(configUID) + + _, err := h.Client.V1AwsCloudConfigsUIDHybridConfig(params) + return err +} + +// GetAwsHybridMachinePool returns the specified AWS Cluster's Edge-Native machine pool configuration +func (h *V1Client) GetAwsHybridMachinePool(configUID, machinePoolName string) (*models.V1HybridEdgeNativeMachinePoolConfig, error) { + params := clientv1.NewV1AwsCloudConfigsEdgeNativeMachinePoolGetParamsWithContext(h.ctx). + WithConfigUID(configUID). + WithMachinePoolName(machinePoolName) + + resp, err := h.Client.V1AwsCloudConfigsEdgeNativeMachinePoolGet(params) + if err != nil { + return nil, err + } + + return resp.Payload, nil +} + +// CreateAwsHybridMachinePool creates a Hybrid AWS cloud config's Edge-Native machine pool +func (h *V1Client) CreateAwsHybridMachinePool(configUID string, machinePoolConfig *models.V1HybridEdgeNativeMachinePoolConfigEntity) error { + params := clientv1.NewV1AwsCloudConfigsEdgeNativeUIDMachinePoolCreateParamsWithContext(h.ctx). + WithBody(machinePoolConfig). + WithConfigUID(configUID) + + _, err := h.Client.V1AwsCloudConfigsEdgeNativeUIDMachinePoolCreate(params) + return err +} + +// UpdateAwsHybridMachinePool updates the specified Hybrid AWS cluster cloud config's Edge-Native machine pool +func (h *V1Client) UpdateAwsHybridMachinePool(configUID, machinePoolName string, machinePoolConfig *models.V1HybridEdgeNativeMachinePoolConfigUpdateEntity) error { + params := clientv1.NewV1AwsCloudConfigsEdgeNativeMachinePoolUpdateParamsWithContext(h.ctx). + WithBody(machinePoolConfig). + WithMachinePoolName(machinePoolName). + WithConfigUID(configUID) + + _, err := h.Client.V1AwsCloudConfigsEdgeNativeMachinePoolUpdate(params) + return err +} + +// DeleteAwsHybridMachinePool deletes the specified Edge-Native machine pool of hybrid AWS cluster +func (h *V1Client) DeleteAwsHybridMachinePool(configUID, machinePoolName string) error { + params := clientv1.NewV1AwsCloudConfigsEdgeNativeMachinePoolDeleteParamsWithContext(h.ctx). + WithMachinePoolName(machinePoolName). + WithConfigUID(configUID) + + _, err := h.Client.V1AwsCloudConfigsEdgeNativeMachinePoolDelete(params) + return err +}