From 06c6f10915f457263d325ac8518b296eeeef0513 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:06:05 -0700 Subject: [PATCH] Regenerate Swagger code 3a9facf1 (#89) Co-authored-by: FireHydrant Bot <44629778+firehydrant-ops@users.noreply.github.com> --- client/incidents/incidents_client.go | 43 +++++ ..._incidents_incident_id_close_parameters.go | 148 ++++++++++++++++++ ...1_incidents_incident_id_close_responses.go | 98 ++++++++++++ 3 files changed, 289 insertions(+) create mode 100644 client/incidents/put_v1_incidents_incident_id_close_parameters.go create mode 100644 client/incidents/put_v1_incidents_incident_id_close_responses.go diff --git a/client/incidents/incidents_client.go b/client/incidents/incidents_client.go index 9e06c16..8c65e83 100644 --- a/client/incidents/incidents_client.go +++ b/client/incidents/incidents_client.go @@ -138,6 +138,8 @@ type ClientService interface { PostV1IncidentsIncidentIDUnarchive(params *PostV1IncidentsIncidentIDUnarchiveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostV1IncidentsIncidentIDUnarchiveCreated, error) + PutV1IncidentsIncidentIDClose(params *PutV1IncidentsIncidentIDCloseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutV1IncidentsIncidentIDCloseOK, error) + PutV1IncidentsIncidentIDImpact(params *PutV1IncidentsIncidentIDImpactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutV1IncidentsIncidentIDImpactOK, error) PutV1IncidentsIncidentIDLinksLinkID(params *PutV1IncidentsIncidentIDLinksLinkIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutV1IncidentsIncidentIDLinksLinkIDOK, error) @@ -2357,6 +2359,47 @@ func (a *Client) PostV1IncidentsIncidentIDUnarchive(params *PostV1IncidentsIncid panic(msg) } +/* +PutV1IncidentsIncidentIDClose closes an incident + +Closes an incident and optionally close all children +*/ +func (a *Client) PutV1IncidentsIncidentIDClose(params *PutV1IncidentsIncidentIDCloseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutV1IncidentsIncidentIDCloseOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutV1IncidentsIncidentIDCloseParams() + } + op := &runtime.ClientOperation{ + ID: "putV1IncidentsIncidentIdClose", + Method: "PUT", + PathPattern: "/v1/incidents/{incident_id}/close", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &PutV1IncidentsIncidentIDCloseReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PutV1IncidentsIncidentIDCloseOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for putV1IncidentsIncidentIdClose: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* PutV1IncidentsIncidentIDImpact creates a status update for an incident diff --git a/client/incidents/put_v1_incidents_incident_id_close_parameters.go b/client/incidents/put_v1_incidents_incident_id_close_parameters.go new file mode 100644 index 0000000..5f8eb1d --- /dev/null +++ b/client/incidents/put_v1_incidents_incident_id_close_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package incidents + +// 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" +) + +// NewPutV1IncidentsIncidentIDCloseParams creates a new PutV1IncidentsIncidentIDCloseParams 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 NewPutV1IncidentsIncidentIDCloseParams() *PutV1IncidentsIncidentIDCloseParams { + return &PutV1IncidentsIncidentIDCloseParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPutV1IncidentsIncidentIDCloseParamsWithTimeout creates a new PutV1IncidentsIncidentIDCloseParams object +// with the ability to set a timeout on a request. +func NewPutV1IncidentsIncidentIDCloseParamsWithTimeout(timeout time.Duration) *PutV1IncidentsIncidentIDCloseParams { + return &PutV1IncidentsIncidentIDCloseParams{ + timeout: timeout, + } +} + +// NewPutV1IncidentsIncidentIDCloseParamsWithContext creates a new PutV1IncidentsIncidentIDCloseParams object +// with the ability to set a context for a request. +func NewPutV1IncidentsIncidentIDCloseParamsWithContext(ctx context.Context) *PutV1IncidentsIncidentIDCloseParams { + return &PutV1IncidentsIncidentIDCloseParams{ + Context: ctx, + } +} + +// NewPutV1IncidentsIncidentIDCloseParamsWithHTTPClient creates a new PutV1IncidentsIncidentIDCloseParams object +// with the ability to set a custom HTTPClient for a request. +func NewPutV1IncidentsIncidentIDCloseParamsWithHTTPClient(client *http.Client) *PutV1IncidentsIncidentIDCloseParams { + return &PutV1IncidentsIncidentIDCloseParams{ + HTTPClient: client, + } +} + +/* +PutV1IncidentsIncidentIDCloseParams contains all the parameters to send to the API endpoint + + for the put v1 incidents incident Id close operation. + + Typically these are written to a http.Request. +*/ +type PutV1IncidentsIncidentIDCloseParams struct { + + // IncidentID. + IncidentID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the put v1 incidents incident Id close params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutV1IncidentsIncidentIDCloseParams) WithDefaults() *PutV1IncidentsIncidentIDCloseParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put v1 incidents incident Id close params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutV1IncidentsIncidentIDCloseParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the put v1 incidents incident Id close params +func (o *PutV1IncidentsIncidentIDCloseParams) WithTimeout(timeout time.Duration) *PutV1IncidentsIncidentIDCloseParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put v1 incidents incident Id close params +func (o *PutV1IncidentsIncidentIDCloseParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put v1 incidents incident Id close params +func (o *PutV1IncidentsIncidentIDCloseParams) WithContext(ctx context.Context) *PutV1IncidentsIncidentIDCloseParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put v1 incidents incident Id close params +func (o *PutV1IncidentsIncidentIDCloseParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put v1 incidents incident Id close params +func (o *PutV1IncidentsIncidentIDCloseParams) WithHTTPClient(client *http.Client) *PutV1IncidentsIncidentIDCloseParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put v1 incidents incident Id close params +func (o *PutV1IncidentsIncidentIDCloseParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithIncidentID adds the incidentID to the put v1 incidents incident Id close params +func (o *PutV1IncidentsIncidentIDCloseParams) WithIncidentID(incidentID string) *PutV1IncidentsIncidentIDCloseParams { + o.SetIncidentID(incidentID) + return o +} + +// SetIncidentID adds the incidentId to the put v1 incidents incident Id close params +func (o *PutV1IncidentsIncidentIDCloseParams) SetIncidentID(incidentID string) { + o.IncidentID = incidentID +} + +// WriteToRequest writes these params to a swagger request +func (o *PutV1IncidentsIncidentIDCloseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param incident_id + if err := r.SetPathParam("incident_id", o.IncidentID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/incidents/put_v1_incidents_incident_id_close_responses.go b/client/incidents/put_v1_incidents_incident_id_close_responses.go new file mode 100644 index 0000000..8f71479 --- /dev/null +++ b/client/incidents/put_v1_incidents_incident_id_close_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package incidents + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/firehydrant/api-client-go/models" +) + +// PutV1IncidentsIncidentIDCloseReader is a Reader for the PutV1IncidentsIncidentIDClose structure. +type PutV1IncidentsIncidentIDCloseReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutV1IncidentsIncidentIDCloseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPutV1IncidentsIncidentIDCloseOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPutV1IncidentsIncidentIDCloseOK creates a PutV1IncidentsIncidentIDCloseOK with default headers values +func NewPutV1IncidentsIncidentIDCloseOK() *PutV1IncidentsIncidentIDCloseOK { + return &PutV1IncidentsIncidentIDCloseOK{} +} + +/* +PutV1IncidentsIncidentIDCloseOK describes a response with status code 200, with default header values. + +Closes an incident and optionally close all children +*/ +type PutV1IncidentsIncidentIDCloseOK struct { + Payload *models.IncidentEntity +} + +// IsSuccess returns true when this put v1 incidents incident Id close o k response has a 2xx status code +func (o *PutV1IncidentsIncidentIDCloseOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this put v1 incidents incident Id close o k response has a 3xx status code +func (o *PutV1IncidentsIncidentIDCloseOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put v1 incidents incident Id close o k response has a 4xx status code +func (o *PutV1IncidentsIncidentIDCloseOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this put v1 incidents incident Id close o k response has a 5xx status code +func (o *PutV1IncidentsIncidentIDCloseOK) IsServerError() bool { + return false +} + +// IsCode returns true when this put v1 incidents incident Id close o k response a status code equal to that given +func (o *PutV1IncidentsIncidentIDCloseOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PutV1IncidentsIncidentIDCloseOK) Error() string { + return fmt.Sprintf("[PUT /v1/incidents/{incident_id}/close][%d] putV1IncidentsIncidentIdCloseOK %+v", 200, o.Payload) +} + +func (o *PutV1IncidentsIncidentIDCloseOK) String() string { + return fmt.Sprintf("[PUT /v1/incidents/{incident_id}/close][%d] putV1IncidentsIncidentIdCloseOK %+v", 200, o.Payload) +} + +func (o *PutV1IncidentsIncidentIDCloseOK) GetPayload() *models.IncidentEntity { + return o.Payload +} + +func (o *PutV1IncidentsIncidentIDCloseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.IncidentEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +}