garm/client/credentials/create_credentials_parameters.go
Gabriel Adrian Samfira eadbe784b9 Add github credentials API and cli code
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-04-22 14:08:37 +00:00

151 lines
4.4 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package credentials
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
garm_params "github.com/cloudbase/garm/params"
)
// NewCreateCredentialsParams creates a new CreateCredentialsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewCreateCredentialsParams() *CreateCredentialsParams {
return &CreateCredentialsParams{
timeout: cr.DefaultTimeout,
}
}
// NewCreateCredentialsParamsWithTimeout creates a new CreateCredentialsParams object
// with the ability to set a timeout on a request.
func NewCreateCredentialsParamsWithTimeout(timeout time.Duration) *CreateCredentialsParams {
return &CreateCredentialsParams{
timeout: timeout,
}
}
// NewCreateCredentialsParamsWithContext creates a new CreateCredentialsParams object
// with the ability to set a context for a request.
func NewCreateCredentialsParamsWithContext(ctx context.Context) *CreateCredentialsParams {
return &CreateCredentialsParams{
Context: ctx,
}
}
// NewCreateCredentialsParamsWithHTTPClient creates a new CreateCredentialsParams object
// with the ability to set a custom HTTPClient for a request.
func NewCreateCredentialsParamsWithHTTPClient(client *http.Client) *CreateCredentialsParams {
return &CreateCredentialsParams{
HTTPClient: client,
}
}
/*
CreateCredentialsParams contains all the parameters to send to the API endpoint
for the create credentials operation.
Typically these are written to a http.Request.
*/
type CreateCredentialsParams struct {
/* Body.
Parameters used when creating a GitHub credential.
*/
Body garm_params.CreateGithubCredentialsParams
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the create credentials params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateCredentialsParams) WithDefaults() *CreateCredentialsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the create credentials params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateCredentialsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the create credentials params
func (o *CreateCredentialsParams) WithTimeout(timeout time.Duration) *CreateCredentialsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create credentials params
func (o *CreateCredentialsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create credentials params
func (o *CreateCredentialsParams) WithContext(ctx context.Context) *CreateCredentialsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create credentials params
func (o *CreateCredentialsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create credentials params
func (o *CreateCredentialsParams) WithHTTPClient(client *http.Client) *CreateCredentialsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create credentials params
func (o *CreateCredentialsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the create credentials params
func (o *CreateCredentialsParams) WithBody(body garm_params.CreateGithubCredentialsParams) *CreateCredentialsParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the create credentials params
func (o *CreateCredentialsParams) SetBody(body garm_params.CreateGithubCredentialsParams) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *CreateCredentialsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}