github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/projects/add_project_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package projects 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/ActiveState/cli/pkg/platform/api/mono/mono_models" 19 ) 20 21 // NewAddProjectParams creates a new AddProjectParams 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 NewAddProjectParams() *AddProjectParams { 28 return &AddProjectParams{ 29 timeout: cr.DefaultTimeout, 30 } 31 } 32 33 // NewAddProjectParamsWithTimeout creates a new AddProjectParams object 34 // with the ability to set a timeout on a request. 35 func NewAddProjectParamsWithTimeout(timeout time.Duration) *AddProjectParams { 36 return &AddProjectParams{ 37 timeout: timeout, 38 } 39 } 40 41 // NewAddProjectParamsWithContext creates a new AddProjectParams object 42 // with the ability to set a context for a request. 43 func NewAddProjectParamsWithContext(ctx context.Context) *AddProjectParams { 44 return &AddProjectParams{ 45 Context: ctx, 46 } 47 } 48 49 // NewAddProjectParamsWithHTTPClient creates a new AddProjectParams object 50 // with the ability to set a custom HTTPClient for a request. 51 func NewAddProjectParamsWithHTTPClient(client *http.Client) *AddProjectParams { 52 return &AddProjectParams{ 53 HTTPClient: client, 54 } 55 } 56 57 /* AddProjectParams contains all the parameters to send to the API endpoint 58 for the add project operation. 59 60 Typically these are written to a http.Request. 61 */ 62 type AddProjectParams struct { 63 64 /* OrganizationName. 65 66 organization name of desired organization 67 */ 68 OrganizationName string 69 70 /* Project. 71 72 Project to add/update 73 */ 74 Project *mono_models.Project 75 76 timeout time.Duration 77 Context context.Context 78 HTTPClient *http.Client 79 } 80 81 // WithDefaults hydrates default values in the add project params (not the query body). 82 // 83 // All values with no default are reset to their zero value. 84 func (o *AddProjectParams) WithDefaults() *AddProjectParams { 85 o.SetDefaults() 86 return o 87 } 88 89 // SetDefaults hydrates default values in the add project params (not the query body). 90 // 91 // All values with no default are reset to their zero value. 92 func (o *AddProjectParams) SetDefaults() { 93 // no default values defined for this parameter 94 } 95 96 // WithTimeout adds the timeout to the add project params 97 func (o *AddProjectParams) WithTimeout(timeout time.Duration) *AddProjectParams { 98 o.SetTimeout(timeout) 99 return o 100 } 101 102 // SetTimeout adds the timeout to the add project params 103 func (o *AddProjectParams) SetTimeout(timeout time.Duration) { 104 o.timeout = timeout 105 } 106 107 // WithContext adds the context to the add project params 108 func (o *AddProjectParams) WithContext(ctx context.Context) *AddProjectParams { 109 o.SetContext(ctx) 110 return o 111 } 112 113 // SetContext adds the context to the add project params 114 func (o *AddProjectParams) SetContext(ctx context.Context) { 115 o.Context = ctx 116 } 117 118 // WithHTTPClient adds the HTTPClient to the add project params 119 func (o *AddProjectParams) WithHTTPClient(client *http.Client) *AddProjectParams { 120 o.SetHTTPClient(client) 121 return o 122 } 123 124 // SetHTTPClient adds the HTTPClient to the add project params 125 func (o *AddProjectParams) SetHTTPClient(client *http.Client) { 126 o.HTTPClient = client 127 } 128 129 // WithOrganizationName adds the organizationName to the add project params 130 func (o *AddProjectParams) WithOrganizationName(organizationName string) *AddProjectParams { 131 o.SetOrganizationName(organizationName) 132 return o 133 } 134 135 // SetOrganizationName adds the organizationName to the add project params 136 func (o *AddProjectParams) SetOrganizationName(organizationName string) { 137 o.OrganizationName = organizationName 138 } 139 140 // WithProject adds the project to the add project params 141 func (o *AddProjectParams) WithProject(project *mono_models.Project) *AddProjectParams { 142 o.SetProject(project) 143 return o 144 } 145 146 // SetProject adds the project to the add project params 147 func (o *AddProjectParams) SetProject(project *mono_models.Project) { 148 o.Project = project 149 } 150 151 // WriteToRequest writes these params to a swagger request 152 func (o *AddProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 153 154 if err := r.SetTimeout(o.timeout); err != nil { 155 return err 156 } 157 var res []error 158 159 // path param organizationName 160 if err := r.SetPathParam("organizationName", o.OrganizationName); err != nil { 161 return err 162 } 163 if o.Project != nil { 164 if err := r.SetBodyParam(o.Project); err != nil { 165 return err 166 } 167 } 168 169 if len(res) > 0 { 170 return errors.CompositeValidationError(res...) 171 } 172 return nil 173 }