// Code generated by go-swagger; DO NOT EDIT.

package manifests

// 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"
)

// NewV2DownloadClusterManifestParams creates a new V2DownloadClusterManifestParams 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 NewV2DownloadClusterManifestParams() *V2DownloadClusterManifestParams {
	return &V2DownloadClusterManifestParams{
		timeout: cr.DefaultTimeout,
	}
}

// NewV2DownloadClusterManifestParamsWithTimeout creates a new V2DownloadClusterManifestParams object
// with the ability to set a timeout on a request.
func NewV2DownloadClusterManifestParamsWithTimeout(timeout time.Duration) *V2DownloadClusterManifestParams {
	return &V2DownloadClusterManifestParams{
		timeout: timeout,
	}
}

// NewV2DownloadClusterManifestParamsWithContext creates a new V2DownloadClusterManifestParams object
// with the ability to set a context for a request.
func NewV2DownloadClusterManifestParamsWithContext(ctx context.Context) *V2DownloadClusterManifestParams {
	return &V2DownloadClusterManifestParams{
		Context: ctx,
	}
}

// NewV2DownloadClusterManifestParamsWithHTTPClient creates a new V2DownloadClusterManifestParams object
// with the ability to set a custom HTTPClient for a request.
func NewV2DownloadClusterManifestParamsWithHTTPClient(client *http.Client) *V2DownloadClusterManifestParams {
	return &V2DownloadClusterManifestParams{
		HTTPClient: client,
	}
}

/*
V2DownloadClusterManifestParams contains all the parameters to send to the API endpoint

	for the v2 download cluster manifest operation.

	Typically these are written to a http.Request.
*/
type V2DownloadClusterManifestParams struct {

	/* ClusterID.

	   The cluster whose manifest should be downloaded.

	   Format: uuid
	*/
	ClusterID strfmt.UUID

	/* FileName.

	   The manifest file name to download.
	*/
	FileName string

	/* Folder.

	   The folder that contains the files. Manifests can be placed in 'manifests' or 'openshift' directories.

	   Default: "manifests"
	*/
	Folder *string

	timeout    time.Duration
	Context    context.Context
	HTTPClient *http.Client
}

// WithDefaults hydrates default values in the v2 download cluster manifest params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *V2DownloadClusterManifestParams) WithDefaults() *V2DownloadClusterManifestParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the v2 download cluster manifest params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *V2DownloadClusterManifestParams) SetDefaults() {
	var (
		folderDefault = string("manifests")
	)

	val := V2DownloadClusterManifestParams{
		Folder: &folderDefault,
	}

	val.timeout = o.timeout
	val.Context = o.Context
	val.HTTPClient = o.HTTPClient
	*o = val
}

// WithTimeout adds the timeout to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) WithTimeout(timeout time.Duration) *V2DownloadClusterManifestParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) WithContext(ctx context.Context) *V2DownloadClusterManifestParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) WithHTTPClient(client *http.Client) *V2DownloadClusterManifestParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithClusterID adds the clusterID to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) WithClusterID(clusterID strfmt.UUID) *V2DownloadClusterManifestParams {
	o.SetClusterID(clusterID)
	return o
}

// SetClusterID adds the clusterId to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) SetClusterID(clusterID strfmt.UUID) {
	o.ClusterID = clusterID
}

// WithFileName adds the fileName to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) WithFileName(fileName string) *V2DownloadClusterManifestParams {
	o.SetFileName(fileName)
	return o
}

// SetFileName adds the fileName to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) SetFileName(fileName string) {
	o.FileName = fileName
}

// WithFolder adds the folder to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) WithFolder(folder *string) *V2DownloadClusterManifestParams {
	o.SetFolder(folder)
	return o
}

// SetFolder adds the folder to the v2 download cluster manifest params
func (o *V2DownloadClusterManifestParams) SetFolder(folder *string) {
	o.Folder = folder
}

// WriteToRequest writes these params to a swagger request
func (o *V2DownloadClusterManifestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

	if err := r.SetTimeout(o.timeout); err != nil {
		return err
	}
	var res []error

	// path param cluster_id
	if err := r.SetPathParam("cluster_id", o.ClusterID.String()); err != nil {
		return err
	}

	// query param file_name
	qrFileName := o.FileName
	qFileName := qrFileName
	if qFileName != "" {

		if err := r.SetQueryParam("file_name", qFileName); err != nil {
			return err
		}
	}

	if o.Folder != nil {

		// query param folder
		var qrFolder string

		if o.Folder != nil {
			qrFolder = *o.Folder
		}
		qFolder := qrFolder
		if qFolder != "" {

			if err := r.SetQueryParam("folder", qFolder); err != nil {
				return err
			}
		}
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
