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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package ldap
     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  
    18  	"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
    19  )
    20  
    21  // NewImportLdapUserParams creates a new ImportLdapUserParams object,
    22  // with the default timeout for this client.
    23  //
    24  // Default values are not hydrated, since defaults are normally applied by the API server side.
    25  //
    26  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    27  func NewImportLdapUserParams() *ImportLdapUserParams {
    28  	return &ImportLdapUserParams{
    29  		timeout: cr.DefaultTimeout,
    30  	}
    31  }
    32  
    33  // NewImportLdapUserParamsWithTimeout creates a new ImportLdapUserParams object
    34  // with the ability to set a timeout on a request.
    35  func NewImportLdapUserParamsWithTimeout(timeout time.Duration) *ImportLdapUserParams {
    36  	return &ImportLdapUserParams{
    37  		timeout: timeout,
    38  	}
    39  }
    40  
    41  // NewImportLdapUserParamsWithContext creates a new ImportLdapUserParams object
    42  // with the ability to set a context for a request.
    43  func NewImportLdapUserParamsWithContext(ctx context.Context) *ImportLdapUserParams {
    44  	return &ImportLdapUserParams{
    45  		Context: ctx,
    46  	}
    47  }
    48  
    49  // NewImportLdapUserParamsWithHTTPClient creates a new ImportLdapUserParams object
    50  // with the ability to set a custom HTTPClient for a request.
    51  func NewImportLdapUserParamsWithHTTPClient(client *http.Client) *ImportLdapUserParams {
    52  	return &ImportLdapUserParams{
    53  		HTTPClient: client,
    54  	}
    55  }
    56  
    57  /*
    58  ImportLdapUserParams contains all the parameters to send to the API endpoint
    59  
    60  	for the import ldap user operation.
    61  
    62  	Typically these are written to a http.Request.
    63  */
    64  type ImportLdapUserParams struct {
    65  
    66  	/* XRequestID.
    67  
    68  	   An unique ID for the request
    69  	*/
    70  	XRequestID *string
    71  
    72  	/* UIDList.
    73  
    74  	   The uid listed for importing. This list will check users validity of ldap service based on configuration from the system.
    75  	*/
    76  	UIDList *models.LdapImportUsers
    77  
    78  	timeout    time.Duration
    79  	Context    context.Context
    80  	HTTPClient *http.Client
    81  }
    82  
    83  // WithDefaults hydrates default values in the import ldap user params (not the query body).
    84  //
    85  // All values with no default are reset to their zero value.
    86  func (o *ImportLdapUserParams) WithDefaults() *ImportLdapUserParams {
    87  	o.SetDefaults()
    88  	return o
    89  }
    90  
    91  // SetDefaults hydrates default values in the import ldap user params (not the query body).
    92  //
    93  // All values with no default are reset to their zero value.
    94  func (o *ImportLdapUserParams) SetDefaults() {
    95  	// no default values defined for this parameter
    96  }
    97  
    98  // WithTimeout adds the timeout to the import ldap user params
    99  func (o *ImportLdapUserParams) WithTimeout(timeout time.Duration) *ImportLdapUserParams {
   100  	o.SetTimeout(timeout)
   101  	return o
   102  }
   103  
   104  // SetTimeout adds the timeout to the import ldap user params
   105  func (o *ImportLdapUserParams) SetTimeout(timeout time.Duration) {
   106  	o.timeout = timeout
   107  }
   108  
   109  // WithContext adds the context to the import ldap user params
   110  func (o *ImportLdapUserParams) WithContext(ctx context.Context) *ImportLdapUserParams {
   111  	o.SetContext(ctx)
   112  	return o
   113  }
   114  
   115  // SetContext adds the context to the import ldap user params
   116  func (o *ImportLdapUserParams) SetContext(ctx context.Context) {
   117  	o.Context = ctx
   118  }
   119  
   120  // WithHTTPClient adds the HTTPClient to the import ldap user params
   121  func (o *ImportLdapUserParams) WithHTTPClient(client *http.Client) *ImportLdapUserParams {
   122  	o.SetHTTPClient(client)
   123  	return o
   124  }
   125  
   126  // SetHTTPClient adds the HTTPClient to the import ldap user params
   127  func (o *ImportLdapUserParams) SetHTTPClient(client *http.Client) {
   128  	o.HTTPClient = client
   129  }
   130  
   131  // WithXRequestID adds the xRequestID to the import ldap user params
   132  func (o *ImportLdapUserParams) WithXRequestID(xRequestID *string) *ImportLdapUserParams {
   133  	o.SetXRequestID(xRequestID)
   134  	return o
   135  }
   136  
   137  // SetXRequestID adds the xRequestId to the import ldap user params
   138  func (o *ImportLdapUserParams) SetXRequestID(xRequestID *string) {
   139  	o.XRequestID = xRequestID
   140  }
   141  
   142  // WithUIDList adds the uIDList to the import ldap user params
   143  func (o *ImportLdapUserParams) WithUIDList(uIDList *models.LdapImportUsers) *ImportLdapUserParams {
   144  	o.SetUIDList(uIDList)
   145  	return o
   146  }
   147  
   148  // SetUIDList adds the uidList to the import ldap user params
   149  func (o *ImportLdapUserParams) SetUIDList(uIDList *models.LdapImportUsers) {
   150  	o.UIDList = uIDList
   151  }
   152  
   153  // WriteToRequest writes these params to a swagger request
   154  func (o *ImportLdapUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   155  
   156  	if err := r.SetTimeout(o.timeout); err != nil {
   157  		return err
   158  	}
   159  	var res []error
   160  
   161  	if o.XRequestID != nil {
   162  
   163  		// header param X-Request-Id
   164  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   165  			return err
   166  		}
   167  	}
   168  	if o.UIDList != nil {
   169  		if err := r.SetBodyParam(o.UIDList); err != nil {
   170  			return err
   171  		}
   172  	}
   173  
   174  	if len(res) > 0 {
   175  		return errors.CompositeValidationError(res...)
   176  	}
   177  	return nil
   178  }