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

package p_cloud_volumes

// 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"
	"github.com/go-openapi/swag"
)

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

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

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

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

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

	for the pcloud cloudinstances volumes getall operation.

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

	/* Affinity.

	   A pvmInstance (id or name), limits a volumes list response to only volumes that have affinity to the pvmInstance
	*/
	Affinity *string

	/* Auxiliary.

	   true or false, limits a volume list to auxiliary or non auxiliary volumes
	*/
	Auxiliary *bool

	/* CloudInstanceID.

	   Cloud Instance ID of a PCloud Instance
	*/
	CloudInstanceID string

	/* ReplicationEnabled.

	   true or false, limits a volumes list to replication or non replication enabled volumes
	*/
	ReplicationEnabled *bool

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

// WithDefaults hydrates default values in the pcloud cloudinstances volumes getall params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PcloudCloudinstancesVolumesGetallParams) WithDefaults() *PcloudCloudinstancesVolumesGetallParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the pcloud cloudinstances volumes getall params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PcloudCloudinstancesVolumesGetallParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesGetallParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) WithContext(ctx context.Context) *PcloudCloudinstancesVolumesGetallParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesGetallParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithAffinity adds the affinity to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) WithAffinity(affinity *string) *PcloudCloudinstancesVolumesGetallParams {
	o.SetAffinity(affinity)
	return o
}

// SetAffinity adds the affinity to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) SetAffinity(affinity *string) {
	o.Affinity = affinity
}

// WithAuxiliary adds the auxiliary to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) WithAuxiliary(auxiliary *bool) *PcloudCloudinstancesVolumesGetallParams {
	o.SetAuxiliary(auxiliary)
	return o
}

// SetAuxiliary adds the auxiliary to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) SetAuxiliary(auxiliary *bool) {
	o.Auxiliary = auxiliary
}

// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesVolumesGetallParams {
	o.SetCloudInstanceID(cloudInstanceID)
	return o
}

// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) SetCloudInstanceID(cloudInstanceID string) {
	o.CloudInstanceID = cloudInstanceID
}

// WithReplicationEnabled adds the replicationEnabled to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) WithReplicationEnabled(replicationEnabled *bool) *PcloudCloudinstancesVolumesGetallParams {
	o.SetReplicationEnabled(replicationEnabled)
	return o
}

// SetReplicationEnabled adds the replicationEnabled to the pcloud cloudinstances volumes getall params
func (o *PcloudCloudinstancesVolumesGetallParams) SetReplicationEnabled(replicationEnabled *bool) {
	o.ReplicationEnabled = replicationEnabled
}

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

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

	if o.Affinity != nil {

		// query param affinity
		var qrAffinity string

		if o.Affinity != nil {
			qrAffinity = *o.Affinity
		}
		qAffinity := qrAffinity
		if qAffinity != "" {

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

	if o.Auxiliary != nil {

		// query param auxiliary
		var qrAuxiliary bool

		if o.Auxiliary != nil {
			qrAuxiliary = *o.Auxiliary
		}
		qAuxiliary := swag.FormatBool(qrAuxiliary)
		if qAuxiliary != "" {

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

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

	if o.ReplicationEnabled != nil {

		// query param replicationEnabled
		var qrReplicationEnabled bool

		if o.ReplicationEnabled != nil {
			qrReplicationEnabled = *o.ReplicationEnabled
		}
		qReplicationEnabled := swag.FormatBool(qrReplicationEnabled)
		if qReplicationEnabled != "" {

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

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