diff --git a/rest_client_zrok/share/share_client.go b/rest_client_zrok/share/share_client.go index 1f992f99..48acfa17 100644 --- a/rest_client_zrok/share/share_client.go +++ b/rest_client_zrok/share/share_client.go @@ -38,6 +38,8 @@ type ClientService interface { Unshare(params *UnshareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnshareOK, error) + UpdateAccess(params *UpdateAccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateAccessOK, error) + UpdateShare(params *UpdateShareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateShareOK, error) SetTransport(transport runtime.ClientTransport) @@ -199,6 +201,45 @@ func (a *Client) Unshare(params *UnshareParams, authInfo runtime.ClientAuthInfoW panic(msg) } +/* +UpdateAccess update access API +*/ +func (a *Client) UpdateAccess(params *UpdateAccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateAccessOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateAccessParams() + } + op := &runtime.ClientOperation{ + ID: "updateAccess", + Method: "PATCH", + PathPattern: "/access", + ProducesMediaTypes: []string{"application/zrok.v1+json"}, + ConsumesMediaTypes: []string{"application/zrok.v1+json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateAccessReader{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.(*UpdateAccessOK) + 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 updateAccess: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* UpdateShare update share API */ diff --git a/rest_client_zrok/share/update_access_parameters.go b/rest_client_zrok/share/update_access_parameters.go new file mode 100644 index 00000000..44bddb02 --- /dev/null +++ b/rest_client_zrok/share/update_access_parameters.go @@ -0,0 +1,146 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package share + +// 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" +) + +// NewUpdateAccessParams creates a new UpdateAccessParams 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 NewUpdateAccessParams() *UpdateAccessParams { + return &UpdateAccessParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateAccessParamsWithTimeout creates a new UpdateAccessParams object +// with the ability to set a timeout on a request. +func NewUpdateAccessParamsWithTimeout(timeout time.Duration) *UpdateAccessParams { + return &UpdateAccessParams{ + timeout: timeout, + } +} + +// NewUpdateAccessParamsWithContext creates a new UpdateAccessParams object +// with the ability to set a context for a request. +func NewUpdateAccessParamsWithContext(ctx context.Context) *UpdateAccessParams { + return &UpdateAccessParams{ + Context: ctx, + } +} + +// NewUpdateAccessParamsWithHTTPClient creates a new UpdateAccessParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateAccessParamsWithHTTPClient(client *http.Client) *UpdateAccessParams { + return &UpdateAccessParams{ + HTTPClient: client, + } +} + +/* +UpdateAccessParams contains all the parameters to send to the API endpoint + + for the update access operation. + + Typically these are written to a http.Request. +*/ +type UpdateAccessParams struct { + + // Body. + Body UpdateAccessBody + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update access params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateAccessParams) WithDefaults() *UpdateAccessParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update access params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateAccessParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update access params +func (o *UpdateAccessParams) WithTimeout(timeout time.Duration) *UpdateAccessParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update access params +func (o *UpdateAccessParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update access params +func (o *UpdateAccessParams) WithContext(ctx context.Context) *UpdateAccessParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update access params +func (o *UpdateAccessParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update access params +func (o *UpdateAccessParams) WithHTTPClient(client *http.Client) *UpdateAccessParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update access params +func (o *UpdateAccessParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the update access params +func (o *UpdateAccessParams) WithBody(body UpdateAccessBody) *UpdateAccessParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update access params +func (o *UpdateAccessParams) SetBody(body UpdateAccessBody) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateAccessParams) 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 +} diff --git a/rest_client_zrok/share/update_access_responses.go b/rest_client_zrok/share/update_access_responses.go new file mode 100644 index 00000000..532b55a0 --- /dev/null +++ b/rest_client_zrok/share/update_access_responses.go @@ -0,0 +1,317 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package share + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UpdateAccessReader is a Reader for the UpdateAccess structure. +type UpdateAccessReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateAccessReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateAccessOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewUpdateAccessUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewUpdateAccessNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewUpdateAccessInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /access] updateAccess", response, response.Code()) + } +} + +// NewUpdateAccessOK creates a UpdateAccessOK with default headers values +func NewUpdateAccessOK() *UpdateAccessOK { + return &UpdateAccessOK{} +} + +/* +UpdateAccessOK describes a response with status code 200, with default header values. + +access updated +*/ +type UpdateAccessOK struct { +} + +// IsSuccess returns true when this update access o k response has a 2xx status code +func (o *UpdateAccessOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update access o k response has a 3xx status code +func (o *UpdateAccessOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update access o k response has a 4xx status code +func (o *UpdateAccessOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update access o k response has a 5xx status code +func (o *UpdateAccessOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update access o k response a status code equal to that given +func (o *UpdateAccessOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update access o k response +func (o *UpdateAccessOK) Code() int { + return 200 +} + +func (o *UpdateAccessOK) Error() string { + return fmt.Sprintf("[PATCH /access][%d] updateAccessOK ", 200) +} + +func (o *UpdateAccessOK) String() string { + return fmt.Sprintf("[PATCH /access][%d] updateAccessOK ", 200) +} + +func (o *UpdateAccessOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateAccessUnauthorized creates a UpdateAccessUnauthorized with default headers values +func NewUpdateAccessUnauthorized() *UpdateAccessUnauthorized { + return &UpdateAccessUnauthorized{} +} + +/* +UpdateAccessUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type UpdateAccessUnauthorized struct { +} + +// IsSuccess returns true when this update access unauthorized response has a 2xx status code +func (o *UpdateAccessUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update access unauthorized response has a 3xx status code +func (o *UpdateAccessUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update access unauthorized response has a 4xx status code +func (o *UpdateAccessUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this update access unauthorized response has a 5xx status code +func (o *UpdateAccessUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this update access unauthorized response a status code equal to that given +func (o *UpdateAccessUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the update access unauthorized response +func (o *UpdateAccessUnauthorized) Code() int { + return 401 +} + +func (o *UpdateAccessUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /access][%d] updateAccessUnauthorized ", 401) +} + +func (o *UpdateAccessUnauthorized) String() string { + return fmt.Sprintf("[PATCH /access][%d] updateAccessUnauthorized ", 401) +} + +func (o *UpdateAccessUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateAccessNotFound creates a UpdateAccessNotFound with default headers values +func NewUpdateAccessNotFound() *UpdateAccessNotFound { + return &UpdateAccessNotFound{} +} + +/* +UpdateAccessNotFound describes a response with status code 404, with default header values. + +not found +*/ +type UpdateAccessNotFound struct { +} + +// IsSuccess returns true when this update access not found response has a 2xx status code +func (o *UpdateAccessNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update access not found response has a 3xx status code +func (o *UpdateAccessNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update access not found response has a 4xx status code +func (o *UpdateAccessNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this update access not found response has a 5xx status code +func (o *UpdateAccessNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this update access not found response a status code equal to that given +func (o *UpdateAccessNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the update access not found response +func (o *UpdateAccessNotFound) Code() int { + return 404 +} + +func (o *UpdateAccessNotFound) Error() string { + return fmt.Sprintf("[PATCH /access][%d] updateAccessNotFound ", 404) +} + +func (o *UpdateAccessNotFound) String() string { + return fmt.Sprintf("[PATCH /access][%d] updateAccessNotFound ", 404) +} + +func (o *UpdateAccessNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateAccessInternalServerError creates a UpdateAccessInternalServerError with default headers values +func NewUpdateAccessInternalServerError() *UpdateAccessInternalServerError { + return &UpdateAccessInternalServerError{} +} + +/* +UpdateAccessInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type UpdateAccessInternalServerError struct { +} + +// IsSuccess returns true when this update access internal server error response has a 2xx status code +func (o *UpdateAccessInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update access internal server error response has a 3xx status code +func (o *UpdateAccessInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update access internal server error response has a 4xx status code +func (o *UpdateAccessInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this update access internal server error response has a 5xx status code +func (o *UpdateAccessInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this update access internal server error response a status code equal to that given +func (o *UpdateAccessInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the update access internal server error response +func (o *UpdateAccessInternalServerError) Code() int { + return 500 +} + +func (o *UpdateAccessInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /access][%d] updateAccessInternalServerError ", 500) +} + +func (o *UpdateAccessInternalServerError) String() string { + return fmt.Sprintf("[PATCH /access][%d] updateAccessInternalServerError ", 500) +} + +func (o *UpdateAccessInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +/* +UpdateAccessBody update access body +swagger:model UpdateAccessBody +*/ +type UpdateAccessBody struct { + + // description + Description string `json:"description,omitempty"` + + // frontend token + FrontendToken string `json:"frontendToken,omitempty"` +} + +// Validate validates this update access body +func (o *UpdateAccessBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this update access body based on context it is used +func (o *UpdateAccessBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *UpdateAccessBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *UpdateAccessBody) UnmarshalBinary(b []byte) error { + var res UpdateAccessBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/rest_server_zrok/embedded_spec.go b/rest_server_zrok/embedded_spec.go index 6f7c916a..626fd0d3 100644 --- a/rest_server_zrok/embedded_spec.go +++ b/rest_server_zrok/embedded_spec.go @@ -89,6 +89,47 @@ func init() { "description": "internal server error" } } + }, + "patch": { + "security": [ + { + "key": [] + } + ], + "tags": [ + "share" + ], + "operationId": "updateAccess", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "properties": { + "description": { + "type": "string" + }, + "frontendToken": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "access updated" + }, + "401": { + "description": "unauthorized" + }, + "404": { + "description": "not found" + }, + "500": { + "description": "internal server error" + } + } } }, "/account": { @@ -2292,6 +2333,47 @@ func init() { "description": "internal server error" } } + }, + "patch": { + "security": [ + { + "key": [] + } + ], + "tags": [ + "share" + ], + "operationId": "updateAccess", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "properties": { + "description": { + "type": "string" + }, + "frontendToken": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "access updated" + }, + "401": { + "description": "unauthorized" + }, + "404": { + "description": "not found" + }, + "500": { + "description": "internal server error" + } + } } }, "/account": { diff --git a/rest_server_zrok/operations/share/update_access.go b/rest_server_zrok/operations/share/update_access.go new file mode 100644 index 00000000..511cff15 --- /dev/null +++ b/rest_server_zrok/operations/share/update_access.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package share + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "context" + "net/http" + + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "github.com/openziti/zrok/rest_model_zrok" +) + +// UpdateAccessHandlerFunc turns a function with the right signature into a update access handler +type UpdateAccessHandlerFunc func(UpdateAccessParams, *rest_model_zrok.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn UpdateAccessHandlerFunc) Handle(params UpdateAccessParams, principal *rest_model_zrok.Principal) middleware.Responder { + return fn(params, principal) +} + +// UpdateAccessHandler interface for that can handle valid update access params +type UpdateAccessHandler interface { + Handle(UpdateAccessParams, *rest_model_zrok.Principal) middleware.Responder +} + +// NewUpdateAccess creates a new http.Handler for the update access operation +func NewUpdateAccess(ctx *middleware.Context, handler UpdateAccessHandler) *UpdateAccess { + return &UpdateAccess{Context: ctx, Handler: handler} +} + +/* + UpdateAccess swagger:route PATCH /access share updateAccess + +UpdateAccess update access API +*/ +type UpdateAccess struct { + Context *middleware.Context + Handler UpdateAccessHandler +} + +func (o *UpdateAccess) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewUpdateAccessParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *rest_model_zrok.Principal + if uprinc != nil { + principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} + +// UpdateAccessBody update access body +// +// swagger:model UpdateAccessBody +type UpdateAccessBody struct { + + // description + Description string `json:"description,omitempty"` + + // frontend token + FrontendToken string `json:"frontendToken,omitempty"` +} + +// Validate validates this update access body +func (o *UpdateAccessBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this update access body based on context it is used +func (o *UpdateAccessBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *UpdateAccessBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *UpdateAccessBody) UnmarshalBinary(b []byte) error { + var res UpdateAccessBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/rest_server_zrok/operations/share/update_access_parameters.go b/rest_server_zrok/operations/share/update_access_parameters.go new file mode 100644 index 00000000..4ae7400a --- /dev/null +++ b/rest_server_zrok/operations/share/update_access_parameters.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package share + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" +) + +// NewUpdateAccessParams creates a new UpdateAccessParams object +// +// There are no default values defined in the spec. +func NewUpdateAccessParams() UpdateAccessParams { + + return UpdateAccessParams{} +} + +// UpdateAccessParams contains all the bound params for the update access operation +// typically these are obtained from a http.Request +// +// swagger:parameters updateAccess +type UpdateAccessParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /* + In: body + */ + Body UpdateAccessBody +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewUpdateAccessParams() beforehand. +func (o *UpdateAccessParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if runtime.HasBody(r) { + defer r.Body.Close() + var body UpdateAccessBody + if err := route.Consumer.Consume(r.Body, &body); err != nil { + res = append(res, errors.NewParseError("body", "body", "", err)) + } else { + // validate body object + if err := body.Validate(route.Formats); err != nil { + res = append(res, err) + } + + ctx := validate.WithOperationRequest(r.Context()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + + if len(res) == 0 { + o.Body = body + } + } + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/rest_server_zrok/operations/share/update_access_responses.go b/rest_server_zrok/operations/share/update_access_responses.go new file mode 100644 index 00000000..d03c90b1 --- /dev/null +++ b/rest_server_zrok/operations/share/update_access_responses.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package share + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" +) + +// UpdateAccessOKCode is the HTTP code returned for type UpdateAccessOK +const UpdateAccessOKCode int = 200 + +/* +UpdateAccessOK access updated + +swagger:response updateAccessOK +*/ +type UpdateAccessOK struct { +} + +// NewUpdateAccessOK creates UpdateAccessOK with default headers values +func NewUpdateAccessOK() *UpdateAccessOK { + + return &UpdateAccessOK{} +} + +// WriteResponse to the client +func (o *UpdateAccessOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(200) +} + +// UpdateAccessUnauthorizedCode is the HTTP code returned for type UpdateAccessUnauthorized +const UpdateAccessUnauthorizedCode int = 401 + +/* +UpdateAccessUnauthorized unauthorized + +swagger:response updateAccessUnauthorized +*/ +type UpdateAccessUnauthorized struct { +} + +// NewUpdateAccessUnauthorized creates UpdateAccessUnauthorized with default headers values +func NewUpdateAccessUnauthorized() *UpdateAccessUnauthorized { + + return &UpdateAccessUnauthorized{} +} + +// WriteResponse to the client +func (o *UpdateAccessUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(401) +} + +// UpdateAccessNotFoundCode is the HTTP code returned for type UpdateAccessNotFound +const UpdateAccessNotFoundCode int = 404 + +/* +UpdateAccessNotFound not found + +swagger:response updateAccessNotFound +*/ +type UpdateAccessNotFound struct { +} + +// NewUpdateAccessNotFound creates UpdateAccessNotFound with default headers values +func NewUpdateAccessNotFound() *UpdateAccessNotFound { + + return &UpdateAccessNotFound{} +} + +// WriteResponse to the client +func (o *UpdateAccessNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(404) +} + +// UpdateAccessInternalServerErrorCode is the HTTP code returned for type UpdateAccessInternalServerError +const UpdateAccessInternalServerErrorCode int = 500 + +/* +UpdateAccessInternalServerError internal server error + +swagger:response updateAccessInternalServerError +*/ +type UpdateAccessInternalServerError struct { +} + +// NewUpdateAccessInternalServerError creates UpdateAccessInternalServerError with default headers values +func NewUpdateAccessInternalServerError() *UpdateAccessInternalServerError { + + return &UpdateAccessInternalServerError{} +} + +// WriteResponse to the client +func (o *UpdateAccessInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(500) +} diff --git a/rest_server_zrok/operations/share/update_access_urlbuilder.go b/rest_server_zrok/operations/share/update_access_urlbuilder.go new file mode 100644 index 00000000..d04248f0 --- /dev/null +++ b/rest_server_zrok/operations/share/update_access_urlbuilder.go @@ -0,0 +1,87 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package share + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// UpdateAccessURL generates an URL for the update access operation +type UpdateAccessURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *UpdateAccessURL) WithBasePath(bp string) *UpdateAccessURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *UpdateAccessURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *UpdateAccessURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/access" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *UpdateAccessURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *UpdateAccessURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *UpdateAccessURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on UpdateAccessURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on UpdateAccessURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *UpdateAccessURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/rest_server_zrok/operations/zrok_api.go b/rest_server_zrok/operations/zrok_api.go index ecf80df8..84f306d0 100644 --- a/rest_server_zrok/operations/zrok_api.go +++ b/rest_server_zrok/operations/zrok_api.go @@ -166,6 +166,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI { ShareUnshareHandler: share.UnshareHandlerFunc(func(params share.UnshareParams, principal *rest_model_zrok.Principal) middleware.Responder { return middleware.NotImplemented("operation share.Unshare has not yet been implemented") }), + ShareUpdateAccessHandler: share.UpdateAccessHandlerFunc(func(params share.UpdateAccessParams, principal *rest_model_zrok.Principal) middleware.Responder { + return middleware.NotImplemented("operation share.UpdateAccess has not yet been implemented") + }), AdminUpdateFrontendHandler: admin.UpdateFrontendHandlerFunc(func(params admin.UpdateFrontendParams, principal *rest_model_zrok.Principal) middleware.Responder { return middleware.NotImplemented("operation admin.UpdateFrontend has not yet been implemented") }), @@ -306,6 +309,8 @@ type ZrokAPI struct { ShareUnaccessHandler share.UnaccessHandler // ShareUnshareHandler sets the operation handler for the unshare operation ShareUnshareHandler share.UnshareHandler + // ShareUpdateAccessHandler sets the operation handler for the update access operation + ShareUpdateAccessHandler share.UpdateAccessHandler // AdminUpdateFrontendHandler sets the operation handler for the update frontend operation AdminUpdateFrontendHandler admin.UpdateFrontendHandler // ShareUpdateShareHandler sets the operation handler for the update share operation @@ -512,6 +517,9 @@ func (o *ZrokAPI) Validate() error { if o.ShareUnshareHandler == nil { unregistered = append(unregistered, "share.UnshareHandler") } + if o.ShareUpdateAccessHandler == nil { + unregistered = append(unregistered, "share.UpdateAccessHandler") + } if o.AdminUpdateFrontendHandler == nil { unregistered = append(unregistered, "admin.UpdateFrontendHandler") } @@ -782,6 +790,10 @@ func (o *ZrokAPI) initHandlerCache() { if o.handlers["PATCH"] == nil { o.handlers["PATCH"] = make(map[string]http.Handler) } + o.handlers["PATCH"]["/access"] = share.NewUpdateAccess(o.context, o.ShareUpdateAccessHandler) + if o.handlers["PATCH"] == nil { + o.handlers["PATCH"] = make(map[string]http.Handler) + } o.handlers["PATCH"]["/frontend"] = admin.NewUpdateFrontend(o.context, o.AdminUpdateFrontendHandler) if o.handlers["PATCH"] == nil { o.handlers["PATCH"] = make(map[string]http.Handler) diff --git a/sdk/nodejs/sdk/src/zrok/api/.openapi-generator/FILES b/sdk/nodejs/sdk/src/zrok/api/.openapi-generator/FILES index 6bc0b382..7f8796fb 100644 --- a/sdk/nodejs/sdk/src/zrok/api/.openapi-generator/FILES +++ b/sdk/nodejs/sdk/src/zrok/api/.openapi-generator/FILES @@ -52,6 +52,7 @@ model/shareResponse.ts model/sparkDataSample.ts model/unaccessRequest.ts model/unshareRequest.ts +model/updateAccessRequest.ts model/updateFrontendRequest.ts model/updateShareRequest.ts model/verify200Response.ts diff --git a/sdk/nodejs/sdk/src/zrok/api/api/shareApi.ts b/sdk/nodejs/sdk/src/zrok/api/api/shareApi.ts index 27e0942b..5b8f7871 100644 --- a/sdk/nodejs/sdk/src/zrok/api/api/shareApi.ts +++ b/sdk/nodejs/sdk/src/zrok/api/api/shareApi.ts @@ -21,6 +21,7 @@ import { ShareRequest } from '../model/shareRequest'; import { ShareResponse } from '../model/shareResponse'; import { UnaccessRequest } from '../model/unaccessRequest'; import { UnshareRequest } from '../model/unshareRequest'; +import { UpdateAccessRequest } from '../model/updateAccessRequest'; import { UpdateShareRequest } from '../model/updateShareRequest'; import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; @@ -350,6 +351,64 @@ export class ShareApi { }); }); } + /** + * + * @param body + */ + public async updateAccess (body?: UpdateAccessRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/access'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PATCH', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(body, "UpdateAccessRequest") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.key.apiKey) { + authenticationPromise = authenticationPromise.then(() => this.authentications.key.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } /** * * @param body diff --git a/sdk/nodejs/sdk/src/zrok/api/model/models.ts b/sdk/nodejs/sdk/src/zrok/api/model/models.ts index 3ea6a7b7..f7582b72 100644 --- a/sdk/nodejs/sdk/src/zrok/api/model/models.ts +++ b/sdk/nodejs/sdk/src/zrok/api/model/models.ts @@ -44,6 +44,7 @@ export * from './shareResponse'; export * from './sparkDataSample'; export * from './unaccessRequest'; export * from './unshareRequest'; +export * from './updateAccessRequest'; export * from './updateFrontendRequest'; export * from './updateShareRequest'; export * from './verify200Response'; @@ -106,6 +107,7 @@ import { ShareResponse } from './shareResponse'; import { SparkDataSample } from './sparkDataSample'; import { UnaccessRequest } from './unaccessRequest'; import { UnshareRequest } from './unshareRequest'; +import { UpdateAccessRequest } from './updateAccessRequest'; import { UpdateFrontendRequest } from './updateFrontendRequest'; import { UpdateShareRequest } from './updateShareRequest'; import { Verify200Response } from './verify200Response'; @@ -176,6 +178,7 @@ let typeMap: {[index: string]: any} = { "SparkDataSample": SparkDataSample, "UnaccessRequest": UnaccessRequest, "UnshareRequest": UnshareRequest, + "UpdateAccessRequest": UpdateAccessRequest, "UpdateFrontendRequest": UpdateFrontendRequest, "UpdateShareRequest": UpdateShareRequest, "Verify200Response": Verify200Response, diff --git a/sdk/nodejs/sdk/src/zrok/api/model/updateAccessRequest.ts b/sdk/nodejs/sdk/src/zrok/api/model/updateAccessRequest.ts new file mode 100644 index 00000000..bca84120 --- /dev/null +++ b/sdk/nodejs/sdk/src/zrok/api/model/updateAccessRequest.ts @@ -0,0 +1,37 @@ +/** + * zrok + * zrok client access + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { RequestFile } from './models'; + +export class UpdateAccessRequest { + 'frontendToken'?: string; + 'description'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "frontendToken", + "baseName": "frontendToken", + "type": "string" + }, + { + "name": "description", + "baseName": "description", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return UpdateAccessRequest.attributeTypeMap; + } +} + diff --git a/sdk/python/sdk/zrok/README.md b/sdk/python/sdk/zrok/README.md index dc55aa6c..99f9c672 100644 --- a/sdk/python/sdk/zrok/README.md +++ b/sdk/python/sdk/zrok/README.md @@ -188,11 +188,13 @@ Class | Method | HTTP request | Description *ShareApi* | [**share**](docs/ShareApi.md#share) | **POST** /share | *ShareApi* | [**unaccess**](docs/ShareApi.md#unaccess) | **DELETE** /unaccess | *ShareApi* | [**unshare**](docs/ShareApi.md#unshare) | **DELETE** /unshare | +*ShareApi* | [**update_access**](docs/ShareApi.md#update_access) | **PATCH** /access | *ShareApi* | [**update_share**](docs/ShareApi.md#update_share) | **PATCH** /share | ## Documentation For Models - [AccessBody](docs/AccessBody.md) + - [AccessBody1](docs/AccessBody1.md) - [AccountBody](docs/AccountBody.md) - [AuthUser](docs/AuthUser.md) - [ChangePasswordBody](docs/ChangePasswordBody.md) diff --git a/sdk/python/sdk/zrok/docs/AccessBody1.md b/sdk/python/sdk/zrok/docs/AccessBody1.md new file mode 100644 index 00000000..afb601c9 --- /dev/null +++ b/sdk/python/sdk/zrok/docs/AccessBody1.md @@ -0,0 +1,10 @@ +# AccessBody1 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**frontend_token** | **str** | | [optional] +**description** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/sdk/python/sdk/zrok/docs/ShareApi.md b/sdk/python/sdk/zrok/docs/ShareApi.md index e7303e1b..86a8b390 100644 --- a/sdk/python/sdk/zrok/docs/ShareApi.md +++ b/sdk/python/sdk/zrok/docs/ShareApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**share**](ShareApi.md#share) | **POST** /share | [**unaccess**](ShareApi.md#unaccess) | **DELETE** /unaccess | [**unshare**](ShareApi.md#unshare) | **DELETE** /unshare | +[**update_access**](ShareApi.md#update_access) | **PATCH** /access | [**update_share**](ShareApi.md#update_share) | **PATCH** /share | # **access** @@ -212,6 +213,56 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **update_access** +> update_access(body=body) + + + +### Example +```python +from __future__ import print_function +import time +import zrok_api +from zrok_api.rest import ApiException +from pprint import pprint + +# Configure API key authorization: key +configuration = zrok_api.Configuration() +configuration.api_key['x-token'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['x-token'] = 'Bearer' + +# create an instance of the API class +api_instance = zrok_api.ShareApi(zrok_api.ApiClient(configuration)) +body = zrok_api.AccessBody1() # AccessBody1 | (optional) + +try: + api_instance.update_access(body=body) +except ApiException as e: + print("Exception when calling ShareApi->update_access: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**AccessBody1**](AccessBody1.md)| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[key](../README.md#key) + +### HTTP request headers + + - **Content-Type**: application/zrok.v1+json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **update_share** > update_share(body=body) diff --git a/sdk/python/sdk/zrok/test/test_access_body1.py b/sdk/python/sdk/zrok/test/test_access_body1.py new file mode 100644 index 00000000..53e78285 --- /dev/null +++ b/sdk/python/sdk/zrok/test/test_access_body1.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + zrok + + zrok client access # noqa: E501 + + OpenAPI spec version: 1.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import zrok_api +from zrok_api.models.access_body1 import AccessBody1 # noqa: E501 +from zrok_api.rest import ApiException + + +class TestAccessBody1(unittest.TestCase): + """AccessBody1 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAccessBody1(self): + """Test AccessBody1""" + # FIXME: construct object with mandatory attributes with example values + # model = zrok_api.models.access_body1.AccessBody1() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/sdk/python/sdk/zrok/zrok_api/__init__.py b/sdk/python/sdk/zrok/zrok_api/__init__.py index 8bb1bad5..27c419c3 100644 --- a/sdk/python/sdk/zrok/zrok_api/__init__.py +++ b/sdk/python/sdk/zrok/zrok_api/__init__.py @@ -25,6 +25,7 @@ from zrok_api.api_client import ApiClient from zrok_api.configuration import Configuration # import models into sdk package from zrok_api.models.access_body import AccessBody +from zrok_api.models.access_body1 import AccessBody1 from zrok_api.models.account_body import AccountBody from zrok_api.models.auth_user import AuthUser from zrok_api.models.change_password_body import ChangePasswordBody diff --git a/sdk/python/sdk/zrok/zrok_api/api/share_api.py b/sdk/python/sdk/zrok/zrok_api/api/share_api.py index 21b0c013..49362e17 100644 --- a/sdk/python/sdk/zrok/zrok_api/api/share_api.py +++ b/sdk/python/sdk/zrok/zrok_api/api/share_api.py @@ -400,6 +400,95 @@ class ShareApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def update_access(self, **kwargs): # noqa: E501 + """update_access # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_access(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AccessBody1 body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_access_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.update_access_with_http_info(**kwargs) # noqa: E501 + return data + + def update_access_with_http_info(self, **kwargs): # noqa: E501 + """update_access # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_access_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AccessBody1 body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_access" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/zrok.v1+json']) # noqa: E501 + + # Authentication setting + auth_settings = ['key'] # noqa: E501 + + return self.api_client.call_api( + '/access', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + def update_share(self, **kwargs): # noqa: E501 """update_share # noqa: E501 diff --git a/sdk/python/sdk/zrok/zrok_api/models/__init__.py b/sdk/python/sdk/zrok/zrok_api/models/__init__.py index 1ab687ee..2387f7cc 100644 --- a/sdk/python/sdk/zrok/zrok_api/models/__init__.py +++ b/sdk/python/sdk/zrok/zrok_api/models/__init__.py @@ -15,6 +15,7 @@ from __future__ import absolute_import # import models into model package from zrok_api.models.access_body import AccessBody +from zrok_api.models.access_body1 import AccessBody1 from zrok_api.models.account_body import AccountBody from zrok_api.models.auth_user import AuthUser from zrok_api.models.change_password_body import ChangePasswordBody diff --git a/sdk/python/sdk/zrok/zrok_api/models/access_body1.py b/sdk/python/sdk/zrok/zrok_api/models/access_body1.py new file mode 100644 index 00000000..1bc7e2b5 --- /dev/null +++ b/sdk/python/sdk/zrok/zrok_api/models/access_body1.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + zrok + + zrok client access # noqa: E501 + + OpenAPI spec version: 1.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class AccessBody1(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'frontend_token': 'str', + 'description': 'str' + } + + attribute_map = { + 'frontend_token': 'frontendToken', + 'description': 'description' + } + + def __init__(self, frontend_token=None, description=None): # noqa: E501 + """AccessBody1 - a model defined in Swagger""" # noqa: E501 + self._frontend_token = None + self._description = None + self.discriminator = None + if frontend_token is not None: + self.frontend_token = frontend_token + if description is not None: + self.description = description + + @property + def frontend_token(self): + """Gets the frontend_token of this AccessBody1. # noqa: E501 + + + :return: The frontend_token of this AccessBody1. # noqa: E501 + :rtype: str + """ + return self._frontend_token + + @frontend_token.setter + def frontend_token(self, frontend_token): + """Sets the frontend_token of this AccessBody1. + + + :param frontend_token: The frontend_token of this AccessBody1. # noqa: E501 + :type: str + """ + + self._frontend_token = frontend_token + + @property + def description(self): + """Gets the description of this AccessBody1. # noqa: E501 + + + :return: The description of this AccessBody1. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this AccessBody1. + + + :param description: The description of this AccessBody1. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AccessBody1, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AccessBody1): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/specs/zrok.yml b/specs/zrok.yml index 9891919e..8bcf1558 100644 --- a/specs/zrok.yml +++ b/specs/zrok.yml @@ -1028,6 +1028,30 @@ paths: description: not found 500: description: internal server error + patch: + tags: + - share + security: + - key: [] + operationId: updateAccess + parameters: + - name: body + in: body + schema: + properties: + frontendToken: + type: string + description: + type: string + responses: + 200: + description: access updated + 401: + description: unauthorized + 404: + description: not found + 500: + description: internal server error /share: post: diff --git a/ui/src/api/.openapi-generator/FILES b/ui/src/api/.openapi-generator/FILES index 53b2d720..dc02ae95 100644 --- a/ui/src/api/.openapi-generator/FILES +++ b/ui/src/api/.openapi-generator/FILES @@ -49,6 +49,7 @@ models/ShareResponse.ts models/SparkDataSample.ts models/UnaccessRequest.ts models/UnshareRequest.ts +models/UpdateAccessRequest.ts models/UpdateFrontendRequest.ts models/UpdateShareRequest.ts models/Verify200Response.ts diff --git a/ui/src/api/apis/ShareApi.ts b/ui/src/api/apis/ShareApi.ts index 3dcd3747..67811acb 100644 --- a/ui/src/api/apis/ShareApi.ts +++ b/ui/src/api/apis/ShareApi.ts @@ -21,6 +21,7 @@ import type { ShareResponse, UnaccessRequest, UnshareRequest, + UpdateAccessRequest, UpdateShareRequest, } from '../models/index'; import { @@ -36,6 +37,8 @@ import { UnaccessRequestToJSON, UnshareRequestFromJSON, UnshareRequestToJSON, + UpdateAccessRequestFromJSON, + UpdateAccessRequestToJSON, UpdateShareRequestFromJSON, UpdateShareRequestToJSON, } from '../models/index'; @@ -56,6 +59,10 @@ export interface UnshareOperationRequest { body?: UnshareRequest; } +export interface UpdateAccessOperationRequest { + body?: UpdateAccessRequest; +} + export interface UpdateShareOperationRequest { body?: UpdateShareRequest; } @@ -187,6 +194,36 @@ export class ShareApi extends runtime.BaseAPI { await this.unshareRaw(requestParameters, initOverrides); } + /** + */ + async updateAccessRaw(requestParameters: UpdateAccessOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/zrok.v1+json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["x-token"] = await this.configuration.apiKey("x-token"); // key authentication + } + + const response = await this.request({ + path: `/access`, + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: UpdateAccessRequestToJSON(requestParameters['body']), + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + */ + async updateAccess(requestParameters: UpdateAccessOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.updateAccessRaw(requestParameters, initOverrides); + } + /** */ async updateShareRaw(requestParameters: UpdateShareOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { diff --git a/ui/src/api/models/UpdateAccessRequest.ts b/ui/src/api/models/UpdateAccessRequest.ts new file mode 100644 index 00000000..a23195ca --- /dev/null +++ b/ui/src/api/models/UpdateAccessRequest.ts @@ -0,0 +1,68 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * zrok + * zrok client access + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface UpdateAccessRequest + */ +export interface UpdateAccessRequest { + /** + * + * @type {string} + * @memberof UpdateAccessRequest + */ + frontendToken?: string; + /** + * + * @type {string} + * @memberof UpdateAccessRequest + */ + description?: string; +} + +/** + * Check if a given object implements the UpdateAccessRequest interface. + */ +export function instanceOfUpdateAccessRequest(value: object): value is UpdateAccessRequest { + return true; +} + +export function UpdateAccessRequestFromJSON(json: any): UpdateAccessRequest { + return UpdateAccessRequestFromJSONTyped(json, false); +} + +export function UpdateAccessRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateAccessRequest { + if (json == null) { + return json; + } + return { + + 'frontendToken': json['frontendToken'] == null ? undefined : json['frontendToken'], + 'description': json['description'] == null ? undefined : json['description'], + }; +} + +export function UpdateAccessRequestToJSON(value?: UpdateAccessRequest | null): any { + if (value == null) { + return value; + } + return { + + 'frontendToken': value['frontendToken'], + 'description': value['description'], + }; +} + diff --git a/ui/src/api/models/index.ts b/ui/src/api/models/index.ts index 0d973674..139bece5 100644 --- a/ui/src/api/models/index.ts +++ b/ui/src/api/models/index.ts @@ -44,6 +44,7 @@ export * from './ShareResponse'; export * from './SparkDataSample'; export * from './UnaccessRequest'; export * from './UnshareRequest'; +export * from './UpdateAccessRequest'; export * from './UpdateFrontendRequest'; export * from './UpdateShareRequest'; export * from './Verify200Response';