github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/preheat/stop_execution_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package preheat
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  	"net/http"
    11  	"time"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/runtime"
    15  	cr "github.com/go-openapi/runtime/client"
    16  	"github.com/go-openapi/strfmt"
    17  	"github.com/go-openapi/swag"
    18  
    19  	"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
    20  )
    21  
    22  // NewStopExecutionParams creates a new StopExecutionParams object,
    23  // with the default timeout for this client.
    24  //
    25  // Default values are not hydrated, since defaults are normally applied by the API server side.
    26  //
    27  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    28  func NewStopExecutionParams() *StopExecutionParams {
    29  	return &StopExecutionParams{
    30  		timeout: cr.DefaultTimeout,
    31  	}
    32  }
    33  
    34  // NewStopExecutionParamsWithTimeout creates a new StopExecutionParams object
    35  // with the ability to set a timeout on a request.
    36  func NewStopExecutionParamsWithTimeout(timeout time.Duration) *StopExecutionParams {
    37  	return &StopExecutionParams{
    38  		timeout: timeout,
    39  	}
    40  }
    41  
    42  // NewStopExecutionParamsWithContext creates a new StopExecutionParams object
    43  // with the ability to set a context for a request.
    44  func NewStopExecutionParamsWithContext(ctx context.Context) *StopExecutionParams {
    45  	return &StopExecutionParams{
    46  		Context: ctx,
    47  	}
    48  }
    49  
    50  // NewStopExecutionParamsWithHTTPClient creates a new StopExecutionParams object
    51  // with the ability to set a custom HTTPClient for a request.
    52  func NewStopExecutionParamsWithHTTPClient(client *http.Client) *StopExecutionParams {
    53  	return &StopExecutionParams{
    54  		HTTPClient: client,
    55  	}
    56  }
    57  
    58  /*
    59  StopExecutionParams contains all the parameters to send to the API endpoint
    60  
    61  	for the stop execution operation.
    62  
    63  	Typically these are written to a http.Request.
    64  */
    65  type StopExecutionParams struct {
    66  
    67  	/* XRequestID.
    68  
    69  	   An unique ID for the request
    70  	*/
    71  	XRequestID *string
    72  
    73  	/* Execution.
    74  
    75  	   The data of execution
    76  	*/
    77  	Execution *models.Execution
    78  
    79  	/* ExecutionID.
    80  
    81  	   Execution ID
    82  	*/
    83  	ExecutionID int64
    84  
    85  	/* PreheatPolicyName.
    86  
    87  	   Preheat Policy Name
    88  	*/
    89  	PreheatPolicyName string
    90  
    91  	/* ProjectName.
    92  
    93  	   The name of the project
    94  	*/
    95  	ProjectName string
    96  
    97  	timeout    time.Duration
    98  	Context    context.Context
    99  	HTTPClient *http.Client
   100  }
   101  
   102  // WithDefaults hydrates default values in the stop execution params (not the query body).
   103  //
   104  // All values with no default are reset to their zero value.
   105  func (o *StopExecutionParams) WithDefaults() *StopExecutionParams {
   106  	o.SetDefaults()
   107  	return o
   108  }
   109  
   110  // SetDefaults hydrates default values in the stop execution params (not the query body).
   111  //
   112  // All values with no default are reset to their zero value.
   113  func (o *StopExecutionParams) SetDefaults() {
   114  	// no default values defined for this parameter
   115  }
   116  
   117  // WithTimeout adds the timeout to the stop execution params
   118  func (o *StopExecutionParams) WithTimeout(timeout time.Duration) *StopExecutionParams {
   119  	o.SetTimeout(timeout)
   120  	return o
   121  }
   122  
   123  // SetTimeout adds the timeout to the stop execution params
   124  func (o *StopExecutionParams) SetTimeout(timeout time.Duration) {
   125  	o.timeout = timeout
   126  }
   127  
   128  // WithContext adds the context to the stop execution params
   129  func (o *StopExecutionParams) WithContext(ctx context.Context) *StopExecutionParams {
   130  	o.SetContext(ctx)
   131  	return o
   132  }
   133  
   134  // SetContext adds the context to the stop execution params
   135  func (o *StopExecutionParams) SetContext(ctx context.Context) {
   136  	o.Context = ctx
   137  }
   138  
   139  // WithHTTPClient adds the HTTPClient to the stop execution params
   140  func (o *StopExecutionParams) WithHTTPClient(client *http.Client) *StopExecutionParams {
   141  	o.SetHTTPClient(client)
   142  	return o
   143  }
   144  
   145  // SetHTTPClient adds the HTTPClient to the stop execution params
   146  func (o *StopExecutionParams) SetHTTPClient(client *http.Client) {
   147  	o.HTTPClient = client
   148  }
   149  
   150  // WithXRequestID adds the xRequestID to the stop execution params
   151  func (o *StopExecutionParams) WithXRequestID(xRequestID *string) *StopExecutionParams {
   152  	o.SetXRequestID(xRequestID)
   153  	return o
   154  }
   155  
   156  // SetXRequestID adds the xRequestId to the stop execution params
   157  func (o *StopExecutionParams) SetXRequestID(xRequestID *string) {
   158  	o.XRequestID = xRequestID
   159  }
   160  
   161  // WithExecution adds the execution to the stop execution params
   162  func (o *StopExecutionParams) WithExecution(execution *models.Execution) *StopExecutionParams {
   163  	o.SetExecution(execution)
   164  	return o
   165  }
   166  
   167  // SetExecution adds the execution to the stop execution params
   168  func (o *StopExecutionParams) SetExecution(execution *models.Execution) {
   169  	o.Execution = execution
   170  }
   171  
   172  // WithExecutionID adds the executionID to the stop execution params
   173  func (o *StopExecutionParams) WithExecutionID(executionID int64) *StopExecutionParams {
   174  	o.SetExecutionID(executionID)
   175  	return o
   176  }
   177  
   178  // SetExecutionID adds the executionId to the stop execution params
   179  func (o *StopExecutionParams) SetExecutionID(executionID int64) {
   180  	o.ExecutionID = executionID
   181  }
   182  
   183  // WithPreheatPolicyName adds the preheatPolicyName to the stop execution params
   184  func (o *StopExecutionParams) WithPreheatPolicyName(preheatPolicyName string) *StopExecutionParams {
   185  	o.SetPreheatPolicyName(preheatPolicyName)
   186  	return o
   187  }
   188  
   189  // SetPreheatPolicyName adds the preheatPolicyName to the stop execution params
   190  func (o *StopExecutionParams) SetPreheatPolicyName(preheatPolicyName string) {
   191  	o.PreheatPolicyName = preheatPolicyName
   192  }
   193  
   194  // WithProjectName adds the projectName to the stop execution params
   195  func (o *StopExecutionParams) WithProjectName(projectName string) *StopExecutionParams {
   196  	o.SetProjectName(projectName)
   197  	return o
   198  }
   199  
   200  // SetProjectName adds the projectName to the stop execution params
   201  func (o *StopExecutionParams) SetProjectName(projectName string) {
   202  	o.ProjectName = projectName
   203  }
   204  
   205  // WriteToRequest writes these params to a swagger request
   206  func (o *StopExecutionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   207  
   208  	if err := r.SetTimeout(o.timeout); err != nil {
   209  		return err
   210  	}
   211  	var res []error
   212  
   213  	if o.XRequestID != nil {
   214  
   215  		// header param X-Request-Id
   216  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   217  			return err
   218  		}
   219  	}
   220  	if o.Execution != nil {
   221  		if err := r.SetBodyParam(o.Execution); err != nil {
   222  			return err
   223  		}
   224  	}
   225  
   226  	// path param execution_id
   227  	if err := r.SetPathParam("execution_id", swag.FormatInt64(o.ExecutionID)); err != nil {
   228  		return err
   229  	}
   230  
   231  	// path param preheat_policy_name
   232  	if err := r.SetPathParam("preheat_policy_name", o.PreheatPolicyName); err != nil {
   233  		return err
   234  	}
   235  
   236  	// path param project_name
   237  	if err := r.SetPathParam("project_name", o.ProjectName); err != nil {
   238  		return err
   239  	}
   240  
   241  	if len(res) > 0 {
   242  		return errors.CompositeValidationError(res...)
   243  	}
   244  	return nil
   245  }