diff --git a/client/scim/patch_v1_scim_v2_users_id_parameters.go b/client/scim/patch_v1_scim_v2_users_id_parameters.go new file mode 100644 index 0000000..aaa8ccc --- /dev/null +++ b/client/scim/patch_v1_scim_v2_users_id_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package scim + +// 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" + + "github.com/firehydrant/api-client-go/models" +) + +// NewPatchV1ScimV2UsersIDParams creates a new PatchV1ScimV2UsersIDParams 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 NewPatchV1ScimV2UsersIDParams() *PatchV1ScimV2UsersIDParams { + return &PatchV1ScimV2UsersIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchV1ScimV2UsersIDParamsWithTimeout creates a new PatchV1ScimV2UsersIDParams object +// with the ability to set a timeout on a request. +func NewPatchV1ScimV2UsersIDParamsWithTimeout(timeout time.Duration) *PatchV1ScimV2UsersIDParams { + return &PatchV1ScimV2UsersIDParams{ + timeout: timeout, + } +} + +// NewPatchV1ScimV2UsersIDParamsWithContext creates a new PatchV1ScimV2UsersIDParams object +// with the ability to set a context for a request. +func NewPatchV1ScimV2UsersIDParamsWithContext(ctx context.Context) *PatchV1ScimV2UsersIDParams { + return &PatchV1ScimV2UsersIDParams{ + Context: ctx, + } +} + +// NewPatchV1ScimV2UsersIDParamsWithHTTPClient creates a new PatchV1ScimV2UsersIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchV1ScimV2UsersIDParamsWithHTTPClient(client *http.Client) *PatchV1ScimV2UsersIDParams { + return &PatchV1ScimV2UsersIDParams{ + HTTPClient: client, + } +} + +/* +PatchV1ScimV2UsersIDParams contains all the parameters to send to the API endpoint + + for the patch v1 scim v2 users Id operation. + + Typically these are written to a http.Request. +*/ +type PatchV1ScimV2UsersIDParams struct { + + // ID. + ID string + + // PatchV1ScimV2UsersID. + PatchV1ScimV2UsersID *models.PatchV1ScimV2UsersID + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch v1 scim v2 users Id params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchV1ScimV2UsersIDParams) WithDefaults() *PatchV1ScimV2UsersIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch v1 scim v2 users Id params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchV1ScimV2UsersIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) WithTimeout(timeout time.Duration) *PatchV1ScimV2UsersIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) WithContext(ctx context.Context) *PatchV1ScimV2UsersIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) WithHTTPClient(client *http.Client) *PatchV1ScimV2UsersIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) WithID(id string) *PatchV1ScimV2UsersIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) SetID(id string) { + o.ID = id +} + +// WithPatchV1ScimV2UsersID adds the patchV1ScimV2UsersID to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) WithPatchV1ScimV2UsersID(patchV1ScimV2UsersID *models.PatchV1ScimV2UsersID) *PatchV1ScimV2UsersIDParams { + o.SetPatchV1ScimV2UsersID(patchV1ScimV2UsersID) + return o +} + +// SetPatchV1ScimV2UsersID adds the patchV1ScimV2UsersId to the patch v1 scim v2 users Id params +func (o *PatchV1ScimV2UsersIDParams) SetPatchV1ScimV2UsersID(patchV1ScimV2UsersID *models.PatchV1ScimV2UsersID) { + o.PatchV1ScimV2UsersID = patchV1ScimV2UsersID +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchV1ScimV2UsersIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + if o.PatchV1ScimV2UsersID != nil { + if err := r.SetBodyParam(o.PatchV1ScimV2UsersID); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/scim/patch_v1_scim_v2_users_id_responses.go b/client/scim/patch_v1_scim_v2_users_id_responses.go new file mode 100644 index 0000000..dbe1586 --- /dev/null +++ b/client/scim/patch_v1_scim_v2_users_id_responses.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package scim + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// PatchV1ScimV2UsersIDReader is a Reader for the PatchV1ScimV2UsersID structure. +type PatchV1ScimV2UsersIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchV1ScimV2UsersIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchV1ScimV2UsersIDOK() + 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()) + } +} + +// NewPatchV1ScimV2UsersIDOK creates a PatchV1ScimV2UsersIDOK with default headers values +func NewPatchV1ScimV2UsersIDOK() *PatchV1ScimV2UsersIDOK { + return &PatchV1ScimV2UsersIDOK{} +} + +/* +PatchV1ScimV2UsersIDOK describes a response with status code 200, with default header values. + +PATCH SCIM endpoint to update a User. This endpoint is used to update a resource's attributes. +*/ +type PatchV1ScimV2UsersIDOK struct { +} + +// IsSuccess returns true when this patch v1 scim v2 users Id o k response has a 2xx status code +func (o *PatchV1ScimV2UsersIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch v1 scim v2 users Id o k response has a 3xx status code +func (o *PatchV1ScimV2UsersIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch v1 scim v2 users Id o k response has a 4xx status code +func (o *PatchV1ScimV2UsersIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch v1 scim v2 users Id o k response has a 5xx status code +func (o *PatchV1ScimV2UsersIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch v1 scim v2 users Id o k response a status code equal to that given +func (o *PatchV1ScimV2UsersIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchV1ScimV2UsersIDOK) Error() string { + return fmt.Sprintf("[PATCH /v1/scim/v2/Users/{id}][%d] patchV1ScimV2UsersIdOK ", 200) +} + +func (o *PatchV1ScimV2UsersIDOK) String() string { + return fmt.Sprintf("[PATCH /v1/scim/v2/Users/{id}][%d] patchV1ScimV2UsersIdOK ", 200) +} + +func (o *PatchV1ScimV2UsersIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/scim/scim_client.go b/client/scim/scim_client.go index 6496706..1df9eee 100644 --- a/client/scim/scim_client.go +++ b/client/scim/scim_client.go @@ -42,6 +42,8 @@ type ClientService interface { GetV1ScimV2UsersID(params *GetV1ScimV2UsersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetV1ScimV2UsersIDOK, error) + PatchV1ScimV2UsersID(params *PatchV1ScimV2UsersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchV1ScimV2UsersIDOK, error) + PostV1ScimV2Groups(params *PostV1ScimV2GroupsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostV1ScimV2GroupsCreated, error) PostV1ScimV2Users(params *PostV1ScimV2UsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostV1ScimV2UsersCreated, error) @@ -299,6 +301,47 @@ func (a *Client) GetV1ScimV2UsersID(params *GetV1ScimV2UsersIDParams, authInfo r panic(msg) } +/* +PatchV1ScimV2UsersID updates a user using s c i m protocol + +PATCH SCIM endpoint to update a User. This endpoint is used to update a resource's attributes. +*/ +func (a *Client) PatchV1ScimV2UsersID(params *PatchV1ScimV2UsersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchV1ScimV2UsersIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchV1ScimV2UsersIDParams() + } + op := &runtime.ClientOperation{ + ID: "patchV1ScimV2UsersId", + Method: "PATCH", + PathPattern: "/v1/scim/v2/Users/{id}", + ProducesMediaTypes: []string{"application/scim+json"}, + ConsumesMediaTypes: []string{"application/scim+json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &PatchV1ScimV2UsersIDReader{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.(*PatchV1ScimV2UsersIDOK) + 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 patchV1ScimV2UsersId: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* PostV1ScimV2Groups creates a new team via the group protocol and assigns members to that team diff --git a/client/users/get_v1_users_id_parameters.go b/client/users/get_v1_users_id_parameters.go new file mode 100644 index 0000000..e167f77 --- /dev/null +++ b/client/users/get_v1_users_id_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" +) + +// NewGetV1UsersIDParams creates a new GetV1UsersIDParams 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 NewGetV1UsersIDParams() *GetV1UsersIDParams { + return &GetV1UsersIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetV1UsersIDParamsWithTimeout creates a new GetV1UsersIDParams object +// with the ability to set a timeout on a request. +func NewGetV1UsersIDParamsWithTimeout(timeout time.Duration) *GetV1UsersIDParams { + return &GetV1UsersIDParams{ + timeout: timeout, + } +} + +// NewGetV1UsersIDParamsWithContext creates a new GetV1UsersIDParams object +// with the ability to set a context for a request. +func NewGetV1UsersIDParamsWithContext(ctx context.Context) *GetV1UsersIDParams { + return &GetV1UsersIDParams{ + Context: ctx, + } +} + +// NewGetV1UsersIDParamsWithHTTPClient creates a new GetV1UsersIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetV1UsersIDParamsWithHTTPClient(client *http.Client) *GetV1UsersIDParams { + return &GetV1UsersIDParams{ + HTTPClient: client, + } +} + +/* +GetV1UsersIDParams contains all the parameters to send to the API endpoint + + for the get v1 users Id operation. + + Typically these are written to a http.Request. +*/ +type GetV1UsersIDParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get v1 users Id params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetV1UsersIDParams) WithDefaults() *GetV1UsersIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get v1 users Id params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetV1UsersIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get v1 users Id params +func (o *GetV1UsersIDParams) WithTimeout(timeout time.Duration) *GetV1UsersIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get v1 users Id params +func (o *GetV1UsersIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get v1 users Id params +func (o *GetV1UsersIDParams) WithContext(ctx context.Context) *GetV1UsersIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get v1 users Id params +func (o *GetV1UsersIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get v1 users Id params +func (o *GetV1UsersIDParams) WithHTTPClient(client *http.Client) *GetV1UsersIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get v1 users Id params +func (o *GetV1UsersIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get v1 users Id params +func (o *GetV1UsersIDParams) WithID(id string) *GetV1UsersIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get v1 users Id params +func (o *GetV1UsersIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetV1UsersIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/users/get_v1_users_id_responses.go b/client/users/get_v1_users_id_responses.go new file mode 100644 index 0000000..908d8f6 --- /dev/null +++ b/client/users/get_v1_users_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" +) + +// GetV1UsersIDReader is a Reader for the GetV1UsersID structure. +type GetV1UsersIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetV1UsersIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetV1UsersIDOK() + 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()) + } +} + +// NewGetV1UsersIDOK creates a GetV1UsersIDOK with default headers values +func NewGetV1UsersIDOK() *GetV1UsersIDOK { + return &GetV1UsersIDOK{} +} + +/* +GetV1UsersIDOK describes a response with status code 200, with default header values. + +Retrieve a single user by ID +*/ +type GetV1UsersIDOK struct { + Payload *models.UserEntity +} + +// IsSuccess returns true when this get v1 users Id o k response has a 2xx status code +func (o *GetV1UsersIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get v1 users Id o k response has a 3xx status code +func (o *GetV1UsersIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get v1 users Id o k response has a 4xx status code +func (o *GetV1UsersIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get v1 users Id o k response has a 5xx status code +func (o *GetV1UsersIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get v1 users Id o k response a status code equal to that given +func (o *GetV1UsersIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetV1UsersIDOK) Error() string { + return fmt.Sprintf("[GET /v1/users/{id}][%d] getV1UsersIdOK %+v", 200, o.Payload) +} + +func (o *GetV1UsersIDOK) String() string { + return fmt.Sprintf("[GET /v1/users/{id}][%d] getV1UsersIdOK %+v", 200, o.Payload) +} + +func (o *GetV1UsersIDOK) GetPayload() *models.UserEntity { + return o.Payload +} + +func (o *GetV1UsersIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UserEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/users/users_client.go b/client/users/users_client.go index 99c0054..da1f9bf 100644 --- a/client/users/users_client.go +++ b/client/users/users_client.go @@ -32,6 +32,8 @@ type ClientOption func(*runtime.ClientOperation) type ClientService interface { GetV1Users(params *GetV1UsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetV1UsersOK, error) + GetV1UsersID(params *GetV1UsersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetV1UsersIDOK, error) + GetV1UsersIDServices(params *GetV1UsersIDServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetV1UsersIDServicesOK, error) SetTransport(transport runtime.ClientTransport) @@ -78,6 +80,47 @@ func (a *Client) GetV1Users(params *GetV1UsersParams, authInfo runtime.ClientAut panic(msg) } +/* +GetV1UsersID retrieves a single user + +Retrieve a single user by ID +*/ +func (a *Client) GetV1UsersID(params *GetV1UsersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetV1UsersIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetV1UsersIDParams() + } + op := &runtime.ClientOperation{ + ID: "getV1UsersId", + Method: "GET", + PathPattern: "/v1/users/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetV1UsersIDReader{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.(*GetV1UsersIDOK) + 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 getV1UsersId: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* GetV1UsersIDServices retrieves a list of services owned by the teams a user is on diff --git a/models/membership_entity.go b/models/membership_entity.go index 7455104..d4c3505 100644 --- a/models/membership_entity.go +++ b/models/membership_entity.go @@ -24,6 +24,9 @@ type MembershipEntity struct { // schedule Schedule *ScheduleEntity `json:"schedule,omitempty"` + // signals on call schedule + SignalsOnCallSchedule *SuccinctEntity `json:"signals_on_call_schedule,omitempty"` + // user User *UserEntity `json:"user,omitempty"` } @@ -40,6 +43,10 @@ func (m *MembershipEntity) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateSignalsOnCallSchedule(formats); err != nil { + res = append(res, err) + } + if err := m.validateUser(formats); err != nil { res = append(res, err) } @@ -88,6 +95,25 @@ func (m *MembershipEntity) validateSchedule(formats strfmt.Registry) error { return nil } +func (m *MembershipEntity) validateSignalsOnCallSchedule(formats strfmt.Registry) error { + if swag.IsZero(m.SignalsOnCallSchedule) { // not required + return nil + } + + if m.SignalsOnCallSchedule != nil { + if err := m.SignalsOnCallSchedule.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("signals_on_call_schedule") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("signals_on_call_schedule") + } + return err + } + } + + return nil +} + func (m *MembershipEntity) validateUser(formats strfmt.Registry) error { if swag.IsZero(m.User) { // not required return nil @@ -119,6 +145,10 @@ func (m *MembershipEntity) ContextValidate(ctx context.Context, formats strfmt.R res = append(res, err) } + if err := m.contextValidateSignalsOnCallSchedule(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateUser(ctx, formats); err != nil { res = append(res, err) } @@ -161,6 +191,22 @@ func (m *MembershipEntity) contextValidateSchedule(ctx context.Context, formats return nil } +func (m *MembershipEntity) contextValidateSignalsOnCallSchedule(ctx context.Context, formats strfmt.Registry) error { + + if m.SignalsOnCallSchedule != nil { + if err := m.SignalsOnCallSchedule.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("signals_on_call_schedule") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("signals_on_call_schedule") + } + return err + } + } + + return nil +} + func (m *MembershipEntity) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { if m.User != nil { diff --git a/models/patch_v1_scim_v2_users_id.go b/models/patch_v1_scim_v2_users_id.go new file mode 100644 index 0000000..5bd935f --- /dev/null +++ b/models/patch_v1_scim_v2_users_id.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PatchV1ScimV2UsersID PATCH SCIM endpoint to update a User. This endpoint is used to update a resource's attributes. +// +// swagger:model patchV1ScimV2UsersId +type PatchV1ScimV2UsersID struct { + + // An array of operations to perform on the user + // Required: true + Operations []*PatchV1ScimV2UsersIDOperationsItems0 `json:"Operations"` + + // An optional trail to log the request + Trail string `json:"trail,omitempty"` +} + +// Validate validates this patch v1 scim v2 users Id +func (m *PatchV1ScimV2UsersID) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperations(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PatchV1ScimV2UsersID) validateOperations(formats strfmt.Registry) error { + + if err := validate.Required("Operations", "body", m.Operations); err != nil { + return err + } + + for i := 0; i < len(m.Operations); i++ { + if swag.IsZero(m.Operations[i]) { // not required + continue + } + + if m.Operations[i] != nil { + if err := m.Operations[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Operations" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Operations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this patch v1 scim v2 users Id based on the context it is used +func (m *PatchV1ScimV2UsersID) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOperations(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PatchV1ScimV2UsersID) contextValidateOperations(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Operations); i++ { + + if m.Operations[i] != nil { + if err := m.Operations[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Operations" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Operations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PatchV1ScimV2UsersID) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PatchV1ScimV2UsersID) UnmarshalBinary(b []byte) error { + var res PatchV1ScimV2UsersID + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// PatchV1ScimV2UsersIDOperationsItems0 patch v1 scim v2 users ID operations items0 +// +// swagger:model PatchV1ScimV2UsersIDOperationsItems0 +type PatchV1ScimV2UsersIDOperationsItems0 struct { + + // The operation to perform on the user. Options are add, remove, replace + // Required: true + Op *string `json:"op"` + + // The path to the attribute to be modified + // Required: true + Path *string `json:"path"` +} + +// Validate validates this patch v1 scim v2 users ID operations items0 +func (m *PatchV1ScimV2UsersIDOperationsItems0) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOp(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePath(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PatchV1ScimV2UsersIDOperationsItems0) validateOp(formats strfmt.Registry) error { + + if err := validate.Required("op", "body", m.Op); err != nil { + return err + } + + return nil +} + +func (m *PatchV1ScimV2UsersIDOperationsItems0) validatePath(formats strfmt.Registry) error { + + if err := validate.Required("path", "body", m.Path); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this patch v1 scim v2 users ID operations items0 based on context it is used +func (m *PatchV1ScimV2UsersIDOperationsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PatchV1ScimV2UsersIDOperationsItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PatchV1ScimV2UsersIDOperationsItems0) UnmarshalBinary(b []byte) error { + var res PatchV1ScimV2UsersIDOperationsItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user_entity.go b/models/user_entity.go index 92dc6bd..0ba8b60 100644 --- a/models/user_entity.go +++ b/models/user_entity.go @@ -14,7 +14,7 @@ import ( "github.com/go-openapi/validate" ) -// UserEntity user entity +// UserEntity UserEntity model // // swagger:model UserEntity type UserEntity struct {