github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/ldap/search_ldap_group_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  
    19  // NewSearchLdapGroupParams creates a new SearchLdapGroupParams object,
    20  // with the default timeout for this client.
    21  //
    22  // Default values are not hydrated, since defaults are normally applied by the API server side.
    23  //
    24  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    25  func NewSearchLdapGroupParams() *SearchLdapGroupParams {
    26  	return &SearchLdapGroupParams{
    27  		timeout: cr.DefaultTimeout,
    28  	}
    29  }
    30  
    31  // NewSearchLdapGroupParamsWithTimeout creates a new SearchLdapGroupParams object
    32  // with the ability to set a timeout on a request.
    33  func NewSearchLdapGroupParamsWithTimeout(timeout time.Duration) *SearchLdapGroupParams {
    34  	return &SearchLdapGroupParams{
    35  		timeout: timeout,
    36  	}
    37  }
    38  
    39  // NewSearchLdapGroupParamsWithContext creates a new SearchLdapGroupParams object
    40  // with the ability to set a context for a request.
    41  func NewSearchLdapGroupParamsWithContext(ctx context.Context) *SearchLdapGroupParams {
    42  	return &SearchLdapGroupParams{
    43  		Context: ctx,
    44  	}
    45  }
    46  
    47  // NewSearchLdapGroupParamsWithHTTPClient creates a new SearchLdapGroupParams object
    48  // with the ability to set a custom HTTPClient for a request.
    49  func NewSearchLdapGroupParamsWithHTTPClient(client *http.Client) *SearchLdapGroupParams {
    50  	return &SearchLdapGroupParams{
    51  		HTTPClient: client,
    52  	}
    53  }
    54  
    55  /*
    56  SearchLdapGroupParams contains all the parameters to send to the API endpoint
    57  
    58  	for the search ldap group operation.
    59  
    60  	Typically these are written to a http.Request.
    61  */
    62  type SearchLdapGroupParams struct {
    63  
    64  	/* XRequestID.
    65  
    66  	   An unique ID for the request
    67  	*/
    68  	XRequestID *string
    69  
    70  	/* Groupdn.
    71  
    72  	   The LDAP group DN
    73  	*/
    74  	Groupdn *string
    75  
    76  	/* Groupname.
    77  
    78  	   Ldap group name
    79  	*/
    80  	Groupname *string
    81  
    82  	timeout    time.Duration
    83  	Context    context.Context
    84  	HTTPClient *http.Client
    85  }
    86  
    87  // WithDefaults hydrates default values in the search ldap group params (not the query body).
    88  //
    89  // All values with no default are reset to their zero value.
    90  func (o *SearchLdapGroupParams) WithDefaults() *SearchLdapGroupParams {
    91  	o.SetDefaults()
    92  	return o
    93  }
    94  
    95  // SetDefaults hydrates default values in the search ldap group params (not the query body).
    96  //
    97  // All values with no default are reset to their zero value.
    98  func (o *SearchLdapGroupParams) SetDefaults() {
    99  	// no default values defined for this parameter
   100  }
   101  
   102  // WithTimeout adds the timeout to the search ldap group params
   103  func (o *SearchLdapGroupParams) WithTimeout(timeout time.Duration) *SearchLdapGroupParams {
   104  	o.SetTimeout(timeout)
   105  	return o
   106  }
   107  
   108  // SetTimeout adds the timeout to the search ldap group params
   109  func (o *SearchLdapGroupParams) SetTimeout(timeout time.Duration) {
   110  	o.timeout = timeout
   111  }
   112  
   113  // WithContext adds the context to the search ldap group params
   114  func (o *SearchLdapGroupParams) WithContext(ctx context.Context) *SearchLdapGroupParams {
   115  	o.SetContext(ctx)
   116  	return o
   117  }
   118  
   119  // SetContext adds the context to the search ldap group params
   120  func (o *SearchLdapGroupParams) SetContext(ctx context.Context) {
   121  	o.Context = ctx
   122  }
   123  
   124  // WithHTTPClient adds the HTTPClient to the search ldap group params
   125  func (o *SearchLdapGroupParams) WithHTTPClient(client *http.Client) *SearchLdapGroupParams {
   126  	o.SetHTTPClient(client)
   127  	return o
   128  }
   129  
   130  // SetHTTPClient adds the HTTPClient to the search ldap group params
   131  func (o *SearchLdapGroupParams) SetHTTPClient(client *http.Client) {
   132  	o.HTTPClient = client
   133  }
   134  
   135  // WithXRequestID adds the xRequestID to the search ldap group params
   136  func (o *SearchLdapGroupParams) WithXRequestID(xRequestID *string) *SearchLdapGroupParams {
   137  	o.SetXRequestID(xRequestID)
   138  	return o
   139  }
   140  
   141  // SetXRequestID adds the xRequestId to the search ldap group params
   142  func (o *SearchLdapGroupParams) SetXRequestID(xRequestID *string) {
   143  	o.XRequestID = xRequestID
   144  }
   145  
   146  // WithGroupdn adds the groupdn to the search ldap group params
   147  func (o *SearchLdapGroupParams) WithGroupdn(groupdn *string) *SearchLdapGroupParams {
   148  	o.SetGroupdn(groupdn)
   149  	return o
   150  }
   151  
   152  // SetGroupdn adds the groupdn to the search ldap group params
   153  func (o *SearchLdapGroupParams) SetGroupdn(groupdn *string) {
   154  	o.Groupdn = groupdn
   155  }
   156  
   157  // WithGroupname adds the groupname to the search ldap group params
   158  func (o *SearchLdapGroupParams) WithGroupname(groupname *string) *SearchLdapGroupParams {
   159  	o.SetGroupname(groupname)
   160  	return o
   161  }
   162  
   163  // SetGroupname adds the groupname to the search ldap group params
   164  func (o *SearchLdapGroupParams) SetGroupname(groupname *string) {
   165  	o.Groupname = groupname
   166  }
   167  
   168  // WriteToRequest writes these params to a swagger request
   169  func (o *SearchLdapGroupParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   170  
   171  	if err := r.SetTimeout(o.timeout); err != nil {
   172  		return err
   173  	}
   174  	var res []error
   175  
   176  	if o.XRequestID != nil {
   177  
   178  		// header param X-Request-Id
   179  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   180  			return err
   181  		}
   182  	}
   183  
   184  	if o.Groupdn != nil {
   185  
   186  		// query param groupdn
   187  		var qrGroupdn string
   188  
   189  		if o.Groupdn != nil {
   190  			qrGroupdn = *o.Groupdn
   191  		}
   192  		qGroupdn := qrGroupdn
   193  		if qGroupdn != "" {
   194  
   195  			if err := r.SetQueryParam("groupdn", qGroupdn); err != nil {
   196  				return err
   197  			}
   198  		}
   199  	}
   200  
   201  	if o.Groupname != nil {
   202  
   203  		// query param groupname
   204  		var qrGroupname string
   205  
   206  		if o.Groupname != nil {
   207  			qrGroupname = *o.Groupname
   208  		}
   209  		qGroupname := qrGroupname
   210  		if qGroupname != "" {
   211  
   212  			if err := r.SetQueryParam("groupname", qGroupname); err != nil {
   213  				return err
   214  			}
   215  		}
   216  	}
   217  
   218  	if len(res) > 0 {
   219  		return errors.CompositeValidationError(res...)
   220  	}
   221  	return nil
   222  }