github.com/percona/percona-xtradb-cluster-operator@v1.14.0/version/client/version_service/version_service_apply_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package version_service
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  	"net/http"
    11  	"time"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/runtime"
    15  	cr "github.com/go-openapi/runtime/client"
    16  	"github.com/go-openapi/strfmt"
    17  	"github.com/go-openapi/swag"
    18  )
    19  
    20  // NewVersionServiceApplyParams creates a new VersionServiceApplyParams object,
    21  // with the default timeout for this client.
    22  //
    23  // Default values are not hydrated, since defaults are normally applied by the API server side.
    24  //
    25  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    26  func NewVersionServiceApplyParams() *VersionServiceApplyParams {
    27  	return &VersionServiceApplyParams{
    28  		timeout: cr.DefaultTimeout,
    29  	}
    30  }
    31  
    32  // NewVersionServiceApplyParamsWithTimeout creates a new VersionServiceApplyParams object
    33  // with the ability to set a timeout on a request.
    34  func NewVersionServiceApplyParamsWithTimeout(timeout time.Duration) *VersionServiceApplyParams {
    35  	return &VersionServiceApplyParams{
    36  		timeout: timeout,
    37  	}
    38  }
    39  
    40  // NewVersionServiceApplyParamsWithContext creates a new VersionServiceApplyParams object
    41  // with the ability to set a context for a request.
    42  func NewVersionServiceApplyParamsWithContext(ctx context.Context) *VersionServiceApplyParams {
    43  	return &VersionServiceApplyParams{
    44  		Context: ctx,
    45  	}
    46  }
    47  
    48  // NewVersionServiceApplyParamsWithHTTPClient creates a new VersionServiceApplyParams object
    49  // with the ability to set a custom HTTPClient for a request.
    50  func NewVersionServiceApplyParamsWithHTTPClient(client *http.Client) *VersionServiceApplyParams {
    51  	return &VersionServiceApplyParams{
    52  		HTTPClient: client,
    53  	}
    54  }
    55  
    56  /*
    57  VersionServiceApplyParams contains all the parameters to send to the API endpoint
    58  
    59  	for the version service apply operation.
    60  
    61  	Typically these are written to a http.Request.
    62  */
    63  type VersionServiceApplyParams struct {
    64  
    65  	// Apply.
    66  	Apply string
    67  
    68  	// BackupVersion.
    69  	BackupVersion *string
    70  
    71  	// ClusterWideEnabled.
    72  	//
    73  	// Format: boolean
    74  	ClusterWideEnabled *bool
    75  
    76  	// CustomResourceUID.
    77  	CustomResourceUID *string
    78  
    79  	// DatabaseVersion.
    80  	DatabaseVersion *string
    81  
    82  	// HaproxyVersion.
    83  	HaproxyVersion *string
    84  
    85  	// HashicorpVaultEnabled.
    86  	//
    87  	// Format: boolean
    88  	HashicorpVaultEnabled *bool
    89  
    90  	// KubeVersion.
    91  	KubeVersion *string
    92  
    93  	// LogCollectorVersion.
    94  	LogCollectorVersion *string
    95  
    96  	// NamespaceUID.
    97  	NamespaceUID *string
    98  
    99  	// OperatorVersion.
   100  	OperatorVersion string
   101  
   102  	// Platform.
   103  	Platform *string
   104  
   105  	// PmmVersion.
   106  	PmmVersion *string
   107  
   108  	// Product.
   109  	Product string
   110  
   111  	// ProxysqlVersion.
   112  	ProxysqlVersion *string
   113  
   114  	// ShardingEnabled.
   115  	//
   116  	// Format: boolean
   117  	ShardingEnabled *bool
   118  
   119  	timeout    time.Duration
   120  	Context    context.Context
   121  	HTTPClient *http.Client
   122  }
   123  
   124  // WithDefaults hydrates default values in the version service apply params (not the query body).
   125  //
   126  // All values with no default are reset to their zero value.
   127  func (o *VersionServiceApplyParams) WithDefaults() *VersionServiceApplyParams {
   128  	o.SetDefaults()
   129  	return o
   130  }
   131  
   132  // SetDefaults hydrates default values in the version service apply params (not the query body).
   133  //
   134  // All values with no default are reset to their zero value.
   135  func (o *VersionServiceApplyParams) SetDefaults() {
   136  	// no default values defined for this parameter
   137  }
   138  
   139  // WithTimeout adds the timeout to the version service apply params
   140  func (o *VersionServiceApplyParams) WithTimeout(timeout time.Duration) *VersionServiceApplyParams {
   141  	o.SetTimeout(timeout)
   142  	return o
   143  }
   144  
   145  // SetTimeout adds the timeout to the version service apply params
   146  func (o *VersionServiceApplyParams) SetTimeout(timeout time.Duration) {
   147  	o.timeout = timeout
   148  }
   149  
   150  // WithContext adds the context to the version service apply params
   151  func (o *VersionServiceApplyParams) WithContext(ctx context.Context) *VersionServiceApplyParams {
   152  	o.SetContext(ctx)
   153  	return o
   154  }
   155  
   156  // SetContext adds the context to the version service apply params
   157  func (o *VersionServiceApplyParams) SetContext(ctx context.Context) {
   158  	o.Context = ctx
   159  }
   160  
   161  // WithHTTPClient adds the HTTPClient to the version service apply params
   162  func (o *VersionServiceApplyParams) WithHTTPClient(client *http.Client) *VersionServiceApplyParams {
   163  	o.SetHTTPClient(client)
   164  	return o
   165  }
   166  
   167  // SetHTTPClient adds the HTTPClient to the version service apply params
   168  func (o *VersionServiceApplyParams) SetHTTPClient(client *http.Client) {
   169  	o.HTTPClient = client
   170  }
   171  
   172  // WithApply adds the apply to the version service apply params
   173  func (o *VersionServiceApplyParams) WithApply(apply string) *VersionServiceApplyParams {
   174  	o.SetApply(apply)
   175  	return o
   176  }
   177  
   178  // SetApply adds the apply to the version service apply params
   179  func (o *VersionServiceApplyParams) SetApply(apply string) {
   180  	o.Apply = apply
   181  }
   182  
   183  // WithBackupVersion adds the backupVersion to the version service apply params
   184  func (o *VersionServiceApplyParams) WithBackupVersion(backupVersion *string) *VersionServiceApplyParams {
   185  	o.SetBackupVersion(backupVersion)
   186  	return o
   187  }
   188  
   189  // SetBackupVersion adds the backupVersion to the version service apply params
   190  func (o *VersionServiceApplyParams) SetBackupVersion(backupVersion *string) {
   191  	o.BackupVersion = backupVersion
   192  }
   193  
   194  // WithClusterWideEnabled adds the clusterWideEnabled to the version service apply params
   195  func (o *VersionServiceApplyParams) WithClusterWideEnabled(clusterWideEnabled *bool) *VersionServiceApplyParams {
   196  	o.SetClusterWideEnabled(clusterWideEnabled)
   197  	return o
   198  }
   199  
   200  // SetClusterWideEnabled adds the clusterWideEnabled to the version service apply params
   201  func (o *VersionServiceApplyParams) SetClusterWideEnabled(clusterWideEnabled *bool) {
   202  	o.ClusterWideEnabled = clusterWideEnabled
   203  }
   204  
   205  // WithCustomResourceUID adds the customResourceUID to the version service apply params
   206  func (o *VersionServiceApplyParams) WithCustomResourceUID(customResourceUID *string) *VersionServiceApplyParams {
   207  	o.SetCustomResourceUID(customResourceUID)
   208  	return o
   209  }
   210  
   211  // SetCustomResourceUID adds the customResourceUid to the version service apply params
   212  func (o *VersionServiceApplyParams) SetCustomResourceUID(customResourceUID *string) {
   213  	o.CustomResourceUID = customResourceUID
   214  }
   215  
   216  // WithDatabaseVersion adds the databaseVersion to the version service apply params
   217  func (o *VersionServiceApplyParams) WithDatabaseVersion(databaseVersion *string) *VersionServiceApplyParams {
   218  	o.SetDatabaseVersion(databaseVersion)
   219  	return o
   220  }
   221  
   222  // SetDatabaseVersion adds the databaseVersion to the version service apply params
   223  func (o *VersionServiceApplyParams) SetDatabaseVersion(databaseVersion *string) {
   224  	o.DatabaseVersion = databaseVersion
   225  }
   226  
   227  // WithHaproxyVersion adds the haproxyVersion to the version service apply params
   228  func (o *VersionServiceApplyParams) WithHaproxyVersion(haproxyVersion *string) *VersionServiceApplyParams {
   229  	o.SetHaproxyVersion(haproxyVersion)
   230  	return o
   231  }
   232  
   233  // SetHaproxyVersion adds the haproxyVersion to the version service apply params
   234  func (o *VersionServiceApplyParams) SetHaproxyVersion(haproxyVersion *string) {
   235  	o.HaproxyVersion = haproxyVersion
   236  }
   237  
   238  // WithHashicorpVaultEnabled adds the hashicorpVaultEnabled to the version service apply params
   239  func (o *VersionServiceApplyParams) WithHashicorpVaultEnabled(hashicorpVaultEnabled *bool) *VersionServiceApplyParams {
   240  	o.SetHashicorpVaultEnabled(hashicorpVaultEnabled)
   241  	return o
   242  }
   243  
   244  // SetHashicorpVaultEnabled adds the hashicorpVaultEnabled to the version service apply params
   245  func (o *VersionServiceApplyParams) SetHashicorpVaultEnabled(hashicorpVaultEnabled *bool) {
   246  	o.HashicorpVaultEnabled = hashicorpVaultEnabled
   247  }
   248  
   249  // WithKubeVersion adds the kubeVersion to the version service apply params
   250  func (o *VersionServiceApplyParams) WithKubeVersion(kubeVersion *string) *VersionServiceApplyParams {
   251  	o.SetKubeVersion(kubeVersion)
   252  	return o
   253  }
   254  
   255  // SetKubeVersion adds the kubeVersion to the version service apply params
   256  func (o *VersionServiceApplyParams) SetKubeVersion(kubeVersion *string) {
   257  	o.KubeVersion = kubeVersion
   258  }
   259  
   260  // WithLogCollectorVersion adds the logCollectorVersion to the version service apply params
   261  func (o *VersionServiceApplyParams) WithLogCollectorVersion(logCollectorVersion *string) *VersionServiceApplyParams {
   262  	o.SetLogCollectorVersion(logCollectorVersion)
   263  	return o
   264  }
   265  
   266  // SetLogCollectorVersion adds the logCollectorVersion to the version service apply params
   267  func (o *VersionServiceApplyParams) SetLogCollectorVersion(logCollectorVersion *string) {
   268  	o.LogCollectorVersion = logCollectorVersion
   269  }
   270  
   271  // WithNamespaceUID adds the namespaceUID to the version service apply params
   272  func (o *VersionServiceApplyParams) WithNamespaceUID(namespaceUID *string) *VersionServiceApplyParams {
   273  	o.SetNamespaceUID(namespaceUID)
   274  	return o
   275  }
   276  
   277  // SetNamespaceUID adds the namespaceUid to the version service apply params
   278  func (o *VersionServiceApplyParams) SetNamespaceUID(namespaceUID *string) {
   279  	o.NamespaceUID = namespaceUID
   280  }
   281  
   282  // WithOperatorVersion adds the operatorVersion to the version service apply params
   283  func (o *VersionServiceApplyParams) WithOperatorVersion(operatorVersion string) *VersionServiceApplyParams {
   284  	o.SetOperatorVersion(operatorVersion)
   285  	return o
   286  }
   287  
   288  // SetOperatorVersion adds the operatorVersion to the version service apply params
   289  func (o *VersionServiceApplyParams) SetOperatorVersion(operatorVersion string) {
   290  	o.OperatorVersion = operatorVersion
   291  }
   292  
   293  // WithPlatform adds the platform to the version service apply params
   294  func (o *VersionServiceApplyParams) WithPlatform(platform *string) *VersionServiceApplyParams {
   295  	o.SetPlatform(platform)
   296  	return o
   297  }
   298  
   299  // SetPlatform adds the platform to the version service apply params
   300  func (o *VersionServiceApplyParams) SetPlatform(platform *string) {
   301  	o.Platform = platform
   302  }
   303  
   304  // WithPmmVersion adds the pmmVersion to the version service apply params
   305  func (o *VersionServiceApplyParams) WithPmmVersion(pmmVersion *string) *VersionServiceApplyParams {
   306  	o.SetPmmVersion(pmmVersion)
   307  	return o
   308  }
   309  
   310  // SetPmmVersion adds the pmmVersion to the version service apply params
   311  func (o *VersionServiceApplyParams) SetPmmVersion(pmmVersion *string) {
   312  	o.PmmVersion = pmmVersion
   313  }
   314  
   315  // WithProduct adds the product to the version service apply params
   316  func (o *VersionServiceApplyParams) WithProduct(product string) *VersionServiceApplyParams {
   317  	o.SetProduct(product)
   318  	return o
   319  }
   320  
   321  // SetProduct adds the product to the version service apply params
   322  func (o *VersionServiceApplyParams) SetProduct(product string) {
   323  	o.Product = product
   324  }
   325  
   326  // WithProxysqlVersion adds the proxysqlVersion to the version service apply params
   327  func (o *VersionServiceApplyParams) WithProxysqlVersion(proxysqlVersion *string) *VersionServiceApplyParams {
   328  	o.SetProxysqlVersion(proxysqlVersion)
   329  	return o
   330  }
   331  
   332  // SetProxysqlVersion adds the proxysqlVersion to the version service apply params
   333  func (o *VersionServiceApplyParams) SetProxysqlVersion(proxysqlVersion *string) {
   334  	o.ProxysqlVersion = proxysqlVersion
   335  }
   336  
   337  // WithShardingEnabled adds the shardingEnabled to the version service apply params
   338  func (o *VersionServiceApplyParams) WithShardingEnabled(shardingEnabled *bool) *VersionServiceApplyParams {
   339  	o.SetShardingEnabled(shardingEnabled)
   340  	return o
   341  }
   342  
   343  // SetShardingEnabled adds the shardingEnabled to the version service apply params
   344  func (o *VersionServiceApplyParams) SetShardingEnabled(shardingEnabled *bool) {
   345  	o.ShardingEnabled = shardingEnabled
   346  }
   347  
   348  // WriteToRequest writes these params to a swagger request
   349  func (o *VersionServiceApplyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   350  
   351  	if err := r.SetTimeout(o.timeout); err != nil {
   352  		return err
   353  	}
   354  	var res []error
   355  
   356  	// path param apply
   357  	if err := r.SetPathParam("apply", o.Apply); err != nil {
   358  		return err
   359  	}
   360  
   361  	if o.BackupVersion != nil {
   362  
   363  		// query param backupVersion
   364  		var qrBackupVersion string
   365  
   366  		if o.BackupVersion != nil {
   367  			qrBackupVersion = *o.BackupVersion
   368  		}
   369  		qBackupVersion := qrBackupVersion
   370  		if qBackupVersion != "" {
   371  
   372  			if err := r.SetQueryParam("backupVersion", qBackupVersion); err != nil {
   373  				return err
   374  			}
   375  		}
   376  	}
   377  
   378  	if o.ClusterWideEnabled != nil {
   379  
   380  		// query param clusterWideEnabled
   381  		var qrClusterWideEnabled bool
   382  
   383  		if o.ClusterWideEnabled != nil {
   384  			qrClusterWideEnabled = *o.ClusterWideEnabled
   385  		}
   386  		qClusterWideEnabled := swag.FormatBool(qrClusterWideEnabled)
   387  		if qClusterWideEnabled != "" {
   388  
   389  			if err := r.SetQueryParam("clusterWideEnabled", qClusterWideEnabled); err != nil {
   390  				return err
   391  			}
   392  		}
   393  	}
   394  
   395  	if o.CustomResourceUID != nil {
   396  
   397  		// query param customResourceUid
   398  		var qrCustomResourceUID string
   399  
   400  		if o.CustomResourceUID != nil {
   401  			qrCustomResourceUID = *o.CustomResourceUID
   402  		}
   403  		qCustomResourceUID := qrCustomResourceUID
   404  		if qCustomResourceUID != "" {
   405  
   406  			if err := r.SetQueryParam("customResourceUid", qCustomResourceUID); err != nil {
   407  				return err
   408  			}
   409  		}
   410  	}
   411  
   412  	if o.DatabaseVersion != nil {
   413  
   414  		// query param databaseVersion
   415  		var qrDatabaseVersion string
   416  
   417  		if o.DatabaseVersion != nil {
   418  			qrDatabaseVersion = *o.DatabaseVersion
   419  		}
   420  		qDatabaseVersion := qrDatabaseVersion
   421  		if qDatabaseVersion != "" {
   422  
   423  			if err := r.SetQueryParam("databaseVersion", qDatabaseVersion); err != nil {
   424  				return err
   425  			}
   426  		}
   427  	}
   428  
   429  	if o.HaproxyVersion != nil {
   430  
   431  		// query param haproxyVersion
   432  		var qrHaproxyVersion string
   433  
   434  		if o.HaproxyVersion != nil {
   435  			qrHaproxyVersion = *o.HaproxyVersion
   436  		}
   437  		qHaproxyVersion := qrHaproxyVersion
   438  		if qHaproxyVersion != "" {
   439  
   440  			if err := r.SetQueryParam("haproxyVersion", qHaproxyVersion); err != nil {
   441  				return err
   442  			}
   443  		}
   444  	}
   445  
   446  	if o.HashicorpVaultEnabled != nil {
   447  
   448  		// query param hashicorpVaultEnabled
   449  		var qrHashicorpVaultEnabled bool
   450  
   451  		if o.HashicorpVaultEnabled != nil {
   452  			qrHashicorpVaultEnabled = *o.HashicorpVaultEnabled
   453  		}
   454  		qHashicorpVaultEnabled := swag.FormatBool(qrHashicorpVaultEnabled)
   455  		if qHashicorpVaultEnabled != "" {
   456  
   457  			if err := r.SetQueryParam("hashicorpVaultEnabled", qHashicorpVaultEnabled); err != nil {
   458  				return err
   459  			}
   460  		}
   461  	}
   462  
   463  	if o.KubeVersion != nil {
   464  
   465  		// query param kubeVersion
   466  		var qrKubeVersion string
   467  
   468  		if o.KubeVersion != nil {
   469  			qrKubeVersion = *o.KubeVersion
   470  		}
   471  		qKubeVersion := qrKubeVersion
   472  		if qKubeVersion != "" {
   473  
   474  			if err := r.SetQueryParam("kubeVersion", qKubeVersion); err != nil {
   475  				return err
   476  			}
   477  		}
   478  	}
   479  
   480  	if o.LogCollectorVersion != nil {
   481  
   482  		// query param logCollectorVersion
   483  		var qrLogCollectorVersion string
   484  
   485  		if o.LogCollectorVersion != nil {
   486  			qrLogCollectorVersion = *o.LogCollectorVersion
   487  		}
   488  		qLogCollectorVersion := qrLogCollectorVersion
   489  		if qLogCollectorVersion != "" {
   490  
   491  			if err := r.SetQueryParam("logCollectorVersion", qLogCollectorVersion); err != nil {
   492  				return err
   493  			}
   494  		}
   495  	}
   496  
   497  	if o.NamespaceUID != nil {
   498  
   499  		// query param namespaceUid
   500  		var qrNamespaceUID string
   501  
   502  		if o.NamespaceUID != nil {
   503  			qrNamespaceUID = *o.NamespaceUID
   504  		}
   505  		qNamespaceUID := qrNamespaceUID
   506  		if qNamespaceUID != "" {
   507  
   508  			if err := r.SetQueryParam("namespaceUid", qNamespaceUID); err != nil {
   509  				return err
   510  			}
   511  		}
   512  	}
   513  
   514  	// path param operatorVersion
   515  	if err := r.SetPathParam("operatorVersion", o.OperatorVersion); err != nil {
   516  		return err
   517  	}
   518  
   519  	if o.Platform != nil {
   520  
   521  		// query param platform
   522  		var qrPlatform string
   523  
   524  		if o.Platform != nil {
   525  			qrPlatform = *o.Platform
   526  		}
   527  		qPlatform := qrPlatform
   528  		if qPlatform != "" {
   529  
   530  			if err := r.SetQueryParam("platform", qPlatform); err != nil {
   531  				return err
   532  			}
   533  		}
   534  	}
   535  
   536  	if o.PmmVersion != nil {
   537  
   538  		// query param pmmVersion
   539  		var qrPmmVersion string
   540  
   541  		if o.PmmVersion != nil {
   542  			qrPmmVersion = *o.PmmVersion
   543  		}
   544  		qPmmVersion := qrPmmVersion
   545  		if qPmmVersion != "" {
   546  
   547  			if err := r.SetQueryParam("pmmVersion", qPmmVersion); err != nil {
   548  				return err
   549  			}
   550  		}
   551  	}
   552  
   553  	// path param product
   554  	if err := r.SetPathParam("product", o.Product); err != nil {
   555  		return err
   556  	}
   557  
   558  	if o.ProxysqlVersion != nil {
   559  
   560  		// query param proxysqlVersion
   561  		var qrProxysqlVersion string
   562  
   563  		if o.ProxysqlVersion != nil {
   564  			qrProxysqlVersion = *o.ProxysqlVersion
   565  		}
   566  		qProxysqlVersion := qrProxysqlVersion
   567  		if qProxysqlVersion != "" {
   568  
   569  			if err := r.SetQueryParam("proxysqlVersion", qProxysqlVersion); err != nil {
   570  				return err
   571  			}
   572  		}
   573  	}
   574  
   575  	if o.ShardingEnabled != nil {
   576  
   577  		// query param shardingEnabled
   578  		var qrShardingEnabled bool
   579  
   580  		if o.ShardingEnabled != nil {
   581  			qrShardingEnabled = *o.ShardingEnabled
   582  		}
   583  		qShardingEnabled := swag.FormatBool(qrShardingEnabled)
   584  		if qShardingEnabled != "" {
   585  
   586  			if err := r.SetQueryParam("shardingEnabled", qShardingEnabled); err != nil {
   587  				return err
   588  			}
   589  		}
   590  	}
   591  
   592  	if len(res) > 0 {
   593  		return errors.CompositeValidationError(res...)
   594  	}
   595  	return nil
   596  }