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

package organization_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"
	"github.com/go-openapi/strfmt"

	"github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/preview/2019-12-10/models"
)

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

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

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

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

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

	for the organization service set iam policy operation.

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

	// Body.
	Body *models.HashicorpCloudResourcemanagerOrganizationSetIamPolicyRequest

	/* ID.

	   ID is the identifier of the organization.
	*/
	ID string

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

// WithDefaults hydrates default values in the organization service set iam policy params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *OrganizationServiceSetIamPolicyParams) WithDefaults() *OrganizationServiceSetIamPolicyParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the organization service set iam policy params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *OrganizationServiceSetIamPolicyParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) WithTimeout(timeout time.Duration) *OrganizationServiceSetIamPolicyParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) WithContext(ctx context.Context) *OrganizationServiceSetIamPolicyParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) WithHTTPClient(client *http.Client) *OrganizationServiceSetIamPolicyParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithBody adds the body to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) WithBody(body *models.HashicorpCloudResourcemanagerOrganizationSetIamPolicyRequest) *OrganizationServiceSetIamPolicyParams {
	o.SetBody(body)
	return o
}

// SetBody adds the body to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) SetBody(body *models.HashicorpCloudResourcemanagerOrganizationSetIamPolicyRequest) {
	o.Body = body
}

// WithID adds the id to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) WithID(id string) *OrganizationServiceSetIamPolicyParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the organization service set iam policy params
func (o *OrganizationServiceSetIamPolicyParams) SetID(id string) {
	o.ID = id
}

// WriteToRequest writes these params to a swagger request
func (o *OrganizationServiceSetIamPolicyParams) 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
		}
	}

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

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