diff --git a/api/models/v1_aws_cloud_config_spec.go b/api/models/v1_aws_cloud_config_spec.go index b810c97..ab1fe42 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 0000000..f2c5653 --- /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/spec/palette-apis-spec.json b/api/spec/palette-apis-spec.json index d2e31bf..d6b6ff2 100644 --- a/api/spec/palette-apis-spec.json +++ b/api/spec/palette-apis-spec.json @@ -31944,7 +31944,7 @@ "hybridMachinePools": { "type": "array", "items": { - "$ref": "#/definitions/v1EksHybridMachinePool" + "$ref": "#/definitions/v1AwsHybridMachinePool" } }, "machinePoolConfig": { @@ -32184,6 +32184,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", @@ -40392,23 +40409,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": { diff --git a/api/spec/palette.json b/api/spec/palette.json index d15e85b..a245ddc 100644 --- a/api/spec/palette.json +++ b/api/spec/palette.json @@ -31961,7 +31961,7 @@ "hybridMachinePools": { "type": "array", "items": { - "$ref": "#/definitions/v1EksHybridMachinePool" + "$ref": "#/definitions/v1AwsHybridMachinePool" } }, "machinePoolConfig": { @@ -32201,6 +32201,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", @@ -40409,23 +40426,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": { diff --git a/client/hybrid.go b/client/hybrid.go new file mode 100644 index 0000000..11db8b6 --- /dev/null +++ b/client/hybrid.go @@ -0,0 +1,17 @@ +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 +}