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