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

package admin

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

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

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

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

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

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

	for the header filter allow create operation.

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

	/* Header.

	   The HTTP header to match against (e.g. User-Agent).
	*/
	Header string

	/* Regex.

	   The header value matching regular expression.
	*/
	Regex string

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

// WithDefaults hydrates default values in the header filter allow create params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *HeaderFilterAllowCreateParams) WithDefaults() *HeaderFilterAllowCreateParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the header filter allow create params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *HeaderFilterAllowCreateParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) WithTimeout(timeout time.Duration) *HeaderFilterAllowCreateParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) WithContext(ctx context.Context) *HeaderFilterAllowCreateParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) WithHTTPClient(client *http.Client) *HeaderFilterAllowCreateParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithHeader adds the header to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) WithHeader(header string) *HeaderFilterAllowCreateParams {
	o.SetHeader(header)
	return o
}

// SetHeader adds the header to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) SetHeader(header string) {
	o.Header = header
}

// WithRegex adds the regex to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) WithRegex(regex string) *HeaderFilterAllowCreateParams {
	o.SetRegex(regex)
	return o
}

// SetRegex adds the regex to the header filter allow create params
func (o *HeaderFilterAllowCreateParams) SetRegex(regex string) {
	o.Regex = regex
}

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

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

	// form param header
	frHeader := o.Header
	fHeader := frHeader
	if fHeader != "" {
		if err := r.SetFormParam("header", fHeader); err != nil {
			return err
		}
	}

	// form param regex
	frRegex := o.Regex
	fRegex := frRegex
	if fRegex != "" {
		if err := r.SetFormParam("regex", fRegex); err != nil {
			return err
		}
	}

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