From cc52062851ced2f21baa52bbae857508ee431645 Mon Sep 17 00:00:00 2001 From: Inel Pandzic Date: Fri, 6 Dec 2024 13:26:23 +0100 Subject: [PATCH] K8SPXC-377: Add VS support and bug fix (#1882) * Send UserManagementEnabled to VS. * Set default VS_BRANCH env var value. * Fix updated user check. Add validation for empty username. * Check properly user secret pass hash. * Return nil if user is not found in the DB. * Fix checking if rows is empty and update e2e test. * Fix checking for empty rows. * Fix e2e test. * Fix comparing hosts and dbs. --------- Co-authored-by: Viacheslav Sarzhan --- Makefile | 17 + e2e-tests/custom-users/run | 11 +- pkg/controller/pxc/users_custom.go | 36 +- pkg/controller/pxc/version.go | 23 +- pkg/controller/pxc/vs.go | 56 +-- pkg/pxc/users/users.go | 7 + version/client/models/googlerpc_status.go | 5 + version/client/models/protobuf_any.go | 190 +++++------ .../version_get_release_notes_response.go | 56 +++ .../models/version_metadata_response.go | 121 +++++++ .../models/version_metadata_v2_response.go | 121 +++++++ .../models/version_metadata_v2_version.go | 118 +++++++ .../client/models/version_metadata_version.go | 56 +++ .../models/version_operator_response.go | 5 + .../client/models/version_operator_version.go | 5 + .../client/models/version_product_response.go | 5 + version/client/models/version_version.go | 8 + .../client/models/version_version_matrix.go | 104 ++++++ .../client/models/version_version_response.go | 5 + version/client/models/version_version_v2.go | 142 ++++++++ .../version_service_apply_parameters.go | 318 +++++++++++++++++- .../version_service_apply_responses.go | 76 ++++- .../version_service/version_service_client.go | 151 ++++++++- ...on_service_get_release_notes_parameters.go | 173 ++++++++++ ...ion_service_get_release_notes_responses.go | 187 ++++++++++ .../version_service_metadata_parameters.go | 148 ++++++++ .../version_service_metadata_responses.go | 187 ++++++++++ .../version_service_metadata_v2_parameters.go | 148 ++++++++ .../version_service_metadata_v2_responses.go | 187 ++++++++++ .../version_service_operator_parameters.go | 318 +++++++++++++++++- .../version_service_operator_responses.go | 76 ++++- .../version_service_product_parameters.go | 318 +++++++++++++++++- .../version_service_product_responses.go | 76 ++++- 33 files changed, 3257 insertions(+), 197 deletions(-) create mode 100644 version/client/models/version_get_release_notes_response.go create mode 100644 version/client/models/version_metadata_response.go create mode 100644 version/client/models/version_metadata_v2_response.go create mode 100644 version/client/models/version_metadata_v2_version.go create mode 100644 version/client/models/version_metadata_version.go create mode 100644 version/client/models/version_version_v2.go create mode 100644 version/client/version_service/version_service_get_release_notes_parameters.go create mode 100644 version/client/version_service/version_service_get_release_notes_responses.go create mode 100644 version/client/version_service/version_service_metadata_parameters.go create mode 100644 version/client/version_service/version_service_metadata_responses.go create mode 100644 version/client/version_service/version_service_metadata_v2_parameters.go create mode 100644 version/client/version_service/version_service_metadata_v2_responses.go diff --git a/Makefile b/Makefile index 1d806c99da..4a97bea173 100644 --- a/Makefile +++ b/Makefile @@ -101,6 +101,10 @@ ENVTEST = $(shell pwd)/bin/setup-envtest envtest: ## Download envtest-setup locally if necessary. $(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest) +SWAGGER = $(shell pwd)/bin/swagger +swagger: ## Download swagger locally if necessary. + $(call go-get-tool,$(SWAGGER),github.com/go-swagger/go-swagger/cmd/swagger@latest) + # Prepare release CERT_MANAGER_VER := $(shell grep -Eo "cert-manager v.*" go.mod|grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") release: manifests @@ -141,3 +145,16 @@ after-release: manifests -e "/^ backup:/,/^ image:/{s#image: .*#image: perconalab/percona-xtradb-cluster-operator:main-pxc8.0-backup#}" \ -e "/initContainer:/,/image:/{s#image: .*#image: perconalab/percona-xtradb-cluster-operator:main#}" \ -e "/^ pmm:/,/^ image:/{s#image: .*#image: perconalab/pmm-client:dev-latest#}" deploy/cr.yaml + +VS_BRANCH = main +version-service-client: swagger + curl https://raw.githubusercontent.com/Percona-Lab/percona-version-service/$(VS_BRANCH)/api/version.swagger.yaml \ + --output ./version.swagger.yaml + rm -rf ./version/client + mkdir -p ./version/client/models + mkdir -p ./version/client/version_service + ./bin/swagger generate client \ + -f ./version.swagger.yaml \ + -c ./version/client \ + -m ./version/client/models + rm ./version.swagger.yaml diff --git a/e2e-tests/custom-users/run b/e2e-tests/custom-users/run index 3de89a325b..34502abab5 100755 --- a/e2e-tests/custom-users/run +++ b/e2e-tests/custom-users/run @@ -37,6 +37,15 @@ compare_mysql_user "-h $cluster-haproxy -uuser-one -pnew-password" compare_mysql_cmd "user-one-1" "SELECT User, Host from mysql.user WHERE User = 'user-one';" "-h $cluster-haproxy -uroot -proot_password" compare_mysql_cmd "user-one-2" "SHOW GRANTS FOR 'user-one'@'127.0.0.1';" "-h $cluster-haproxy -uroot -proot_password" +desc 'check removing secretPasswordRef from user generates user password stored in generated custom-user-secret' +kubectl_bin patch pxc some-name \ + --type=json \ + -p='[{"op": "replace", "path": "/spec/users/1/passwordSecretRef", "value": null}]' +wait_cluster_consistency "$cluster" 3 3 + +userTwoPass=$(kubectl_bin get secret $generatedUserSecret -o jsonpath="{.data.user-two}" | base64 -d) +compare_mysql_user "-h $cluster-haproxy -uuser-two -p'$userTwoPass'" + desc 'delete initial users from CR and create a new one' kubectl_bin patch pxc some-name --type=merge -p='{ "spec": {"users":[ @@ -57,7 +66,7 @@ compare_mysql_cmd "user-four-1" "SELECT User, Host from mysql.user WHERE User = # user-one, user-two and three should not be deleted compare_mysql_user "-h $cluster-haproxy -uuser-one -pnew-password" -compare_mysql_user "-h $cluster-haproxy -uuser-two -ptestpass3" +compare_mysql_user "-h $cluster-haproxy -uuser-two -p'$userTwoPass'" desc 'check user DBs updated' kubectl_bin patch pxc some-name --type=merge -p='{ diff --git a/pkg/controller/pxc/users_custom.go b/pkg/controller/pxc/users_custom.go index 85efb9f883..0dc8803746 100644 --- a/pkg/controller/pxc/users_custom.go +++ b/pkg/controller/pxc/users_custom.go @@ -51,6 +51,11 @@ func (r *ReconcilePerconaXtraDBCluster) reconcileCustomUsers(ctx context.Context sysUserNames := sysUserNames() for _, user := range cr.Spec.Users { + if user.Name == "" { + log.Error(nil, "user name is not set", "user", user) + continue + } + if _, ok := sysUserNames[user.Name]; ok { log.Error(nil, "creating user with reserved user name is forbidden", "user", user.Name) continue @@ -91,7 +96,13 @@ func (r *ReconcilePerconaXtraDBCluster) reconcileCustomUsers(ctx context.Context annotationKey := fmt.Sprintf("percona.com/%s-%s-hash", cr.Name, user.Name) - if userPasswordChanged(userSecret, annotationKey, userSecretPassKey) { + u, err := um.GetUser(ctx, user.Name) + if err != nil { + log.Error(err, "failed to get user", "user", user) + continue + } + + if userPasswordChanged(userSecret, u, annotationKey, userSecretPassKey) { log.Info("User password changed", "user", user.Name) err := um.UpsertUser(ctx, alterUserQuery(&user), string(userSecret.Data[userSecretPassKey])) @@ -109,12 +120,6 @@ func (r *ReconcilePerconaXtraDBCluster) reconcileCustomUsers(ctx context.Context log.Info("User password updated", "user", user.Name) } - u, err := um.GetUser(ctx, user.Name) - if err != nil { - log.Error(err, "failed to get user", "user", user) - continue - } - if userChanged(u, &user, log) { log.Info("Creating/updating user", "user", user.Name) @@ -165,18 +170,19 @@ func generateUserPass( return nil } -func userPasswordChanged(secret *corev1.Secret, key, passKey string) bool { +func userPasswordChanged(secret *corev1.Secret, dbUser *users.User, key, passKey string) bool { if secret.Annotations == nil { return false } hash, ok := secret.Annotations[key] if !ok { - return false + // If annotation is not present in the secret and the user is created (not nil), + // we assume that password has changed. + return dbUser != nil } newHash := sha256Hash(secret.Data[passKey]) - return hash != newHash } @@ -188,16 +194,6 @@ func userChanged(current *users.User, desired *api.User, log logr.Logger) bool { return true } - if len(current.Hosts) != len(desired.Hosts) { - log.Info("Hosts changed", "current", current.Hosts, "desired", desired.Hosts, "user", userName) - return true - } - - if len(current.DBs) != len(desired.DBs) { - log.Info("DBs changed", "current", current.DBs, "desired", desired.DBs) - return true - } - for _, u := range desired.Hosts { if !current.Hosts.Has(u) { log.Info("Hosts changed", "current", current.Hosts, "desired", desired.Hosts, "user", userName) diff --git a/pkg/controller/pxc/version.go b/pkg/controller/pxc/version.go index d239f350f4..e922cf6cff 100644 --- a/pkg/controller/pxc/version.go +++ b/pkg/controller/pxc/version.go @@ -237,17 +237,18 @@ func (r *ReconcilePerconaXtraDBCluster) getNewVersions(ctx context.Context, cr * } vm := versionMeta{ - Apply: cr.Spec.UpgradeOptions.Apply, - Platform: string(cr.Spec.Platform), - KubeVersion: r.serverVersion.Info.GitVersion, - PXCVersion: cr.Status.PXC.Version, - PMMVersion: cr.Status.PMM.Version, - HAProxyVersion: cr.Status.HAProxy.Version, - ProxySQLVersion: cr.Status.ProxySQL.Version, - BackupVersion: cr.Status.Backup.Version, - LogCollectorVersion: cr.Status.LogCollector.Version, - CRUID: string(cr.GetUID()), - ClusterWideEnabled: watchNs == "", + Apply: cr.Spec.UpgradeOptions.Apply, + Platform: string(cr.Spec.Platform), + KubeVersion: r.serverVersion.Info.GitVersion, + PXCVersion: cr.Status.PXC.Version, + PMMVersion: cr.Status.PMM.Version, + HAProxyVersion: cr.Status.HAProxy.Version, + ProxySQLVersion: cr.Status.ProxySQL.Version, + BackupVersion: cr.Status.Backup.Version, + LogCollectorVersion: cr.Status.LogCollector.Version, + CRUID: string(cr.GetUID()), + ClusterWideEnabled: watchNs == "", + UserManagementEnabled: len(cr.Spec.Users) > 0, } endpoint := apiv1.GetDefaultVersionServiceEndpoint() diff --git a/pkg/controller/pxc/vs.go b/pkg/controller/pxc/vs.go index 8356b917ee..577e1114e9 100644 --- a/pkg/controller/pxc/vs.go +++ b/pkg/controller/pxc/vs.go @@ -31,22 +31,23 @@ func (vs VersionServiceClient) GetExactVersion(cr *api.PerconaXtraDBCluster, end }) applyParams := &version_service.VersionServiceApplyParams{ - Apply: vm.Apply, - BackupVersion: &vm.BackupVersion, - CustomResourceUID: &vm.CRUID, - DatabaseVersion: &vm.PXCVersion, - HaproxyVersion: &vm.HAProxyVersion, - KubeVersion: &vm.KubeVersion, - LogCollectorVersion: &vm.LogCollectorVersion, - NamespaceUID: new(string), - OperatorVersion: cr.Spec.CRVersion, - Platform: &vm.Platform, - PmmVersion: &vm.PMMVersion, - Product: productName, - ProxysqlVersion: &vm.ProxySQLVersion, - Context: nil, - ClusterWideEnabled: &vm.ClusterWideEnabled, - HTTPClient: &http.Client{Timeout: 10 * time.Second}, + Apply: vm.Apply, + BackupVersion: &vm.BackupVersion, + CustomResourceUID: &vm.CRUID, + DatabaseVersion: &vm.PXCVersion, + HaproxyVersion: &vm.HAProxyVersion, + KubeVersion: &vm.KubeVersion, + LogCollectorVersion: &vm.LogCollectorVersion, + NamespaceUID: new(string), + OperatorVersion: cr.Spec.CRVersion, + Platform: &vm.Platform, + PmmVersion: &vm.PMMVersion, + Product: productName, + ProxysqlVersion: &vm.ProxySQLVersion, + Context: nil, + ClusterWideEnabled: &vm.ClusterWideEnabled, + HTTPClient: &http.Client{Timeout: 10 * time.Second}, + UserManagementEnabled: &vm.UserManagementEnabled, } applyParams = applyParams.WithTimeout(10 * time.Second) @@ -151,15 +152,16 @@ type VersionServiceClient struct { } type versionMeta struct { - Apply string - PXCVersion string - KubeVersion string - Platform string - PMMVersion string - BackupVersion string - ProxySQLVersion string - HAProxyVersion string - LogCollectorVersion string - CRUID string - ClusterWideEnabled bool + Apply string + PXCVersion string + KubeVersion string + Platform string + PMMVersion string + BackupVersion string + ProxySQLVersion string + HAProxyVersion string + LogCollectorVersion string + CRUID string + ClusterWideEnabled bool + UserManagementEnabled bool } diff --git a/pkg/pxc/users/users.go b/pkg/pxc/users/users.go index 4bf2218837..ec1555ae2c 100644 --- a/pkg/pxc/users/users.go +++ b/pkg/pxc/users/users.go @@ -335,6 +335,8 @@ func (p *Manager) GetUser(ctx context.Context, user string) (*User, error) { if err != nil { return nil, err } + defer rows.Close() + for rows.Next() { var host string var db sql.NullString @@ -349,11 +351,16 @@ func (p *Manager) GetUser(ctx context.Context, user string) (*User, error) { u.Hosts.Insert(host) } + if len(u.Hosts) == 0 { + return nil, nil + } + for host := range u.Hosts { rows, err := p.db.QueryContext(ctx, "SHOW GRANTS FOR ?@?", user, host) if err != nil { return nil, err } + // Plus 1 is for the default grant every user has, which is USAGE. grants := make([]string, 0, len(u.DBs)+1) for rows.Next() { var grant string diff --git a/version/client/models/googlerpc_status.go b/version/client/models/googlerpc_status.go index dc0414ab10..2a3a4a9854 100644 --- a/version/client/models/googlerpc_status.go +++ b/version/client/models/googlerpc_status.go @@ -88,6 +88,11 @@ func (m *GooglerpcStatus) contextValidateDetails(ctx context.Context, formats st for i := 0; i < len(m.Details); i++ { if m.Details[i] != nil { + + if swag.IsZero(m.Details[i]) { // not required + return nil + } + if err := m.Details[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("details" + "." + strconv.Itoa(i)) diff --git a/version/client/models/protobuf_any.go b/version/client/models/protobuf_any.go index 4454016000..f25b51ed38 100644 --- a/version/client/models/protobuf_any.go +++ b/version/client/models/protobuf_any.go @@ -7,125 +7,95 @@ package models import ( "context" + "encoding/json" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) -// ProtobufAny `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) -// ... -// foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } +// ProtobufAny protobuf any // // swagger:model protobufAny type ProtobufAny struct { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - TypeURL string `json:"typeUrl,omitempty"` - - // Must be a valid serialized protocol buffer of the above specified type. - // Format: byte - Value strfmt.Base64 `json:"value,omitempty"` + // at type + AtType string `json:"@type,omitempty"` + + // protobuf any + ProtobufAny map[string]interface{} `json:"-"` +} + +// UnmarshalJSON unmarshals this object with additional properties from JSON +func (m *ProtobufAny) UnmarshalJSON(data []byte) error { + // stage 1, bind the properties + var stage1 struct { + + // at type + AtType string `json:"@type,omitempty"` + } + if err := json.Unmarshal(data, &stage1); err != nil { + return err + } + var rcv ProtobufAny + + rcv.AtType = stage1.AtType + *m = rcv + + // stage 2, remove properties and add to map + stage2 := make(map[string]json.RawMessage) + if err := json.Unmarshal(data, &stage2); err != nil { + return err + } + + delete(stage2, "@type") + // stage 3, add additional properties values + if len(stage2) > 0 { + result := make(map[string]interface{}) + for k, v := range stage2 { + var toadd interface{} + if err := json.Unmarshal(v, &toadd); err != nil { + return err + } + result[k] = toadd + } + m.ProtobufAny = result + } + + return nil +} + +// MarshalJSON marshals this object with additional properties into a JSON object +func (m ProtobufAny) MarshalJSON() ([]byte, error) { + var stage1 struct { + + // at type + AtType string `json:"@type,omitempty"` + } + + stage1.AtType = m.AtType + + // make JSON object for known properties + props, err := json.Marshal(stage1) + if err != nil { + return nil, err + } + + if len(m.ProtobufAny) == 0 { // no additional properties + return props, nil + } + + // make JSON object for the additional properties + additional, err := json.Marshal(m.ProtobufAny) + if err != nil { + return nil, err + } + + if len(props) < 3 { // "{}": only additional properties + return additional, nil + } + + // concatenate the 2 objects + return swag.ConcatJSON(props, additional), nil } // Validate validates this protobuf any diff --git a/version/client/models/version_get_release_notes_response.go b/version/client/models/version_get_release_notes_response.go new file mode 100644 index 0000000000..74229dacd0 --- /dev/null +++ b/version/client/models/version_get_release_notes_response.go @@ -0,0 +1,56 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// VersionGetReleaseNotesResponse version get release notes response +// +// swagger:model versionGetReleaseNotesResponse +type VersionGetReleaseNotesResponse struct { + + // The product name. + Product string `json:"product,omitempty"` + + // release_notes is the release note for this version. + ReleaseNote string `json:"releaseNote,omitempty"` + + // version + Version string `json:"version,omitempty"` +} + +// Validate validates this version get release notes response +func (m *VersionGetReleaseNotesResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this version get release notes response based on context it is used +func (m *VersionGetReleaseNotesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VersionGetReleaseNotesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VersionGetReleaseNotesResponse) UnmarshalBinary(b []byte) error { + var res VersionGetReleaseNotesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/version/client/models/version_metadata_response.go b/version/client/models/version_metadata_response.go new file mode 100644 index 0000000000..c5978122fc --- /dev/null +++ b/version/client/models/version_metadata_response.go @@ -0,0 +1,121 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// VersionMetadataResponse version metadata response +// +// swagger:model versionMetadataResponse +type VersionMetadataResponse struct { + + // versions + Versions []*VersionMetadataVersion `json:"versions"` +} + +// Validate validates this version metadata response +func (m *VersionMetadataResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVersions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VersionMetadataResponse) validateVersions(formats strfmt.Registry) error { + if swag.IsZero(m.Versions) { // not required + return nil + } + + for i := 0; i < len(m.Versions); i++ { + if swag.IsZero(m.Versions[i]) { // not required + continue + } + + if m.Versions[i] != nil { + if err := m.Versions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this version metadata response based on the context it is used +func (m *VersionMetadataResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVersions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VersionMetadataResponse) contextValidateVersions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Versions); i++ { + + if m.Versions[i] != nil { + + if swag.IsZero(m.Versions[i]) { // not required + return nil + } + + if err := m.Versions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VersionMetadataResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VersionMetadataResponse) UnmarshalBinary(b []byte) error { + var res VersionMetadataResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/version/client/models/version_metadata_v2_response.go b/version/client/models/version_metadata_v2_response.go new file mode 100644 index 0000000000..b32e3bfc31 --- /dev/null +++ b/version/client/models/version_metadata_v2_response.go @@ -0,0 +1,121 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// VersionMetadataV2Response version metadata v2 response +// +// swagger:model versionMetadataV2Response +type VersionMetadataV2Response struct { + + // versions + Versions []*VersionMetadataV2Version `json:"versions"` +} + +// Validate validates this version metadata v2 response +func (m *VersionMetadataV2Response) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVersions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VersionMetadataV2Response) validateVersions(formats strfmt.Registry) error { + if swag.IsZero(m.Versions) { // not required + return nil + } + + for i := 0; i < len(m.Versions); i++ { + if swag.IsZero(m.Versions[i]) { // not required + continue + } + + if m.Versions[i] != nil { + if err := m.Versions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this version metadata v2 response based on the context it is used +func (m *VersionMetadataV2Response) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVersions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VersionMetadataV2Response) contextValidateVersions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Versions); i++ { + + if m.Versions[i] != nil { + + if swag.IsZero(m.Versions[i]) { // not required + return nil + } + + if err := m.Versions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VersionMetadataV2Response) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VersionMetadataV2Response) UnmarshalBinary(b []byte) error { + var res VersionMetadataV2Response + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/version/client/models/version_metadata_v2_version.go b/version/client/models/version_metadata_v2_version.go new file mode 100644 index 0000000000..c5437cab09 --- /dev/null +++ b/version/client/models/version_metadata_v2_version.go @@ -0,0 +1,118 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// VersionMetadataV2Version MetadataV2Version represents metadata for a given version with additional fields. +// +// swagger:model versionMetadataV2Version +type VersionMetadataV2Version struct { + + // ImageInfo holds information about the docker image for this version. + ImageInfo *VersionVersionV2 `json:"imageInfo,omitempty"` + + // Recommended is the recommended version for a given component. + Recommended map[string]string `json:"recommended,omitempty"` + + // Supported holds semver constraint per component, such as ">= 1.0, < 1.4". + Supported map[string]string `json:"supported,omitempty"` + + // version + Version string `json:"version,omitempty"` +} + +// Validate validates this version metadata v2 version +func (m *VersionMetadataV2Version) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateImageInfo(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VersionMetadataV2Version) validateImageInfo(formats strfmt.Registry) error { + if swag.IsZero(m.ImageInfo) { // not required + return nil + } + + if m.ImageInfo != nil { + if err := m.ImageInfo.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("imageInfo") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("imageInfo") + } + return err + } + } + + return nil +} + +// ContextValidate validate this version metadata v2 version based on the context it is used +func (m *VersionMetadataV2Version) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateImageInfo(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VersionMetadataV2Version) contextValidateImageInfo(ctx context.Context, formats strfmt.Registry) error { + + if m.ImageInfo != nil { + + if swag.IsZero(m.ImageInfo) { // not required + return nil + } + + if err := m.ImageInfo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("imageInfo") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("imageInfo") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VersionMetadataV2Version) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VersionMetadataV2Version) UnmarshalBinary(b []byte) error { + var res VersionMetadataV2Version + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/version/client/models/version_metadata_version.go b/version/client/models/version_metadata_version.go new file mode 100644 index 0000000000..a635c8473f --- /dev/null +++ b/version/client/models/version_metadata_version.go @@ -0,0 +1,56 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// VersionMetadataVersion MetadataVersion represents metadata for a given version. +// +// swagger:model versionMetadataVersion +type VersionMetadataVersion struct { + + // Recommended is the recommended version for a given component. + Recommended map[string]string `json:"recommended,omitempty"` + + // Supported holds semver constraint per component, such as ">= 1.0, < 1.4". + Supported map[string]string `json:"supported,omitempty"` + + // version + Version string `json:"version,omitempty"` +} + +// Validate validates this version metadata version +func (m *VersionMetadataVersion) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this version metadata version based on context it is used +func (m *VersionMetadataVersion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VersionMetadataVersion) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VersionMetadataVersion) UnmarshalBinary(b []byte) error { + var res VersionMetadataVersion + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/version/client/models/version_operator_response.go b/version/client/models/version_operator_response.go index 6ff2150269..22a92f7051 100644 --- a/version/client/models/version_operator_response.go +++ b/version/client/models/version_operator_response.go @@ -82,6 +82,11 @@ func (m *VersionOperatorResponse) contextValidateVersions(ctx context.Context, f for i := 0; i < len(m.Versions); i++ { if m.Versions[i] != nil { + + if swag.IsZero(m.Versions[i]) { // not required + return nil + } + if err := m.Versions[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("versions" + "." + strconv.Itoa(i)) diff --git a/version/client/models/version_operator_version.go b/version/client/models/version_operator_version.go index 7eedb8de94..b7fb267af8 100644 --- a/version/client/models/version_operator_version.go +++ b/version/client/models/version_operator_version.go @@ -78,6 +78,11 @@ func (m *VersionOperatorVersion) ContextValidate(ctx context.Context, formats st func (m *VersionOperatorVersion) contextValidateMatrix(ctx context.Context, formats strfmt.Registry) error { if m.Matrix != nil { + + if swag.IsZero(m.Matrix) { // not required + return nil + } + if err := m.Matrix.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("matrix") diff --git a/version/client/models/version_product_response.go b/version/client/models/version_product_response.go index 77ff32d0f4..ec7fc278cc 100644 --- a/version/client/models/version_product_response.go +++ b/version/client/models/version_product_response.go @@ -82,6 +82,11 @@ func (m *VersionProductResponse) contextValidateVersions(ctx context.Context, fo for i := 0; i < len(m.Versions); i++ { if m.Versions[i] != nil { + + if swag.IsZero(m.Versions[i]) { // not required + return nil + } + if err := m.Versions[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("versions" + "." + strconv.Itoa(i)) diff --git a/version/client/models/version_version.go b/version/client/models/version_version.go index f102929268..7d262b252e 100644 --- a/version/client/models/version_version.go +++ b/version/client/models/version_version.go @@ -24,6 +24,9 @@ type VersionVersion struct { // image hash ImageHash string `json:"imageHash,omitempty"` + // image hash arm64 + ImageHashArm64 string `json:"imageHashArm64,omitempty"` + // image path ImagePath string `json:"imagePath,omitempty"` @@ -81,6 +84,11 @@ func (m *VersionVersion) ContextValidate(ctx context.Context, formats strfmt.Reg func (m *VersionVersion) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { if m.Status != nil { + + if swag.IsZero(m.Status) { // not required + return nil + } + if err := m.Status.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("status") diff --git a/version/client/models/version_version_matrix.go b/version/client/models/version_version_matrix.go index 7f59def8ff..fba724e6e8 100644 --- a/version/client/models/version_version_matrix.go +++ b/version/client/models/version_version_matrix.go @@ -73,6 +73,9 @@ type VersionVersionMatrix struct { // pmm Pmm map[string]VersionVersion `json:"pmm,omitempty"` + // postgis + Postgis map[string]VersionVersion `json:"postgis,omitempty"` + // postgresql Postgresql map[string]VersionVersion `json:"postgresql,omitempty"` @@ -93,6 +96,9 @@ type VersionVersionMatrix struct { // router Router map[string]VersionVersion `json:"router,omitempty"` + + // toolkit + Toolkit map[string]VersionVersion `json:"toolkit,omitempty"` } // Validate validates this version version matrix @@ -171,6 +177,10 @@ func (m *VersionVersionMatrix) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validatePostgis(formats); err != nil { + res = append(res, err) + } + if err := m.validatePostgresql(formats); err != nil { res = append(res, err) } @@ -199,6 +209,10 @@ func (m *VersionVersionMatrix) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateToolkit(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -673,6 +687,32 @@ func (m *VersionVersionMatrix) validatePmm(formats strfmt.Registry) error { return nil } +func (m *VersionVersionMatrix) validatePostgis(formats strfmt.Registry) error { + if swag.IsZero(m.Postgis) { // not required + return nil + } + + for k := range m.Postgis { + + if err := validate.Required("postgis"+"."+k, "body", m.Postgis[k]); err != nil { + return err + } + if val, ok := m.Postgis[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("postgis" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("postgis" + "." + k) + } + return err + } + } + + } + + return nil +} + func (m *VersionVersionMatrix) validatePostgresql(formats strfmt.Registry) error { if swag.IsZero(m.Postgresql) { // not required return nil @@ -855,6 +895,32 @@ func (m *VersionVersionMatrix) validateRouter(formats strfmt.Registry) error { return nil } +func (m *VersionVersionMatrix) validateToolkit(formats strfmt.Registry) error { + if swag.IsZero(m.Toolkit) { // not required + return nil + } + + for k := range m.Toolkit { + + if err := validate.Required("toolkit"+"."+k, "body", m.Toolkit[k]); err != nil { + return err + } + if val, ok := m.Toolkit[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toolkit" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("toolkit" + "." + k) + } + return err + } + } + + } + + return nil +} + // ContextValidate validate this version version matrix based on the context it is used func (m *VersionVersionMatrix) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -931,6 +997,10 @@ func (m *VersionVersionMatrix) ContextValidate(ctx context.Context, formats strf res = append(res, err) } + if err := m.contextValidatePostgis(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidatePostgresql(ctx, formats); err != nil { res = append(res, err) } @@ -959,6 +1029,10 @@ func (m *VersionVersionMatrix) ContextValidate(ctx context.Context, formats strf res = append(res, err) } + if err := m.contextValidateToolkit(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -1235,6 +1309,21 @@ func (m *VersionVersionMatrix) contextValidatePmm(ctx context.Context, formats s return nil } +func (m *VersionVersionMatrix) contextValidatePostgis(ctx context.Context, formats strfmt.Registry) error { + + for k := range m.Postgis { + + if val, ok := m.Postgis[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + func (m *VersionVersionMatrix) contextValidatePostgresql(ctx context.Context, formats strfmt.Registry) error { for k := range m.Postgresql { @@ -1340,6 +1429,21 @@ func (m *VersionVersionMatrix) contextValidateRouter(ctx context.Context, format return nil } +func (m *VersionVersionMatrix) contextValidateToolkit(ctx context.Context, formats strfmt.Registry) error { + + for k := range m.Toolkit { + + if val, ok := m.Toolkit[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *VersionVersionMatrix) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/version/client/models/version_version_response.go b/version/client/models/version_version_response.go index 34abed8e6a..906c342be2 100644 --- a/version/client/models/version_version_response.go +++ b/version/client/models/version_version_response.go @@ -82,6 +82,11 @@ func (m *VersionVersionResponse) contextValidateVersions(ctx context.Context, fo for i := 0; i < len(m.Versions); i++ { if m.Versions[i] != nil { + + if swag.IsZero(m.Versions[i]) { // not required + return nil + } + if err := m.Versions[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("versions" + "." + strconv.Itoa(i)) diff --git a/version/client/models/version_version_v2.go b/version/client/models/version_version_v2.go new file mode 100644 index 0000000000..68a5bef16b --- /dev/null +++ b/version/client/models/version_version_v2.go @@ -0,0 +1,142 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// VersionVersionV2 Version represents product version information. +// +// swagger:model versionVersionV2 +type VersionVersionV2 struct { + + // critical + Critical bool `json:"critical,omitempty"` + + // image hash + ImageHash string `json:"imageHash,omitempty"` + + // image hash arm64 + ImageHashArm64 string `json:"imageHashArm64,omitempty"` + + // image path + ImagePath string `json:"imagePath,omitempty"` + + // release_timestamp is the release time of this image. + // Format: date-time + ImageReleaseTimestamp strfmt.DateTime `json:"imageReleaseTimestamp,omitempty"` + + // status + Status *VersionStatus `json:"status,omitempty"` +} + +// Validate validates this version version v2 +func (m *VersionVersionV2) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateImageReleaseTimestamp(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 *VersionVersionV2) validateImageReleaseTimestamp(formats strfmt.Registry) error { + if swag.IsZero(m.ImageReleaseTimestamp) { // not required + return nil + } + + if err := validate.FormatOf("imageReleaseTimestamp", "body", "date-time", m.ImageReleaseTimestamp.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *VersionVersionV2) 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") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this version version v2 based on the context it is used +func (m *VersionVersionV2) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VersionVersionV2) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + + if swag.IsZero(m.Status) { // not required + return nil + } + + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VersionVersionV2) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VersionVersionV2) UnmarshalBinary(b []byte) error { + var res VersionVersionV2 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/version/client/version_service/version_service_apply_parameters.go b/version/client/version_service/version_service_apply_parameters.go index 2d19601cb7..cb76bdb1d8 100644 --- a/version/client/version_service/version_service_apply_parameters.go +++ b/version/client/version_service/version_service_apply_parameters.go @@ -68,9 +68,15 @@ type VersionServiceApplyParams struct { // BackupVersion. BackupVersion *string - // ClusterWideEnabled. + // BackupsEnabled. + BackupsEnabled *bool + + // ClusterSize. // - // Format: boolean + // Format: int32 + ClusterSize *int32 + + // ClusterWideEnabled. ClusterWideEnabled *bool // CustomResourceUID. @@ -79,14 +85,21 @@ type VersionServiceApplyParams struct { // DatabaseVersion. DatabaseVersion *string + // Extensions. + Extensions *string + // HaproxyVersion. HaproxyVersion *string // HashicorpVaultEnabled. - // - // Format: boolean HashicorpVaultEnabled *bool + // HelmDeployCr. + HelmDeployCr *bool + + // HelmDeployOperator. + HelmDeployOperator *bool + // KubeVersion. KubeVersion *string @@ -99,9 +112,18 @@ type VersionServiceApplyParams struct { // OperatorVersion. OperatorVersion string + // PhysicalBackupScheduled. + PhysicalBackupScheduled *bool + + // PitrEnabled. + PitrEnabled *bool + // Platform. Platform *string + // PmmEnabled. + PmmEnabled *bool + // PmmVersion. PmmVersion *string @@ -112,10 +134,14 @@ type VersionServiceApplyParams struct { ProxysqlVersion *string // ShardingEnabled. - // - // Format: boolean ShardingEnabled *bool + // SidecarsUsed. + SidecarsUsed *bool + + // UserManagementEnabled. + UserManagementEnabled *bool + timeout time.Duration Context context.Context HTTPClient *http.Client @@ -191,6 +217,28 @@ func (o *VersionServiceApplyParams) SetBackupVersion(backupVersion *string) { o.BackupVersion = backupVersion } +// WithBackupsEnabled adds the backupsEnabled to the version service apply params +func (o *VersionServiceApplyParams) WithBackupsEnabled(backupsEnabled *bool) *VersionServiceApplyParams { + o.SetBackupsEnabled(backupsEnabled) + return o +} + +// SetBackupsEnabled adds the backupsEnabled to the version service apply params +func (o *VersionServiceApplyParams) SetBackupsEnabled(backupsEnabled *bool) { + o.BackupsEnabled = backupsEnabled +} + +// WithClusterSize adds the clusterSize to the version service apply params +func (o *VersionServiceApplyParams) WithClusterSize(clusterSize *int32) *VersionServiceApplyParams { + o.SetClusterSize(clusterSize) + return o +} + +// SetClusterSize adds the clusterSize to the version service apply params +func (o *VersionServiceApplyParams) SetClusterSize(clusterSize *int32) { + o.ClusterSize = clusterSize +} + // WithClusterWideEnabled adds the clusterWideEnabled to the version service apply params func (o *VersionServiceApplyParams) WithClusterWideEnabled(clusterWideEnabled *bool) *VersionServiceApplyParams { o.SetClusterWideEnabled(clusterWideEnabled) @@ -224,6 +272,17 @@ func (o *VersionServiceApplyParams) SetDatabaseVersion(databaseVersion *string) o.DatabaseVersion = databaseVersion } +// WithExtensions adds the extensions to the version service apply params +func (o *VersionServiceApplyParams) WithExtensions(extensions *string) *VersionServiceApplyParams { + o.SetExtensions(extensions) + return o +} + +// SetExtensions adds the extensions to the version service apply params +func (o *VersionServiceApplyParams) SetExtensions(extensions *string) { + o.Extensions = extensions +} + // WithHaproxyVersion adds the haproxyVersion to the version service apply params func (o *VersionServiceApplyParams) WithHaproxyVersion(haproxyVersion *string) *VersionServiceApplyParams { o.SetHaproxyVersion(haproxyVersion) @@ -246,6 +305,28 @@ func (o *VersionServiceApplyParams) SetHashicorpVaultEnabled(hashicorpVaultEnabl o.HashicorpVaultEnabled = hashicorpVaultEnabled } +// WithHelmDeployCr adds the helmDeployCr to the version service apply params +func (o *VersionServiceApplyParams) WithHelmDeployCr(helmDeployCr *bool) *VersionServiceApplyParams { + o.SetHelmDeployCr(helmDeployCr) + return o +} + +// SetHelmDeployCr adds the helmDeployCr to the version service apply params +func (o *VersionServiceApplyParams) SetHelmDeployCr(helmDeployCr *bool) { + o.HelmDeployCr = helmDeployCr +} + +// WithHelmDeployOperator adds the helmDeployOperator to the version service apply params +func (o *VersionServiceApplyParams) WithHelmDeployOperator(helmDeployOperator *bool) *VersionServiceApplyParams { + o.SetHelmDeployOperator(helmDeployOperator) + return o +} + +// SetHelmDeployOperator adds the helmDeployOperator to the version service apply params +func (o *VersionServiceApplyParams) SetHelmDeployOperator(helmDeployOperator *bool) { + o.HelmDeployOperator = helmDeployOperator +} + // WithKubeVersion adds the kubeVersion to the version service apply params func (o *VersionServiceApplyParams) WithKubeVersion(kubeVersion *string) *VersionServiceApplyParams { o.SetKubeVersion(kubeVersion) @@ -290,6 +371,28 @@ func (o *VersionServiceApplyParams) SetOperatorVersion(operatorVersion string) { o.OperatorVersion = operatorVersion } +// WithPhysicalBackupScheduled adds the physicalBackupScheduled to the version service apply params +func (o *VersionServiceApplyParams) WithPhysicalBackupScheduled(physicalBackupScheduled *bool) *VersionServiceApplyParams { + o.SetPhysicalBackupScheduled(physicalBackupScheduled) + return o +} + +// SetPhysicalBackupScheduled adds the physicalBackupScheduled to the version service apply params +func (o *VersionServiceApplyParams) SetPhysicalBackupScheduled(physicalBackupScheduled *bool) { + o.PhysicalBackupScheduled = physicalBackupScheduled +} + +// WithPitrEnabled adds the pitrEnabled to the version service apply params +func (o *VersionServiceApplyParams) WithPitrEnabled(pitrEnabled *bool) *VersionServiceApplyParams { + o.SetPitrEnabled(pitrEnabled) + return o +} + +// SetPitrEnabled adds the pitrEnabled to the version service apply params +func (o *VersionServiceApplyParams) SetPitrEnabled(pitrEnabled *bool) { + o.PitrEnabled = pitrEnabled +} + // WithPlatform adds the platform to the version service apply params func (o *VersionServiceApplyParams) WithPlatform(platform *string) *VersionServiceApplyParams { o.SetPlatform(platform) @@ -301,6 +404,17 @@ func (o *VersionServiceApplyParams) SetPlatform(platform *string) { o.Platform = platform } +// WithPmmEnabled adds the pmmEnabled to the version service apply params +func (o *VersionServiceApplyParams) WithPmmEnabled(pmmEnabled *bool) *VersionServiceApplyParams { + o.SetPmmEnabled(pmmEnabled) + return o +} + +// SetPmmEnabled adds the pmmEnabled to the version service apply params +func (o *VersionServiceApplyParams) SetPmmEnabled(pmmEnabled *bool) { + o.PmmEnabled = pmmEnabled +} + // WithPmmVersion adds the pmmVersion to the version service apply params func (o *VersionServiceApplyParams) WithPmmVersion(pmmVersion *string) *VersionServiceApplyParams { o.SetPmmVersion(pmmVersion) @@ -345,6 +459,28 @@ func (o *VersionServiceApplyParams) SetShardingEnabled(shardingEnabled *bool) { o.ShardingEnabled = shardingEnabled } +// WithSidecarsUsed adds the sidecarsUsed to the version service apply params +func (o *VersionServiceApplyParams) WithSidecarsUsed(sidecarsUsed *bool) *VersionServiceApplyParams { + o.SetSidecarsUsed(sidecarsUsed) + return o +} + +// SetSidecarsUsed adds the sidecarsUsed to the version service apply params +func (o *VersionServiceApplyParams) SetSidecarsUsed(sidecarsUsed *bool) { + o.SidecarsUsed = sidecarsUsed +} + +// WithUserManagementEnabled adds the userManagementEnabled to the version service apply params +func (o *VersionServiceApplyParams) WithUserManagementEnabled(userManagementEnabled *bool) *VersionServiceApplyParams { + o.SetUserManagementEnabled(userManagementEnabled) + return o +} + +// SetUserManagementEnabled adds the userManagementEnabled to the version service apply params +func (o *VersionServiceApplyParams) SetUserManagementEnabled(userManagementEnabled *bool) { + o.UserManagementEnabled = userManagementEnabled +} + // WriteToRequest writes these params to a swagger request func (o *VersionServiceApplyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -375,6 +511,40 @@ func (o *VersionServiceApplyParams) WriteToRequest(r runtime.ClientRequest, reg } } + if o.BackupsEnabled != nil { + + // query param backupsEnabled + var qrBackupsEnabled bool + + if o.BackupsEnabled != nil { + qrBackupsEnabled = *o.BackupsEnabled + } + qBackupsEnabled := swag.FormatBool(qrBackupsEnabled) + if qBackupsEnabled != "" { + + if err := r.SetQueryParam("backupsEnabled", qBackupsEnabled); err != nil { + return err + } + } + } + + if o.ClusterSize != nil { + + // query param clusterSize + var qrClusterSize int32 + + if o.ClusterSize != nil { + qrClusterSize = *o.ClusterSize + } + qClusterSize := swag.FormatInt32(qrClusterSize) + if qClusterSize != "" { + + if err := r.SetQueryParam("clusterSize", qClusterSize); err != nil { + return err + } + } + } + if o.ClusterWideEnabled != nil { // query param clusterWideEnabled @@ -426,6 +596,23 @@ func (o *VersionServiceApplyParams) WriteToRequest(r runtime.ClientRequest, reg } } + if o.Extensions != nil { + + // query param extensions + var qrExtensions string + + if o.Extensions != nil { + qrExtensions = *o.Extensions + } + qExtensions := qrExtensions + if qExtensions != "" { + + if err := r.SetQueryParam("extensions", qExtensions); err != nil { + return err + } + } + } + if o.HaproxyVersion != nil { // query param haproxyVersion @@ -460,6 +647,40 @@ func (o *VersionServiceApplyParams) WriteToRequest(r runtime.ClientRequest, reg } } + if o.HelmDeployCr != nil { + + // query param helmDeployCr + var qrHelmDeployCr bool + + if o.HelmDeployCr != nil { + qrHelmDeployCr = *o.HelmDeployCr + } + qHelmDeployCr := swag.FormatBool(qrHelmDeployCr) + if qHelmDeployCr != "" { + + if err := r.SetQueryParam("helmDeployCr", qHelmDeployCr); err != nil { + return err + } + } + } + + if o.HelmDeployOperator != nil { + + // query param helmDeployOperator + var qrHelmDeployOperator bool + + if o.HelmDeployOperator != nil { + qrHelmDeployOperator = *o.HelmDeployOperator + } + qHelmDeployOperator := swag.FormatBool(qrHelmDeployOperator) + if qHelmDeployOperator != "" { + + if err := r.SetQueryParam("helmDeployOperator", qHelmDeployOperator); err != nil { + return err + } + } + } + if o.KubeVersion != nil { // query param kubeVersion @@ -516,6 +737,40 @@ func (o *VersionServiceApplyParams) WriteToRequest(r runtime.ClientRequest, reg return err } + if o.PhysicalBackupScheduled != nil { + + // query param physicalBackupScheduled + var qrPhysicalBackupScheduled bool + + if o.PhysicalBackupScheduled != nil { + qrPhysicalBackupScheduled = *o.PhysicalBackupScheduled + } + qPhysicalBackupScheduled := swag.FormatBool(qrPhysicalBackupScheduled) + if qPhysicalBackupScheduled != "" { + + if err := r.SetQueryParam("physicalBackupScheduled", qPhysicalBackupScheduled); err != nil { + return err + } + } + } + + if o.PitrEnabled != nil { + + // query param pitrEnabled + var qrPitrEnabled bool + + if o.PitrEnabled != nil { + qrPitrEnabled = *o.PitrEnabled + } + qPitrEnabled := swag.FormatBool(qrPitrEnabled) + if qPitrEnabled != "" { + + if err := r.SetQueryParam("pitrEnabled", qPitrEnabled); err != nil { + return err + } + } + } + if o.Platform != nil { // query param platform @@ -533,6 +788,23 @@ func (o *VersionServiceApplyParams) WriteToRequest(r runtime.ClientRequest, reg } } + if o.PmmEnabled != nil { + + // query param pmmEnabled + var qrPmmEnabled bool + + if o.PmmEnabled != nil { + qrPmmEnabled = *o.PmmEnabled + } + qPmmEnabled := swag.FormatBool(qrPmmEnabled) + if qPmmEnabled != "" { + + if err := r.SetQueryParam("pmmEnabled", qPmmEnabled); err != nil { + return err + } + } + } + if o.PmmVersion != nil { // query param pmmVersion @@ -589,6 +861,40 @@ func (o *VersionServiceApplyParams) WriteToRequest(r runtime.ClientRequest, reg } } + if o.SidecarsUsed != nil { + + // query param sidecarsUsed + var qrSidecarsUsed bool + + if o.SidecarsUsed != nil { + qrSidecarsUsed = *o.SidecarsUsed + } + qSidecarsUsed := swag.FormatBool(qrSidecarsUsed) + if qSidecarsUsed != "" { + + if err := r.SetQueryParam("sidecarsUsed", qSidecarsUsed); err != nil { + return err + } + } + } + + if o.UserManagementEnabled != nil { + + // query param userManagementEnabled + var qrUserManagementEnabled bool + + if o.UserManagementEnabled != nil { + qrUserManagementEnabled = *o.UserManagementEnabled + } + qUserManagementEnabled := swag.FormatBool(qrUserManagementEnabled) + if qUserManagementEnabled != "" { + + if err := r.SetQueryParam("userManagementEnabled", qUserManagementEnabled); err != nil { + return err + } + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/version/client/version_service/version_service_apply_responses.go b/version/client/version_service/version_service_apply_responses.go index 677847438c..46884988b0 100644 --- a/version/client/version_service/version_service_apply_responses.go +++ b/version/client/version_service/version_service_apply_responses.go @@ -6,6 +6,7 @@ package version_service // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -55,9 +56,46 @@ type VersionServiceApplyOK struct { Payload *models.VersionVersionResponse } +// IsSuccess returns true when this version service apply o k response has a 2xx status code +func (o *VersionServiceApplyOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this version service apply o k response has a 3xx status code +func (o *VersionServiceApplyOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this version service apply o k response has a 4xx status code +func (o *VersionServiceApplyOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this version service apply o k response has a 5xx status code +func (o *VersionServiceApplyOK) IsServerError() bool { + return false +} + +// IsCode returns true when this version service apply o k response a status code equal to that given +func (o *VersionServiceApplyOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the version service apply o k response +func (o *VersionServiceApplyOK) Code() int { + return 200 +} + func (o *VersionServiceApplyOK) Error() string { - return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}/{apply}][%d] versionServiceApplyOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}/{apply}][%d] versionServiceApplyOK %s", 200, payload) +} + +func (o *VersionServiceApplyOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}/{apply}][%d] versionServiceApplyOK %s", 200, payload) } + func (o *VersionServiceApplyOK) GetPayload() *models.VersionVersionResponse { return o.Payload } @@ -84,7 +122,7 @@ func NewVersionServiceApplyDefault(code int) *VersionServiceApplyDefault { /* VersionServiceApplyDefault describes a response with status code -1, with default header values. -An unexpected error response +An unexpected error response. */ type VersionServiceApplyDefault struct { _statusCode int @@ -92,14 +130,46 @@ type VersionServiceApplyDefault struct { Payload *models.GooglerpcStatus } +// IsSuccess returns true when this version service apply default response has a 2xx status code +func (o *VersionServiceApplyDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this version service apply default response has a 3xx status code +func (o *VersionServiceApplyDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this version service apply default response has a 4xx status code +func (o *VersionServiceApplyDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this version service apply default response has a 5xx status code +func (o *VersionServiceApplyDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this version service apply default response a status code equal to that given +func (o *VersionServiceApplyDefault) IsCode(code int) bool { + return o._statusCode == code +} + // Code gets the status code for the version service apply default response func (o *VersionServiceApplyDefault) Code() int { return o._statusCode } func (o *VersionServiceApplyDefault) Error() string { - return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}/{apply}][%d] VersionService_Apply default %+v", o._statusCode, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}/{apply}][%d] VersionService_Apply default %s", o._statusCode, payload) } + +func (o *VersionServiceApplyDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}/{apply}][%d] VersionService_Apply default %s", o._statusCode, payload) +} + func (o *VersionServiceApplyDefault) GetPayload() *models.GooglerpcStatus { return o.Payload } diff --git a/version/client/version_service/version_service_client.go b/version/client/version_service/version_service_client.go index 398c120215..46e8ef9320 100644 --- a/version/client/version_service/version_service_client.go +++ b/version/client/version_service/version_service_client.go @@ -7,6 +7,7 @@ package version_service import ( "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -15,6 +16,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi return &Client{transport: transport, formats: formats} } +// New creates a new version service API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new version service API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + /* Client for version service API */ @@ -23,13 +49,19 @@ type Client struct { formats strfmt.Registry } -// ClientOption is the option for Client methods +// ClientOption may be used to customize the behavior of Client methods. type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { VersionServiceApply(params *VersionServiceApplyParams, opts ...ClientOption) (*VersionServiceApplyOK, error) + VersionServiceGetReleaseNotes(params *VersionServiceGetReleaseNotesParams, opts ...ClientOption) (*VersionServiceGetReleaseNotesOK, error) + + VersionServiceMetadata(params *VersionServiceMetadataParams, opts ...ClientOption) (*VersionServiceMetadataOK, error) + + VersionServiceMetadataV2(params *VersionServiceMetadataV2Params, opts ...ClientOption) (*VersionServiceMetadataV2OK, error) + VersionServiceOperator(params *VersionServiceOperatorParams, opts ...ClientOption) (*VersionServiceOperatorOK, error) VersionServiceProduct(params *VersionServiceProductParams, opts ...ClientOption) (*VersionServiceProductOK, error) @@ -76,6 +108,123 @@ func (a *Client) VersionServiceApply(params *VersionServiceApplyParams, opts ... return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +VersionServiceGetReleaseNotes gets the release notes for a product version + +Return release notes for a product version +*/ +func (a *Client) VersionServiceGetReleaseNotes(params *VersionServiceGetReleaseNotesParams, opts ...ClientOption) (*VersionServiceGetReleaseNotesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewVersionServiceGetReleaseNotesParams() + } + op := &runtime.ClientOperation{ + ID: "VersionService_GetReleaseNotes", + Method: "GET", + PathPattern: "/release-notes/v1/{product}/{version}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &VersionServiceGetReleaseNotesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*VersionServiceGetReleaseNotesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*VersionServiceGetReleaseNotesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +VersionServiceMetadata metadata for a product + +Return metadata information for a product +*/ +func (a *Client) VersionServiceMetadata(params *VersionServiceMetadataParams, opts ...ClientOption) (*VersionServiceMetadataOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewVersionServiceMetadataParams() + } + op := &runtime.ClientOperation{ + ID: "VersionService_Metadata", + Method: "GET", + PathPattern: "/metadata/v1/{product}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &VersionServiceMetadataReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*VersionServiceMetadataOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*VersionServiceMetadataDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +VersionServiceMetadataV2 v2s metadata for a product + +Return metadata information with additional image information for a product +*/ +func (a *Client) VersionServiceMetadataV2(params *VersionServiceMetadataV2Params, opts ...ClientOption) (*VersionServiceMetadataV2OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewVersionServiceMetadataV2Params() + } + op := &runtime.ClientOperation{ + ID: "VersionService_MetadataV2", + Method: "GET", + PathPattern: "/metadata/v2/{product}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &VersionServiceMetadataV2Reader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*VersionServiceMetadataV2OK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*VersionServiceMetadataV2Default) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* VersionServiceOperator products versions for specific operator version diff --git a/version/client/version_service/version_service_get_release_notes_parameters.go b/version/client/version_service/version_service_get_release_notes_parameters.go new file mode 100644 index 0000000000..c2c2402040 --- /dev/null +++ b/version/client/version_service/version_service_get_release_notes_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package version_service + +// 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" +) + +// NewVersionServiceGetReleaseNotesParams creates a new VersionServiceGetReleaseNotesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewVersionServiceGetReleaseNotesParams() *VersionServiceGetReleaseNotesParams { + return &VersionServiceGetReleaseNotesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewVersionServiceGetReleaseNotesParamsWithTimeout creates a new VersionServiceGetReleaseNotesParams object +// with the ability to set a timeout on a request. +func NewVersionServiceGetReleaseNotesParamsWithTimeout(timeout time.Duration) *VersionServiceGetReleaseNotesParams { + return &VersionServiceGetReleaseNotesParams{ + timeout: timeout, + } +} + +// NewVersionServiceGetReleaseNotesParamsWithContext creates a new VersionServiceGetReleaseNotesParams object +// with the ability to set a context for a request. +func NewVersionServiceGetReleaseNotesParamsWithContext(ctx context.Context) *VersionServiceGetReleaseNotesParams { + return &VersionServiceGetReleaseNotesParams{ + Context: ctx, + } +} + +// NewVersionServiceGetReleaseNotesParamsWithHTTPClient creates a new VersionServiceGetReleaseNotesParams object +// with the ability to set a custom HTTPClient for a request. +func NewVersionServiceGetReleaseNotesParamsWithHTTPClient(client *http.Client) *VersionServiceGetReleaseNotesParams { + return &VersionServiceGetReleaseNotesParams{ + HTTPClient: client, + } +} + +/* +VersionServiceGetReleaseNotesParams contains all the parameters to send to the API endpoint + + for the version service get release notes operation. + + Typically these are written to a http.Request. +*/ +type VersionServiceGetReleaseNotesParams struct { + + /* Product. + + Product name. + */ + Product string + + /* Version. + + Product version. + */ + Version string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the version service get release notes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *VersionServiceGetReleaseNotesParams) WithDefaults() *VersionServiceGetReleaseNotesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the version service get release notes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *VersionServiceGetReleaseNotesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) WithTimeout(timeout time.Duration) *VersionServiceGetReleaseNotesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) WithContext(ctx context.Context) *VersionServiceGetReleaseNotesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) WithHTTPClient(client *http.Client) *VersionServiceGetReleaseNotesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProduct adds the product to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) WithProduct(product string) *VersionServiceGetReleaseNotesParams { + o.SetProduct(product) + return o +} + +// SetProduct adds the product to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) SetProduct(product string) { + o.Product = product +} + +// WithVersion adds the version to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) WithVersion(version string) *VersionServiceGetReleaseNotesParams { + o.SetVersion(version) + return o +} + +// SetVersion adds the version to the version service get release notes params +func (o *VersionServiceGetReleaseNotesParams) SetVersion(version string) { + o.Version = version +} + +// WriteToRequest writes these params to a swagger request +func (o *VersionServiceGetReleaseNotesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param product + if err := r.SetPathParam("product", o.Product); err != nil { + return err + } + + // path param version + if err := r.SetPathParam("version", o.Version); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/version/client/version_service/version_service_get_release_notes_responses.go b/version/client/version_service/version_service_get_release_notes_responses.go new file mode 100644 index 0000000000..1e5664a272 --- /dev/null +++ b/version/client/version_service/version_service_get_release_notes_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package version_service + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/percona/percona-xtradb-cluster-operator/version/client/models" +) + +// VersionServiceGetReleaseNotesReader is a Reader for the VersionServiceGetReleaseNotes structure. +type VersionServiceGetReleaseNotesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *VersionServiceGetReleaseNotesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewVersionServiceGetReleaseNotesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewVersionServiceGetReleaseNotesDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewVersionServiceGetReleaseNotesOK creates a VersionServiceGetReleaseNotesOK with default headers values +func NewVersionServiceGetReleaseNotesOK() *VersionServiceGetReleaseNotesOK { + return &VersionServiceGetReleaseNotesOK{} +} + +/* +VersionServiceGetReleaseNotesOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type VersionServiceGetReleaseNotesOK struct { + Payload *models.VersionGetReleaseNotesResponse +} + +// IsSuccess returns true when this version service get release notes o k response has a 2xx status code +func (o *VersionServiceGetReleaseNotesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this version service get release notes o k response has a 3xx status code +func (o *VersionServiceGetReleaseNotesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this version service get release notes o k response has a 4xx status code +func (o *VersionServiceGetReleaseNotesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this version service get release notes o k response has a 5xx status code +func (o *VersionServiceGetReleaseNotesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this version service get release notes o k response a status code equal to that given +func (o *VersionServiceGetReleaseNotesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the version service get release notes o k response +func (o *VersionServiceGetReleaseNotesOK) Code() int { + return 200 +} + +func (o *VersionServiceGetReleaseNotesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /release-notes/v1/{product}/{version}][%d] versionServiceGetReleaseNotesOK %s", 200, payload) +} + +func (o *VersionServiceGetReleaseNotesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /release-notes/v1/{product}/{version}][%d] versionServiceGetReleaseNotesOK %s", 200, payload) +} + +func (o *VersionServiceGetReleaseNotesOK) GetPayload() *models.VersionGetReleaseNotesResponse { + return o.Payload +} + +func (o *VersionServiceGetReleaseNotesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VersionGetReleaseNotesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewVersionServiceGetReleaseNotesDefault creates a VersionServiceGetReleaseNotesDefault with default headers values +func NewVersionServiceGetReleaseNotesDefault(code int) *VersionServiceGetReleaseNotesDefault { + return &VersionServiceGetReleaseNotesDefault{ + _statusCode: code, + } +} + +/* +VersionServiceGetReleaseNotesDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type VersionServiceGetReleaseNotesDefault struct { + _statusCode int + + Payload *models.GooglerpcStatus +} + +// IsSuccess returns true when this version service get release notes default response has a 2xx status code +func (o *VersionServiceGetReleaseNotesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this version service get release notes default response has a 3xx status code +func (o *VersionServiceGetReleaseNotesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this version service get release notes default response has a 4xx status code +func (o *VersionServiceGetReleaseNotesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this version service get release notes default response has a 5xx status code +func (o *VersionServiceGetReleaseNotesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this version service get release notes default response a status code equal to that given +func (o *VersionServiceGetReleaseNotesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the version service get release notes default response +func (o *VersionServiceGetReleaseNotesDefault) Code() int { + return o._statusCode +} + +func (o *VersionServiceGetReleaseNotesDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /release-notes/v1/{product}/{version}][%d] VersionService_GetReleaseNotes default %s", o._statusCode, payload) +} + +func (o *VersionServiceGetReleaseNotesDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /release-notes/v1/{product}/{version}][%d] VersionService_GetReleaseNotes default %s", o._statusCode, payload) +} + +func (o *VersionServiceGetReleaseNotesDefault) GetPayload() *models.GooglerpcStatus { + return o.Payload +} + +func (o *VersionServiceGetReleaseNotesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GooglerpcStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/version/client/version_service/version_service_metadata_parameters.go b/version/client/version_service/version_service_metadata_parameters.go new file mode 100644 index 0000000000..251f98e56c --- /dev/null +++ b/version/client/version_service/version_service_metadata_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package version_service + +// 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" +) + +// NewVersionServiceMetadataParams creates a new VersionServiceMetadataParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewVersionServiceMetadataParams() *VersionServiceMetadataParams { + return &VersionServiceMetadataParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewVersionServiceMetadataParamsWithTimeout creates a new VersionServiceMetadataParams object +// with the ability to set a timeout on a request. +func NewVersionServiceMetadataParamsWithTimeout(timeout time.Duration) *VersionServiceMetadataParams { + return &VersionServiceMetadataParams{ + timeout: timeout, + } +} + +// NewVersionServiceMetadataParamsWithContext creates a new VersionServiceMetadataParams object +// with the ability to set a context for a request. +func NewVersionServiceMetadataParamsWithContext(ctx context.Context) *VersionServiceMetadataParams { + return &VersionServiceMetadataParams{ + Context: ctx, + } +} + +// NewVersionServiceMetadataParamsWithHTTPClient creates a new VersionServiceMetadataParams object +// with the ability to set a custom HTTPClient for a request. +func NewVersionServiceMetadataParamsWithHTTPClient(client *http.Client) *VersionServiceMetadataParams { + return &VersionServiceMetadataParams{ + HTTPClient: client, + } +} + +/* +VersionServiceMetadataParams contains all the parameters to send to the API endpoint + + for the version service metadata operation. + + Typically these are written to a http.Request. +*/ +type VersionServiceMetadataParams struct { + + // Product. + Product string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the version service metadata params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *VersionServiceMetadataParams) WithDefaults() *VersionServiceMetadataParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the version service metadata params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *VersionServiceMetadataParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the version service metadata params +func (o *VersionServiceMetadataParams) WithTimeout(timeout time.Duration) *VersionServiceMetadataParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the version service metadata params +func (o *VersionServiceMetadataParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the version service metadata params +func (o *VersionServiceMetadataParams) WithContext(ctx context.Context) *VersionServiceMetadataParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the version service metadata params +func (o *VersionServiceMetadataParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the version service metadata params +func (o *VersionServiceMetadataParams) WithHTTPClient(client *http.Client) *VersionServiceMetadataParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the version service metadata params +func (o *VersionServiceMetadataParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProduct adds the product to the version service metadata params +func (o *VersionServiceMetadataParams) WithProduct(product string) *VersionServiceMetadataParams { + o.SetProduct(product) + return o +} + +// SetProduct adds the product to the version service metadata params +func (o *VersionServiceMetadataParams) SetProduct(product string) { + o.Product = product +} + +// WriteToRequest writes these params to a swagger request +func (o *VersionServiceMetadataParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param product + if err := r.SetPathParam("product", o.Product); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/version/client/version_service/version_service_metadata_responses.go b/version/client/version_service/version_service_metadata_responses.go new file mode 100644 index 0000000000..07d69358e0 --- /dev/null +++ b/version/client/version_service/version_service_metadata_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package version_service + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/percona/percona-xtradb-cluster-operator/version/client/models" +) + +// VersionServiceMetadataReader is a Reader for the VersionServiceMetadata structure. +type VersionServiceMetadataReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *VersionServiceMetadataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewVersionServiceMetadataOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewVersionServiceMetadataDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewVersionServiceMetadataOK creates a VersionServiceMetadataOK with default headers values +func NewVersionServiceMetadataOK() *VersionServiceMetadataOK { + return &VersionServiceMetadataOK{} +} + +/* +VersionServiceMetadataOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type VersionServiceMetadataOK struct { + Payload *models.VersionMetadataResponse +} + +// IsSuccess returns true when this version service metadata o k response has a 2xx status code +func (o *VersionServiceMetadataOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this version service metadata o k response has a 3xx status code +func (o *VersionServiceMetadataOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this version service metadata o k response has a 4xx status code +func (o *VersionServiceMetadataOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this version service metadata o k response has a 5xx status code +func (o *VersionServiceMetadataOK) IsServerError() bool { + return false +} + +// IsCode returns true when this version service metadata o k response a status code equal to that given +func (o *VersionServiceMetadataOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the version service metadata o k response +func (o *VersionServiceMetadataOK) Code() int { + return 200 +} + +func (o *VersionServiceMetadataOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /metadata/v1/{product}][%d] versionServiceMetadataOK %s", 200, payload) +} + +func (o *VersionServiceMetadataOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /metadata/v1/{product}][%d] versionServiceMetadataOK %s", 200, payload) +} + +func (o *VersionServiceMetadataOK) GetPayload() *models.VersionMetadataResponse { + return o.Payload +} + +func (o *VersionServiceMetadataOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VersionMetadataResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewVersionServiceMetadataDefault creates a VersionServiceMetadataDefault with default headers values +func NewVersionServiceMetadataDefault(code int) *VersionServiceMetadataDefault { + return &VersionServiceMetadataDefault{ + _statusCode: code, + } +} + +/* +VersionServiceMetadataDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type VersionServiceMetadataDefault struct { + _statusCode int + + Payload *models.GooglerpcStatus +} + +// IsSuccess returns true when this version service metadata default response has a 2xx status code +func (o *VersionServiceMetadataDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this version service metadata default response has a 3xx status code +func (o *VersionServiceMetadataDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this version service metadata default response has a 4xx status code +func (o *VersionServiceMetadataDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this version service metadata default response has a 5xx status code +func (o *VersionServiceMetadataDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this version service metadata default response a status code equal to that given +func (o *VersionServiceMetadataDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the version service metadata default response +func (o *VersionServiceMetadataDefault) Code() int { + return o._statusCode +} + +func (o *VersionServiceMetadataDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /metadata/v1/{product}][%d] VersionService_Metadata default %s", o._statusCode, payload) +} + +func (o *VersionServiceMetadataDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /metadata/v1/{product}][%d] VersionService_Metadata default %s", o._statusCode, payload) +} + +func (o *VersionServiceMetadataDefault) GetPayload() *models.GooglerpcStatus { + return o.Payload +} + +func (o *VersionServiceMetadataDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GooglerpcStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/version/client/version_service/version_service_metadata_v2_parameters.go b/version/client/version_service/version_service_metadata_v2_parameters.go new file mode 100644 index 0000000000..2558879e7f --- /dev/null +++ b/version/client/version_service/version_service_metadata_v2_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package version_service + +// 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" +) + +// NewVersionServiceMetadataV2Params creates a new VersionServiceMetadataV2Params object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewVersionServiceMetadataV2Params() *VersionServiceMetadataV2Params { + return &VersionServiceMetadataV2Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewVersionServiceMetadataV2ParamsWithTimeout creates a new VersionServiceMetadataV2Params object +// with the ability to set a timeout on a request. +func NewVersionServiceMetadataV2ParamsWithTimeout(timeout time.Duration) *VersionServiceMetadataV2Params { + return &VersionServiceMetadataV2Params{ + timeout: timeout, + } +} + +// NewVersionServiceMetadataV2ParamsWithContext creates a new VersionServiceMetadataV2Params object +// with the ability to set a context for a request. +func NewVersionServiceMetadataV2ParamsWithContext(ctx context.Context) *VersionServiceMetadataV2Params { + return &VersionServiceMetadataV2Params{ + Context: ctx, + } +} + +// NewVersionServiceMetadataV2ParamsWithHTTPClient creates a new VersionServiceMetadataV2Params object +// with the ability to set a custom HTTPClient for a request. +func NewVersionServiceMetadataV2ParamsWithHTTPClient(client *http.Client) *VersionServiceMetadataV2Params { + return &VersionServiceMetadataV2Params{ + HTTPClient: client, + } +} + +/* +VersionServiceMetadataV2Params contains all the parameters to send to the API endpoint + + for the version service metadata v2 operation. + + Typically these are written to a http.Request. +*/ +type VersionServiceMetadataV2Params struct { + + // Product. + Product string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the version service metadata v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *VersionServiceMetadataV2Params) WithDefaults() *VersionServiceMetadataV2Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the version service metadata v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *VersionServiceMetadataV2Params) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the version service metadata v2 params +func (o *VersionServiceMetadataV2Params) WithTimeout(timeout time.Duration) *VersionServiceMetadataV2Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the version service metadata v2 params +func (o *VersionServiceMetadataV2Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the version service metadata v2 params +func (o *VersionServiceMetadataV2Params) WithContext(ctx context.Context) *VersionServiceMetadataV2Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the version service metadata v2 params +func (o *VersionServiceMetadataV2Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the version service metadata v2 params +func (o *VersionServiceMetadataV2Params) WithHTTPClient(client *http.Client) *VersionServiceMetadataV2Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the version service metadata v2 params +func (o *VersionServiceMetadataV2Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProduct adds the product to the version service metadata v2 params +func (o *VersionServiceMetadataV2Params) WithProduct(product string) *VersionServiceMetadataV2Params { + o.SetProduct(product) + return o +} + +// SetProduct adds the product to the version service metadata v2 params +func (o *VersionServiceMetadataV2Params) SetProduct(product string) { + o.Product = product +} + +// WriteToRequest writes these params to a swagger request +func (o *VersionServiceMetadataV2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param product + if err := r.SetPathParam("product", o.Product); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/version/client/version_service/version_service_metadata_v2_responses.go b/version/client/version_service/version_service_metadata_v2_responses.go new file mode 100644 index 0000000000..d3ffa50167 --- /dev/null +++ b/version/client/version_service/version_service_metadata_v2_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package version_service + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/percona/percona-xtradb-cluster-operator/version/client/models" +) + +// VersionServiceMetadataV2Reader is a Reader for the VersionServiceMetadataV2 structure. +type VersionServiceMetadataV2Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *VersionServiceMetadataV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewVersionServiceMetadataV2OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewVersionServiceMetadataV2Default(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewVersionServiceMetadataV2OK creates a VersionServiceMetadataV2OK with default headers values +func NewVersionServiceMetadataV2OK() *VersionServiceMetadataV2OK { + return &VersionServiceMetadataV2OK{} +} + +/* +VersionServiceMetadataV2OK describes a response with status code 200, with default header values. + +A successful response. +*/ +type VersionServiceMetadataV2OK struct { + Payload *models.VersionMetadataV2Response +} + +// IsSuccess returns true when this version service metadata v2 o k response has a 2xx status code +func (o *VersionServiceMetadataV2OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this version service metadata v2 o k response has a 3xx status code +func (o *VersionServiceMetadataV2OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this version service metadata v2 o k response has a 4xx status code +func (o *VersionServiceMetadataV2OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this version service metadata v2 o k response has a 5xx status code +func (o *VersionServiceMetadataV2OK) IsServerError() bool { + return false +} + +// IsCode returns true when this version service metadata v2 o k response a status code equal to that given +func (o *VersionServiceMetadataV2OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the version service metadata v2 o k response +func (o *VersionServiceMetadataV2OK) Code() int { + return 200 +} + +func (o *VersionServiceMetadataV2OK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /metadata/v2/{product}][%d] versionServiceMetadataV2OK %s", 200, payload) +} + +func (o *VersionServiceMetadataV2OK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /metadata/v2/{product}][%d] versionServiceMetadataV2OK %s", 200, payload) +} + +func (o *VersionServiceMetadataV2OK) GetPayload() *models.VersionMetadataV2Response { + return o.Payload +} + +func (o *VersionServiceMetadataV2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VersionMetadataV2Response) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewVersionServiceMetadataV2Default creates a VersionServiceMetadataV2Default with default headers values +func NewVersionServiceMetadataV2Default(code int) *VersionServiceMetadataV2Default { + return &VersionServiceMetadataV2Default{ + _statusCode: code, + } +} + +/* +VersionServiceMetadataV2Default describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type VersionServiceMetadataV2Default struct { + _statusCode int + + Payload *models.GooglerpcStatus +} + +// IsSuccess returns true when this version service metadata v2 default response has a 2xx status code +func (o *VersionServiceMetadataV2Default) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this version service metadata v2 default response has a 3xx status code +func (o *VersionServiceMetadataV2Default) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this version service metadata v2 default response has a 4xx status code +func (o *VersionServiceMetadataV2Default) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this version service metadata v2 default response has a 5xx status code +func (o *VersionServiceMetadataV2Default) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this version service metadata v2 default response a status code equal to that given +func (o *VersionServiceMetadataV2Default) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the version service metadata v2 default response +func (o *VersionServiceMetadataV2Default) Code() int { + return o._statusCode +} + +func (o *VersionServiceMetadataV2Default) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /metadata/v2/{product}][%d] VersionService_MetadataV2 default %s", o._statusCode, payload) +} + +func (o *VersionServiceMetadataV2Default) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /metadata/v2/{product}][%d] VersionService_MetadataV2 default %s", o._statusCode, payload) +} + +func (o *VersionServiceMetadataV2Default) GetPayload() *models.GooglerpcStatus { + return o.Payload +} + +func (o *VersionServiceMetadataV2Default) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GooglerpcStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/version/client/version_service/version_service_operator_parameters.go b/version/client/version_service/version_service_operator_parameters.go index 1da63ea38a..d8bb33a746 100644 --- a/version/client/version_service/version_service_operator_parameters.go +++ b/version/client/version_service/version_service_operator_parameters.go @@ -65,9 +65,15 @@ type VersionServiceOperatorParams struct { // BackupVersion. BackupVersion *string - // ClusterWideEnabled. + // BackupsEnabled. + BackupsEnabled *bool + + // ClusterSize. // - // Format: boolean + // Format: int32 + ClusterSize *int32 + + // ClusterWideEnabled. ClusterWideEnabled *bool // CustomResourceUID. @@ -76,14 +82,21 @@ type VersionServiceOperatorParams struct { // DatabaseVersion. DatabaseVersion *string + // Extensions. + Extensions *string + // HaproxyVersion. HaproxyVersion *string // HashicorpVaultEnabled. - // - // Format: boolean HashicorpVaultEnabled *bool + // HelmDeployCr. + HelmDeployCr *bool + + // HelmDeployOperator. + HelmDeployOperator *bool + // KubeVersion. KubeVersion *string @@ -96,9 +109,18 @@ type VersionServiceOperatorParams struct { // OperatorVersion. OperatorVersion string + // PhysicalBackupScheduled. + PhysicalBackupScheduled *bool + + // PitrEnabled. + PitrEnabled *bool + // Platform. Platform *string + // PmmEnabled. + PmmEnabled *bool + // PmmVersion. PmmVersion *string @@ -109,10 +131,14 @@ type VersionServiceOperatorParams struct { ProxysqlVersion *string // ShardingEnabled. - // - // Format: boolean ShardingEnabled *bool + // SidecarsUsed. + SidecarsUsed *bool + + // UserManagementEnabled. + UserManagementEnabled *bool + timeout time.Duration Context context.Context HTTPClient *http.Client @@ -177,6 +203,28 @@ func (o *VersionServiceOperatorParams) SetBackupVersion(backupVersion *string) { o.BackupVersion = backupVersion } +// WithBackupsEnabled adds the backupsEnabled to the version service operator params +func (o *VersionServiceOperatorParams) WithBackupsEnabled(backupsEnabled *bool) *VersionServiceOperatorParams { + o.SetBackupsEnabled(backupsEnabled) + return o +} + +// SetBackupsEnabled adds the backupsEnabled to the version service operator params +func (o *VersionServiceOperatorParams) SetBackupsEnabled(backupsEnabled *bool) { + o.BackupsEnabled = backupsEnabled +} + +// WithClusterSize adds the clusterSize to the version service operator params +func (o *VersionServiceOperatorParams) WithClusterSize(clusterSize *int32) *VersionServiceOperatorParams { + o.SetClusterSize(clusterSize) + return o +} + +// SetClusterSize adds the clusterSize to the version service operator params +func (o *VersionServiceOperatorParams) SetClusterSize(clusterSize *int32) { + o.ClusterSize = clusterSize +} + // WithClusterWideEnabled adds the clusterWideEnabled to the version service operator params func (o *VersionServiceOperatorParams) WithClusterWideEnabled(clusterWideEnabled *bool) *VersionServiceOperatorParams { o.SetClusterWideEnabled(clusterWideEnabled) @@ -210,6 +258,17 @@ func (o *VersionServiceOperatorParams) SetDatabaseVersion(databaseVersion *strin o.DatabaseVersion = databaseVersion } +// WithExtensions adds the extensions to the version service operator params +func (o *VersionServiceOperatorParams) WithExtensions(extensions *string) *VersionServiceOperatorParams { + o.SetExtensions(extensions) + return o +} + +// SetExtensions adds the extensions to the version service operator params +func (o *VersionServiceOperatorParams) SetExtensions(extensions *string) { + o.Extensions = extensions +} + // WithHaproxyVersion adds the haproxyVersion to the version service operator params func (o *VersionServiceOperatorParams) WithHaproxyVersion(haproxyVersion *string) *VersionServiceOperatorParams { o.SetHaproxyVersion(haproxyVersion) @@ -232,6 +291,28 @@ func (o *VersionServiceOperatorParams) SetHashicorpVaultEnabled(hashicorpVaultEn o.HashicorpVaultEnabled = hashicorpVaultEnabled } +// WithHelmDeployCr adds the helmDeployCr to the version service operator params +func (o *VersionServiceOperatorParams) WithHelmDeployCr(helmDeployCr *bool) *VersionServiceOperatorParams { + o.SetHelmDeployCr(helmDeployCr) + return o +} + +// SetHelmDeployCr adds the helmDeployCr to the version service operator params +func (o *VersionServiceOperatorParams) SetHelmDeployCr(helmDeployCr *bool) { + o.HelmDeployCr = helmDeployCr +} + +// WithHelmDeployOperator adds the helmDeployOperator to the version service operator params +func (o *VersionServiceOperatorParams) WithHelmDeployOperator(helmDeployOperator *bool) *VersionServiceOperatorParams { + o.SetHelmDeployOperator(helmDeployOperator) + return o +} + +// SetHelmDeployOperator adds the helmDeployOperator to the version service operator params +func (o *VersionServiceOperatorParams) SetHelmDeployOperator(helmDeployOperator *bool) { + o.HelmDeployOperator = helmDeployOperator +} + // WithKubeVersion adds the kubeVersion to the version service operator params func (o *VersionServiceOperatorParams) WithKubeVersion(kubeVersion *string) *VersionServiceOperatorParams { o.SetKubeVersion(kubeVersion) @@ -276,6 +357,28 @@ func (o *VersionServiceOperatorParams) SetOperatorVersion(operatorVersion string o.OperatorVersion = operatorVersion } +// WithPhysicalBackupScheduled adds the physicalBackupScheduled to the version service operator params +func (o *VersionServiceOperatorParams) WithPhysicalBackupScheduled(physicalBackupScheduled *bool) *VersionServiceOperatorParams { + o.SetPhysicalBackupScheduled(physicalBackupScheduled) + return o +} + +// SetPhysicalBackupScheduled adds the physicalBackupScheduled to the version service operator params +func (o *VersionServiceOperatorParams) SetPhysicalBackupScheduled(physicalBackupScheduled *bool) { + o.PhysicalBackupScheduled = physicalBackupScheduled +} + +// WithPitrEnabled adds the pitrEnabled to the version service operator params +func (o *VersionServiceOperatorParams) WithPitrEnabled(pitrEnabled *bool) *VersionServiceOperatorParams { + o.SetPitrEnabled(pitrEnabled) + return o +} + +// SetPitrEnabled adds the pitrEnabled to the version service operator params +func (o *VersionServiceOperatorParams) SetPitrEnabled(pitrEnabled *bool) { + o.PitrEnabled = pitrEnabled +} + // WithPlatform adds the platform to the version service operator params func (o *VersionServiceOperatorParams) WithPlatform(platform *string) *VersionServiceOperatorParams { o.SetPlatform(platform) @@ -287,6 +390,17 @@ func (o *VersionServiceOperatorParams) SetPlatform(platform *string) { o.Platform = platform } +// WithPmmEnabled adds the pmmEnabled to the version service operator params +func (o *VersionServiceOperatorParams) WithPmmEnabled(pmmEnabled *bool) *VersionServiceOperatorParams { + o.SetPmmEnabled(pmmEnabled) + return o +} + +// SetPmmEnabled adds the pmmEnabled to the version service operator params +func (o *VersionServiceOperatorParams) SetPmmEnabled(pmmEnabled *bool) { + o.PmmEnabled = pmmEnabled +} + // WithPmmVersion adds the pmmVersion to the version service operator params func (o *VersionServiceOperatorParams) WithPmmVersion(pmmVersion *string) *VersionServiceOperatorParams { o.SetPmmVersion(pmmVersion) @@ -331,6 +445,28 @@ func (o *VersionServiceOperatorParams) SetShardingEnabled(shardingEnabled *bool) o.ShardingEnabled = shardingEnabled } +// WithSidecarsUsed adds the sidecarsUsed to the version service operator params +func (o *VersionServiceOperatorParams) WithSidecarsUsed(sidecarsUsed *bool) *VersionServiceOperatorParams { + o.SetSidecarsUsed(sidecarsUsed) + return o +} + +// SetSidecarsUsed adds the sidecarsUsed to the version service operator params +func (o *VersionServiceOperatorParams) SetSidecarsUsed(sidecarsUsed *bool) { + o.SidecarsUsed = sidecarsUsed +} + +// WithUserManagementEnabled adds the userManagementEnabled to the version service operator params +func (o *VersionServiceOperatorParams) WithUserManagementEnabled(userManagementEnabled *bool) *VersionServiceOperatorParams { + o.SetUserManagementEnabled(userManagementEnabled) + return o +} + +// SetUserManagementEnabled adds the userManagementEnabled to the version service operator params +func (o *VersionServiceOperatorParams) SetUserManagementEnabled(userManagementEnabled *bool) { + o.UserManagementEnabled = userManagementEnabled +} + // WriteToRequest writes these params to a swagger request func (o *VersionServiceOperatorParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -356,6 +492,40 @@ func (o *VersionServiceOperatorParams) WriteToRequest(r runtime.ClientRequest, r } } + if o.BackupsEnabled != nil { + + // query param backupsEnabled + var qrBackupsEnabled bool + + if o.BackupsEnabled != nil { + qrBackupsEnabled = *o.BackupsEnabled + } + qBackupsEnabled := swag.FormatBool(qrBackupsEnabled) + if qBackupsEnabled != "" { + + if err := r.SetQueryParam("backupsEnabled", qBackupsEnabled); err != nil { + return err + } + } + } + + if o.ClusterSize != nil { + + // query param clusterSize + var qrClusterSize int32 + + if o.ClusterSize != nil { + qrClusterSize = *o.ClusterSize + } + qClusterSize := swag.FormatInt32(qrClusterSize) + if qClusterSize != "" { + + if err := r.SetQueryParam("clusterSize", qClusterSize); err != nil { + return err + } + } + } + if o.ClusterWideEnabled != nil { // query param clusterWideEnabled @@ -407,6 +577,23 @@ func (o *VersionServiceOperatorParams) WriteToRequest(r runtime.ClientRequest, r } } + if o.Extensions != nil { + + // query param extensions + var qrExtensions string + + if o.Extensions != nil { + qrExtensions = *o.Extensions + } + qExtensions := qrExtensions + if qExtensions != "" { + + if err := r.SetQueryParam("extensions", qExtensions); err != nil { + return err + } + } + } + if o.HaproxyVersion != nil { // query param haproxyVersion @@ -441,6 +628,40 @@ func (o *VersionServiceOperatorParams) WriteToRequest(r runtime.ClientRequest, r } } + if o.HelmDeployCr != nil { + + // query param helmDeployCr + var qrHelmDeployCr bool + + if o.HelmDeployCr != nil { + qrHelmDeployCr = *o.HelmDeployCr + } + qHelmDeployCr := swag.FormatBool(qrHelmDeployCr) + if qHelmDeployCr != "" { + + if err := r.SetQueryParam("helmDeployCr", qHelmDeployCr); err != nil { + return err + } + } + } + + if o.HelmDeployOperator != nil { + + // query param helmDeployOperator + var qrHelmDeployOperator bool + + if o.HelmDeployOperator != nil { + qrHelmDeployOperator = *o.HelmDeployOperator + } + qHelmDeployOperator := swag.FormatBool(qrHelmDeployOperator) + if qHelmDeployOperator != "" { + + if err := r.SetQueryParam("helmDeployOperator", qHelmDeployOperator); err != nil { + return err + } + } + } + if o.KubeVersion != nil { // query param kubeVersion @@ -497,6 +718,40 @@ func (o *VersionServiceOperatorParams) WriteToRequest(r runtime.ClientRequest, r return err } + if o.PhysicalBackupScheduled != nil { + + // query param physicalBackupScheduled + var qrPhysicalBackupScheduled bool + + if o.PhysicalBackupScheduled != nil { + qrPhysicalBackupScheduled = *o.PhysicalBackupScheduled + } + qPhysicalBackupScheduled := swag.FormatBool(qrPhysicalBackupScheduled) + if qPhysicalBackupScheduled != "" { + + if err := r.SetQueryParam("physicalBackupScheduled", qPhysicalBackupScheduled); err != nil { + return err + } + } + } + + if o.PitrEnabled != nil { + + // query param pitrEnabled + var qrPitrEnabled bool + + if o.PitrEnabled != nil { + qrPitrEnabled = *o.PitrEnabled + } + qPitrEnabled := swag.FormatBool(qrPitrEnabled) + if qPitrEnabled != "" { + + if err := r.SetQueryParam("pitrEnabled", qPitrEnabled); err != nil { + return err + } + } + } + if o.Platform != nil { // query param platform @@ -514,6 +769,23 @@ func (o *VersionServiceOperatorParams) WriteToRequest(r runtime.ClientRequest, r } } + if o.PmmEnabled != nil { + + // query param pmmEnabled + var qrPmmEnabled bool + + if o.PmmEnabled != nil { + qrPmmEnabled = *o.PmmEnabled + } + qPmmEnabled := swag.FormatBool(qrPmmEnabled) + if qPmmEnabled != "" { + + if err := r.SetQueryParam("pmmEnabled", qPmmEnabled); err != nil { + return err + } + } + } + if o.PmmVersion != nil { // query param pmmVersion @@ -570,6 +842,40 @@ func (o *VersionServiceOperatorParams) WriteToRequest(r runtime.ClientRequest, r } } + if o.SidecarsUsed != nil { + + // query param sidecarsUsed + var qrSidecarsUsed bool + + if o.SidecarsUsed != nil { + qrSidecarsUsed = *o.SidecarsUsed + } + qSidecarsUsed := swag.FormatBool(qrSidecarsUsed) + if qSidecarsUsed != "" { + + if err := r.SetQueryParam("sidecarsUsed", qSidecarsUsed); err != nil { + return err + } + } + } + + if o.UserManagementEnabled != nil { + + // query param userManagementEnabled + var qrUserManagementEnabled bool + + if o.UserManagementEnabled != nil { + qrUserManagementEnabled = *o.UserManagementEnabled + } + qUserManagementEnabled := swag.FormatBool(qrUserManagementEnabled) + if qUserManagementEnabled != "" { + + if err := r.SetQueryParam("userManagementEnabled", qUserManagementEnabled); err != nil { + return err + } + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/version/client/version_service/version_service_operator_responses.go b/version/client/version_service/version_service_operator_responses.go index 88f2a8dfcc..a4af7f3ebc 100644 --- a/version/client/version_service/version_service_operator_responses.go +++ b/version/client/version_service/version_service_operator_responses.go @@ -6,6 +6,7 @@ package version_service // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -55,9 +56,46 @@ type VersionServiceOperatorOK struct { Payload *models.VersionOperatorResponse } +// IsSuccess returns true when this version service operator o k response has a 2xx status code +func (o *VersionServiceOperatorOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this version service operator o k response has a 3xx status code +func (o *VersionServiceOperatorOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this version service operator o k response has a 4xx status code +func (o *VersionServiceOperatorOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this version service operator o k response has a 5xx status code +func (o *VersionServiceOperatorOK) IsServerError() bool { + return false +} + +// IsCode returns true when this version service operator o k response a status code equal to that given +func (o *VersionServiceOperatorOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the version service operator o k response +func (o *VersionServiceOperatorOK) Code() int { + return 200 +} + func (o *VersionServiceOperatorOK) Error() string { - return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}][%d] versionServiceOperatorOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}][%d] versionServiceOperatorOK %s", 200, payload) +} + +func (o *VersionServiceOperatorOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}][%d] versionServiceOperatorOK %s", 200, payload) } + func (o *VersionServiceOperatorOK) GetPayload() *models.VersionOperatorResponse { return o.Payload } @@ -84,7 +122,7 @@ func NewVersionServiceOperatorDefault(code int) *VersionServiceOperatorDefault { /* VersionServiceOperatorDefault describes a response with status code -1, with default header values. -An unexpected error response +An unexpected error response. */ type VersionServiceOperatorDefault struct { _statusCode int @@ -92,14 +130,46 @@ type VersionServiceOperatorDefault struct { Payload *models.GooglerpcStatus } +// IsSuccess returns true when this version service operator default response has a 2xx status code +func (o *VersionServiceOperatorDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this version service operator default response has a 3xx status code +func (o *VersionServiceOperatorDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this version service operator default response has a 4xx status code +func (o *VersionServiceOperatorDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this version service operator default response has a 5xx status code +func (o *VersionServiceOperatorDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this version service operator default response a status code equal to that given +func (o *VersionServiceOperatorDefault) IsCode(code int) bool { + return o._statusCode == code +} + // Code gets the status code for the version service operator default response func (o *VersionServiceOperatorDefault) Code() int { return o._statusCode } func (o *VersionServiceOperatorDefault) Error() string { - return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}][%d] VersionService_Operator default %+v", o._statusCode, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}][%d] VersionService_Operator default %s", o._statusCode, payload) } + +func (o *VersionServiceOperatorDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}/{operatorVersion}][%d] VersionService_Operator default %s", o._statusCode, payload) +} + func (o *VersionServiceOperatorDefault) GetPayload() *models.GooglerpcStatus { return o.Payload } diff --git a/version/client/version_service/version_service_product_parameters.go b/version/client/version_service/version_service_product_parameters.go index cb82db85d1..22a03d3adc 100644 --- a/version/client/version_service/version_service_product_parameters.go +++ b/version/client/version_service/version_service_product_parameters.go @@ -65,9 +65,15 @@ type VersionServiceProductParams struct { // BackupVersion. BackupVersion *string - // ClusterWideEnabled. + // BackupsEnabled. + BackupsEnabled *bool + + // ClusterSize. // - // Format: boolean + // Format: int32 + ClusterSize *int32 + + // ClusterWideEnabled. ClusterWideEnabled *bool // CustomResourceUID. @@ -76,14 +82,21 @@ type VersionServiceProductParams struct { // DatabaseVersion. DatabaseVersion *string + // Extensions. + Extensions *string + // HaproxyVersion. HaproxyVersion *string // HashicorpVaultEnabled. - // - // Format: boolean HashicorpVaultEnabled *bool + // HelmDeployCr. + HelmDeployCr *bool + + // HelmDeployOperator. + HelmDeployOperator *bool + // KubeVersion. KubeVersion *string @@ -93,9 +106,18 @@ type VersionServiceProductParams struct { // NamespaceUID. NamespaceUID *string + // PhysicalBackupScheduled. + PhysicalBackupScheduled *bool + + // PitrEnabled. + PitrEnabled *bool + // Platform. Platform *string + // PmmEnabled. + PmmEnabled *bool + // PmmVersion. PmmVersion *string @@ -106,10 +128,14 @@ type VersionServiceProductParams struct { ProxysqlVersion *string // ShardingEnabled. - // - // Format: boolean ShardingEnabled *bool + // SidecarsUsed. + SidecarsUsed *bool + + // UserManagementEnabled. + UserManagementEnabled *bool + timeout time.Duration Context context.Context HTTPClient *http.Client @@ -174,6 +200,28 @@ func (o *VersionServiceProductParams) SetBackupVersion(backupVersion *string) { o.BackupVersion = backupVersion } +// WithBackupsEnabled adds the backupsEnabled to the version service product params +func (o *VersionServiceProductParams) WithBackupsEnabled(backupsEnabled *bool) *VersionServiceProductParams { + o.SetBackupsEnabled(backupsEnabled) + return o +} + +// SetBackupsEnabled adds the backupsEnabled to the version service product params +func (o *VersionServiceProductParams) SetBackupsEnabled(backupsEnabled *bool) { + o.BackupsEnabled = backupsEnabled +} + +// WithClusterSize adds the clusterSize to the version service product params +func (o *VersionServiceProductParams) WithClusterSize(clusterSize *int32) *VersionServiceProductParams { + o.SetClusterSize(clusterSize) + return o +} + +// SetClusterSize adds the clusterSize to the version service product params +func (o *VersionServiceProductParams) SetClusterSize(clusterSize *int32) { + o.ClusterSize = clusterSize +} + // WithClusterWideEnabled adds the clusterWideEnabled to the version service product params func (o *VersionServiceProductParams) WithClusterWideEnabled(clusterWideEnabled *bool) *VersionServiceProductParams { o.SetClusterWideEnabled(clusterWideEnabled) @@ -207,6 +255,17 @@ func (o *VersionServiceProductParams) SetDatabaseVersion(databaseVersion *string o.DatabaseVersion = databaseVersion } +// WithExtensions adds the extensions to the version service product params +func (o *VersionServiceProductParams) WithExtensions(extensions *string) *VersionServiceProductParams { + o.SetExtensions(extensions) + return o +} + +// SetExtensions adds the extensions to the version service product params +func (o *VersionServiceProductParams) SetExtensions(extensions *string) { + o.Extensions = extensions +} + // WithHaproxyVersion adds the haproxyVersion to the version service product params func (o *VersionServiceProductParams) WithHaproxyVersion(haproxyVersion *string) *VersionServiceProductParams { o.SetHaproxyVersion(haproxyVersion) @@ -229,6 +288,28 @@ func (o *VersionServiceProductParams) SetHashicorpVaultEnabled(hashicorpVaultEna o.HashicorpVaultEnabled = hashicorpVaultEnabled } +// WithHelmDeployCr adds the helmDeployCr to the version service product params +func (o *VersionServiceProductParams) WithHelmDeployCr(helmDeployCr *bool) *VersionServiceProductParams { + o.SetHelmDeployCr(helmDeployCr) + return o +} + +// SetHelmDeployCr adds the helmDeployCr to the version service product params +func (o *VersionServiceProductParams) SetHelmDeployCr(helmDeployCr *bool) { + o.HelmDeployCr = helmDeployCr +} + +// WithHelmDeployOperator adds the helmDeployOperator to the version service product params +func (o *VersionServiceProductParams) WithHelmDeployOperator(helmDeployOperator *bool) *VersionServiceProductParams { + o.SetHelmDeployOperator(helmDeployOperator) + return o +} + +// SetHelmDeployOperator adds the helmDeployOperator to the version service product params +func (o *VersionServiceProductParams) SetHelmDeployOperator(helmDeployOperator *bool) { + o.HelmDeployOperator = helmDeployOperator +} + // WithKubeVersion adds the kubeVersion to the version service product params func (o *VersionServiceProductParams) WithKubeVersion(kubeVersion *string) *VersionServiceProductParams { o.SetKubeVersion(kubeVersion) @@ -262,6 +343,28 @@ func (o *VersionServiceProductParams) SetNamespaceUID(namespaceUID *string) { o.NamespaceUID = namespaceUID } +// WithPhysicalBackupScheduled adds the physicalBackupScheduled to the version service product params +func (o *VersionServiceProductParams) WithPhysicalBackupScheduled(physicalBackupScheduled *bool) *VersionServiceProductParams { + o.SetPhysicalBackupScheduled(physicalBackupScheduled) + return o +} + +// SetPhysicalBackupScheduled adds the physicalBackupScheduled to the version service product params +func (o *VersionServiceProductParams) SetPhysicalBackupScheduled(physicalBackupScheduled *bool) { + o.PhysicalBackupScheduled = physicalBackupScheduled +} + +// WithPitrEnabled adds the pitrEnabled to the version service product params +func (o *VersionServiceProductParams) WithPitrEnabled(pitrEnabled *bool) *VersionServiceProductParams { + o.SetPitrEnabled(pitrEnabled) + return o +} + +// SetPitrEnabled adds the pitrEnabled to the version service product params +func (o *VersionServiceProductParams) SetPitrEnabled(pitrEnabled *bool) { + o.PitrEnabled = pitrEnabled +} + // WithPlatform adds the platform to the version service product params func (o *VersionServiceProductParams) WithPlatform(platform *string) *VersionServiceProductParams { o.SetPlatform(platform) @@ -273,6 +376,17 @@ func (o *VersionServiceProductParams) SetPlatform(platform *string) { o.Platform = platform } +// WithPmmEnabled adds the pmmEnabled to the version service product params +func (o *VersionServiceProductParams) WithPmmEnabled(pmmEnabled *bool) *VersionServiceProductParams { + o.SetPmmEnabled(pmmEnabled) + return o +} + +// SetPmmEnabled adds the pmmEnabled to the version service product params +func (o *VersionServiceProductParams) SetPmmEnabled(pmmEnabled *bool) { + o.PmmEnabled = pmmEnabled +} + // WithPmmVersion adds the pmmVersion to the version service product params func (o *VersionServiceProductParams) WithPmmVersion(pmmVersion *string) *VersionServiceProductParams { o.SetPmmVersion(pmmVersion) @@ -317,6 +431,28 @@ func (o *VersionServiceProductParams) SetShardingEnabled(shardingEnabled *bool) o.ShardingEnabled = shardingEnabled } +// WithSidecarsUsed adds the sidecarsUsed to the version service product params +func (o *VersionServiceProductParams) WithSidecarsUsed(sidecarsUsed *bool) *VersionServiceProductParams { + o.SetSidecarsUsed(sidecarsUsed) + return o +} + +// SetSidecarsUsed adds the sidecarsUsed to the version service product params +func (o *VersionServiceProductParams) SetSidecarsUsed(sidecarsUsed *bool) { + o.SidecarsUsed = sidecarsUsed +} + +// WithUserManagementEnabled adds the userManagementEnabled to the version service product params +func (o *VersionServiceProductParams) WithUserManagementEnabled(userManagementEnabled *bool) *VersionServiceProductParams { + o.SetUserManagementEnabled(userManagementEnabled) + return o +} + +// SetUserManagementEnabled adds the userManagementEnabled to the version service product params +func (o *VersionServiceProductParams) SetUserManagementEnabled(userManagementEnabled *bool) { + o.UserManagementEnabled = userManagementEnabled +} + // WriteToRequest writes these params to a swagger request func (o *VersionServiceProductParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -342,6 +478,40 @@ func (o *VersionServiceProductParams) WriteToRequest(r runtime.ClientRequest, re } } + if o.BackupsEnabled != nil { + + // query param backupsEnabled + var qrBackupsEnabled bool + + if o.BackupsEnabled != nil { + qrBackupsEnabled = *o.BackupsEnabled + } + qBackupsEnabled := swag.FormatBool(qrBackupsEnabled) + if qBackupsEnabled != "" { + + if err := r.SetQueryParam("backupsEnabled", qBackupsEnabled); err != nil { + return err + } + } + } + + if o.ClusterSize != nil { + + // query param clusterSize + var qrClusterSize int32 + + if o.ClusterSize != nil { + qrClusterSize = *o.ClusterSize + } + qClusterSize := swag.FormatInt32(qrClusterSize) + if qClusterSize != "" { + + if err := r.SetQueryParam("clusterSize", qClusterSize); err != nil { + return err + } + } + } + if o.ClusterWideEnabled != nil { // query param clusterWideEnabled @@ -393,6 +563,23 @@ func (o *VersionServiceProductParams) WriteToRequest(r runtime.ClientRequest, re } } + if o.Extensions != nil { + + // query param extensions + var qrExtensions string + + if o.Extensions != nil { + qrExtensions = *o.Extensions + } + qExtensions := qrExtensions + if qExtensions != "" { + + if err := r.SetQueryParam("extensions", qExtensions); err != nil { + return err + } + } + } + if o.HaproxyVersion != nil { // query param haproxyVersion @@ -427,6 +614,40 @@ func (o *VersionServiceProductParams) WriteToRequest(r runtime.ClientRequest, re } } + if o.HelmDeployCr != nil { + + // query param helmDeployCr + var qrHelmDeployCr bool + + if o.HelmDeployCr != nil { + qrHelmDeployCr = *o.HelmDeployCr + } + qHelmDeployCr := swag.FormatBool(qrHelmDeployCr) + if qHelmDeployCr != "" { + + if err := r.SetQueryParam("helmDeployCr", qHelmDeployCr); err != nil { + return err + } + } + } + + if o.HelmDeployOperator != nil { + + // query param helmDeployOperator + var qrHelmDeployOperator bool + + if o.HelmDeployOperator != nil { + qrHelmDeployOperator = *o.HelmDeployOperator + } + qHelmDeployOperator := swag.FormatBool(qrHelmDeployOperator) + if qHelmDeployOperator != "" { + + if err := r.SetQueryParam("helmDeployOperator", qHelmDeployOperator); err != nil { + return err + } + } + } + if o.KubeVersion != nil { // query param kubeVersion @@ -478,6 +699,40 @@ func (o *VersionServiceProductParams) WriteToRequest(r runtime.ClientRequest, re } } + if o.PhysicalBackupScheduled != nil { + + // query param physicalBackupScheduled + var qrPhysicalBackupScheduled bool + + if o.PhysicalBackupScheduled != nil { + qrPhysicalBackupScheduled = *o.PhysicalBackupScheduled + } + qPhysicalBackupScheduled := swag.FormatBool(qrPhysicalBackupScheduled) + if qPhysicalBackupScheduled != "" { + + if err := r.SetQueryParam("physicalBackupScheduled", qPhysicalBackupScheduled); err != nil { + return err + } + } + } + + if o.PitrEnabled != nil { + + // query param pitrEnabled + var qrPitrEnabled bool + + if o.PitrEnabled != nil { + qrPitrEnabled = *o.PitrEnabled + } + qPitrEnabled := swag.FormatBool(qrPitrEnabled) + if qPitrEnabled != "" { + + if err := r.SetQueryParam("pitrEnabled", qPitrEnabled); err != nil { + return err + } + } + } + if o.Platform != nil { // query param platform @@ -495,6 +750,23 @@ func (o *VersionServiceProductParams) WriteToRequest(r runtime.ClientRequest, re } } + if o.PmmEnabled != nil { + + // query param pmmEnabled + var qrPmmEnabled bool + + if o.PmmEnabled != nil { + qrPmmEnabled = *o.PmmEnabled + } + qPmmEnabled := swag.FormatBool(qrPmmEnabled) + if qPmmEnabled != "" { + + if err := r.SetQueryParam("pmmEnabled", qPmmEnabled); err != nil { + return err + } + } + } + if o.PmmVersion != nil { // query param pmmVersion @@ -551,6 +823,40 @@ func (o *VersionServiceProductParams) WriteToRequest(r runtime.ClientRequest, re } } + if o.SidecarsUsed != nil { + + // query param sidecarsUsed + var qrSidecarsUsed bool + + if o.SidecarsUsed != nil { + qrSidecarsUsed = *o.SidecarsUsed + } + qSidecarsUsed := swag.FormatBool(qrSidecarsUsed) + if qSidecarsUsed != "" { + + if err := r.SetQueryParam("sidecarsUsed", qSidecarsUsed); err != nil { + return err + } + } + } + + if o.UserManagementEnabled != nil { + + // query param userManagementEnabled + var qrUserManagementEnabled bool + + if o.UserManagementEnabled != nil { + qrUserManagementEnabled = *o.UserManagementEnabled + } + qUserManagementEnabled := swag.FormatBool(qrUserManagementEnabled) + if qUserManagementEnabled != "" { + + if err := r.SetQueryParam("userManagementEnabled", qUserManagementEnabled); err != nil { + return err + } + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/version/client/version_service/version_service_product_responses.go b/version/client/version_service/version_service_product_responses.go index 74b9e8e4f5..f1c031ae08 100644 --- a/version/client/version_service/version_service_product_responses.go +++ b/version/client/version_service/version_service_product_responses.go @@ -6,6 +6,7 @@ package version_service // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -55,9 +56,46 @@ type VersionServiceProductOK struct { Payload *models.VersionProductResponse } +// IsSuccess returns true when this version service product o k response has a 2xx status code +func (o *VersionServiceProductOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this version service product o k response has a 3xx status code +func (o *VersionServiceProductOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this version service product o k response has a 4xx status code +func (o *VersionServiceProductOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this version service product o k response has a 5xx status code +func (o *VersionServiceProductOK) IsServerError() bool { + return false +} + +// IsCode returns true when this version service product o k response a status code equal to that given +func (o *VersionServiceProductOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the version service product o k response +func (o *VersionServiceProductOK) Code() int { + return 200 +} + func (o *VersionServiceProductOK) Error() string { - return fmt.Sprintf("[GET /versions/v1/{product}][%d] versionServiceProductOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}][%d] versionServiceProductOK %s", 200, payload) +} + +func (o *VersionServiceProductOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}][%d] versionServiceProductOK %s", 200, payload) } + func (o *VersionServiceProductOK) GetPayload() *models.VersionProductResponse { return o.Payload } @@ -84,7 +122,7 @@ func NewVersionServiceProductDefault(code int) *VersionServiceProductDefault { /* VersionServiceProductDefault describes a response with status code -1, with default header values. -An unexpected error response +An unexpected error response. */ type VersionServiceProductDefault struct { _statusCode int @@ -92,14 +130,46 @@ type VersionServiceProductDefault struct { Payload *models.GooglerpcStatus } +// IsSuccess returns true when this version service product default response has a 2xx status code +func (o *VersionServiceProductDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this version service product default response has a 3xx status code +func (o *VersionServiceProductDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this version service product default response has a 4xx status code +func (o *VersionServiceProductDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this version service product default response has a 5xx status code +func (o *VersionServiceProductDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this version service product default response a status code equal to that given +func (o *VersionServiceProductDefault) IsCode(code int) bool { + return o._statusCode == code +} + // Code gets the status code for the version service product default response func (o *VersionServiceProductDefault) Code() int { return o._statusCode } func (o *VersionServiceProductDefault) Error() string { - return fmt.Sprintf("[GET /versions/v1/{product}][%d] VersionService_Product default %+v", o._statusCode, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}][%d] VersionService_Product default %s", o._statusCode, payload) } + +func (o *VersionServiceProductDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /versions/v1/{product}][%d] VersionService_Product default %s", o._statusCode, payload) +} + func (o *VersionServiceProductDefault) GetPayload() *models.GooglerpcStatus { return o.Payload }