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

package run_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"

	strfmt "github.com/go-openapi/strfmt"

	run_model "github.com/kubeflow/pipelines/backend/api/v1beta1/go_http_client/run_model"
)

// NewCreateRunV1Params creates a new CreateRunV1Params object
// with the default values initialized.
func NewCreateRunV1Params() *CreateRunV1Params {
	var ()
	return &CreateRunV1Params{

		timeout: cr.DefaultTimeout,
	}
}

// NewCreateRunV1ParamsWithTimeout creates a new CreateRunV1Params object
// with the default values initialized, and the ability to set a timeout on a request
func NewCreateRunV1ParamsWithTimeout(timeout time.Duration) *CreateRunV1Params {
	var ()
	return &CreateRunV1Params{

		timeout: timeout,
	}
}

// NewCreateRunV1ParamsWithContext creates a new CreateRunV1Params object
// with the default values initialized, and the ability to set a context for a request
func NewCreateRunV1ParamsWithContext(ctx context.Context) *CreateRunV1Params {
	var ()
	return &CreateRunV1Params{

		Context: ctx,
	}
}

// NewCreateRunV1ParamsWithHTTPClient creates a new CreateRunV1Params object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewCreateRunV1ParamsWithHTTPClient(client *http.Client) *CreateRunV1Params {
	var ()
	return &CreateRunV1Params{
		HTTPClient: client,
	}
}

/*CreateRunV1Params contains all the parameters to send to the API endpoint
for the create run v1 operation typically these are written to a http.Request
*/
type CreateRunV1Params struct {

	/*Body*/
	Body *run_model.APIRun

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

// WithTimeout adds the timeout to the create run v1 params
func (o *CreateRunV1Params) WithTimeout(timeout time.Duration) *CreateRunV1Params {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the create run v1 params
func (o *CreateRunV1Params) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the create run v1 params
func (o *CreateRunV1Params) WithContext(ctx context.Context) *CreateRunV1Params {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the create run v1 params
func (o *CreateRunV1Params) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the create run v1 params
func (o *CreateRunV1Params) WithHTTPClient(client *http.Client) *CreateRunV1Params {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the create run v1 params
func (o *CreateRunV1Params) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithBody adds the body to the create run v1 params
func (o *CreateRunV1Params) WithBody(body *run_model.APIRun) *CreateRunV1Params {
	o.SetBody(body)
	return o
}

// SetBody adds the body to the create run v1 params
func (o *CreateRunV1Params) SetBody(body *run_model.APIRun) {
	o.Body = body
}

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

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

	if o.Body != nil {
		if err := r.SetBodyParam(o.Body); err != nil {
			return err
		}
	}

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