mirror of
https://github.com/openziti/zrok.git
synced 2024-11-21 15:43:22 +01:00
new '/grants' endpoint for synchronizing grants for an account (#744)
This commit is contained in:
parent
34754704ea
commit
a26cf19ade
@ -38,6 +38,8 @@ type ClientService interface {
|
||||
|
||||
DeleteFrontend(params *DeleteFrontendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteFrontendOK, error)
|
||||
|
||||
Grants(params *GrantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GrantsOK, error)
|
||||
|
||||
InviteTokenGenerate(params *InviteTokenGenerateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InviteTokenGenerateCreated, error)
|
||||
|
||||
ListFrontends(params *ListFrontendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListFrontendsOK, error)
|
||||
@ -203,6 +205,45 @@ func (a *Client) DeleteFrontend(params *DeleteFrontendParams, authInfo runtime.C
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
Grants grants API
|
||||
*/
|
||||
func (a *Client) Grants(params *GrantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GrantsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGrantsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "grants",
|
||||
Method: "POST",
|
||||
PathPattern: "/grants",
|
||||
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GrantsReader{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.(*GrantsOK)
|
||||
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 grants: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
InviteTokenGenerate invite token generate API
|
||||
*/
|
||||
|
146
rest_client_zrok/admin/grants_parameters.go
Normal file
146
rest_client_zrok/admin/grants_parameters.go
Normal file
@ -0,0 +1,146 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewGrantsParams creates a new GrantsParams 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 NewGrantsParams() *GrantsParams {
|
||||
return &GrantsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGrantsParamsWithTimeout creates a new GrantsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGrantsParamsWithTimeout(timeout time.Duration) *GrantsParams {
|
||||
return &GrantsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGrantsParamsWithContext creates a new GrantsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGrantsParamsWithContext(ctx context.Context) *GrantsParams {
|
||||
return &GrantsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGrantsParamsWithHTTPClient creates a new GrantsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGrantsParamsWithHTTPClient(client *http.Client) *GrantsParams {
|
||||
return &GrantsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GrantsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the grants operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GrantsParams struct {
|
||||
|
||||
// Body.
|
||||
Body GrantsBody
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the grants params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GrantsParams) WithDefaults() *GrantsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the grants params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GrantsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the grants params
|
||||
func (o *GrantsParams) WithTimeout(timeout time.Duration) *GrantsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the grants params
|
||||
func (o *GrantsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the grants params
|
||||
func (o *GrantsParams) WithContext(ctx context.Context) *GrantsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the grants params
|
||||
func (o *GrantsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the grants params
|
||||
func (o *GrantsParams) WithHTTPClient(client *http.Client) *GrantsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the grants params
|
||||
func (o *GrantsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the grants params
|
||||
func (o *GrantsParams) WithBody(body GrantsBody) *GrantsParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the grants params
|
||||
func (o *GrantsParams) SetBody(body GrantsBody) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GrantsParams) 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
|
||||
}
|
252
rest_client_zrok/admin/grants_responses.go
Normal file
252
rest_client_zrok/admin/grants_responses.go
Normal file
@ -0,0 +1,252 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// GrantsReader is a Reader for the Grants structure.
|
||||
type GrantsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GrantsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGrantsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 401:
|
||||
result := NewGrantsUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 500:
|
||||
result := NewGrantsInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /grants] grants", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGrantsOK creates a GrantsOK with default headers values
|
||||
func NewGrantsOK() *GrantsOK {
|
||||
return &GrantsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GrantsOK describes a response with status code 200, with default header values.
|
||||
|
||||
ok
|
||||
*/
|
||||
type GrantsOK struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this grants o k response has a 2xx status code
|
||||
func (o *GrantsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this grants o k response has a 3xx status code
|
||||
func (o *GrantsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this grants o k response has a 4xx status code
|
||||
func (o *GrantsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this grants o k response has a 5xx status code
|
||||
func (o *GrantsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this grants o k response a status code equal to that given
|
||||
func (o *GrantsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the grants o k response
|
||||
func (o *GrantsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GrantsOK) Error() string {
|
||||
return fmt.Sprintf("[POST /grants][%d] grantsOK ", 200)
|
||||
}
|
||||
|
||||
func (o *GrantsOK) String() string {
|
||||
return fmt.Sprintf("[POST /grants][%d] grantsOK ", 200)
|
||||
}
|
||||
|
||||
func (o *GrantsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGrantsUnauthorized creates a GrantsUnauthorized with default headers values
|
||||
func NewGrantsUnauthorized() *GrantsUnauthorized {
|
||||
return &GrantsUnauthorized{}
|
||||
}
|
||||
|
||||
/*
|
||||
GrantsUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
unauthorized
|
||||
*/
|
||||
type GrantsUnauthorized struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this grants unauthorized response has a 2xx status code
|
||||
func (o *GrantsUnauthorized) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this grants unauthorized response has a 3xx status code
|
||||
func (o *GrantsUnauthorized) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this grants unauthorized response has a 4xx status code
|
||||
func (o *GrantsUnauthorized) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this grants unauthorized response has a 5xx status code
|
||||
func (o *GrantsUnauthorized) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this grants unauthorized response a status code equal to that given
|
||||
func (o *GrantsUnauthorized) IsCode(code int) bool {
|
||||
return code == 401
|
||||
}
|
||||
|
||||
// Code gets the status code for the grants unauthorized response
|
||||
func (o *GrantsUnauthorized) Code() int {
|
||||
return 401
|
||||
}
|
||||
|
||||
func (o *GrantsUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[POST /grants][%d] grantsUnauthorized ", 401)
|
||||
}
|
||||
|
||||
func (o *GrantsUnauthorized) String() string {
|
||||
return fmt.Sprintf("[POST /grants][%d] grantsUnauthorized ", 401)
|
||||
}
|
||||
|
||||
func (o *GrantsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGrantsInternalServerError creates a GrantsInternalServerError with default headers values
|
||||
func NewGrantsInternalServerError() *GrantsInternalServerError {
|
||||
return &GrantsInternalServerError{}
|
||||
}
|
||||
|
||||
/*
|
||||
GrantsInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
internal server error
|
||||
*/
|
||||
type GrantsInternalServerError struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this grants internal server error response has a 2xx status code
|
||||
func (o *GrantsInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this grants internal server error response has a 3xx status code
|
||||
func (o *GrantsInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this grants internal server error response has a 4xx status code
|
||||
func (o *GrantsInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this grants internal server error response has a 5xx status code
|
||||
func (o *GrantsInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this grants internal server error response a status code equal to that given
|
||||
func (o *GrantsInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
// Code gets the status code for the grants internal server error response
|
||||
func (o *GrantsInternalServerError) Code() int {
|
||||
return 500
|
||||
}
|
||||
|
||||
func (o *GrantsInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[POST /grants][%d] grantsInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *GrantsInternalServerError) String() string {
|
||||
return fmt.Sprintf("[POST /grants][%d] grantsInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *GrantsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
GrantsBody grants body
|
||||
swagger:model GrantsBody
|
||||
*/
|
||||
type GrantsBody struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this grants body
|
||||
func (o *GrantsBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this grants body based on context it is used
|
||||
func (o *GrantsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *GrantsBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *GrantsBody) UnmarshalBinary(b []byte) error {
|
||||
var res GrantsBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@ -526,6 +526,43 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/grants": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "grants",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "ok"
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/identity": {
|
||||
"post": {
|
||||
"security": [
|
||||
@ -2336,6 +2373,43 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/grants": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "grants",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "ok"
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/identity": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
111
rest_server_zrok/operations/admin/grants.go
Normal file
111
rest_server_zrok/operations/admin/grants.go
Normal file
@ -0,0 +1,111 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// GrantsHandlerFunc turns a function with the right signature into a grants handler
|
||||
type GrantsHandlerFunc func(GrantsParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GrantsHandlerFunc) Handle(params GrantsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// GrantsHandler interface for that can handle valid grants params
|
||||
type GrantsHandler interface {
|
||||
Handle(GrantsParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGrants creates a new http.Handler for the grants operation
|
||||
func NewGrants(ctx *middleware.Context, handler GrantsHandler) *Grants {
|
||||
return &Grants{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
Grants swagger:route POST /grants admin grants
|
||||
|
||||
Grants grants API
|
||||
*/
|
||||
type Grants struct {
|
||||
Context *middleware.Context
|
||||
Handler GrantsHandler
|
||||
}
|
||||
|
||||
func (o *Grants) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewGrantsParams()
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
// GrantsBody grants body
|
||||
//
|
||||
// swagger:model GrantsBody
|
||||
type GrantsBody struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this grants body
|
||||
func (o *GrantsBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this grants body based on context it is used
|
||||
func (o *GrantsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *GrantsBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *GrantsBody) UnmarshalBinary(b []byte) error {
|
||||
var res GrantsBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
74
rest_server_zrok/operations/admin/grants_parameters.go
Normal file
74
rest_server_zrok/operations/admin/grants_parameters.go
Normal file
@ -0,0 +1,74 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewGrantsParams creates a new GrantsParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewGrantsParams() GrantsParams {
|
||||
|
||||
return GrantsParams{}
|
||||
}
|
||||
|
||||
// GrantsParams contains all the bound params for the grants operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters grants
|
||||
type GrantsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body GrantsBody
|
||||
}
|
||||
|
||||
// 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 NewGrantsParams() beforehand.
|
||||
func (o *GrantsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body GrantsBody
|
||||
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
|
||||
}
|
87
rest_server_zrok/operations/admin/grants_responses.go
Normal file
87
rest_server_zrok/operations/admin/grants_responses.go
Normal file
@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// GrantsOKCode is the HTTP code returned for type GrantsOK
|
||||
const GrantsOKCode int = 200
|
||||
|
||||
/*
|
||||
GrantsOK ok
|
||||
|
||||
swagger:response grantsOK
|
||||
*/
|
||||
type GrantsOK struct {
|
||||
}
|
||||
|
||||
// NewGrantsOK creates GrantsOK with default headers values
|
||||
func NewGrantsOK() *GrantsOK {
|
||||
|
||||
return &GrantsOK{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GrantsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(200)
|
||||
}
|
||||
|
||||
// GrantsUnauthorizedCode is the HTTP code returned for type GrantsUnauthorized
|
||||
const GrantsUnauthorizedCode int = 401
|
||||
|
||||
/*
|
||||
GrantsUnauthorized unauthorized
|
||||
|
||||
swagger:response grantsUnauthorized
|
||||
*/
|
||||
type GrantsUnauthorized struct {
|
||||
}
|
||||
|
||||
// NewGrantsUnauthorized creates GrantsUnauthorized with default headers values
|
||||
func NewGrantsUnauthorized() *GrantsUnauthorized {
|
||||
|
||||
return &GrantsUnauthorized{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GrantsUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(401)
|
||||
}
|
||||
|
||||
// GrantsInternalServerErrorCode is the HTTP code returned for type GrantsInternalServerError
|
||||
const GrantsInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
GrantsInternalServerError internal server error
|
||||
|
||||
swagger:response grantsInternalServerError
|
||||
*/
|
||||
type GrantsInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewGrantsInternalServerError creates GrantsInternalServerError with default headers values
|
||||
func NewGrantsInternalServerError() *GrantsInternalServerError {
|
||||
|
||||
return &GrantsInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GrantsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
87
rest_server_zrok/operations/admin/grants_urlbuilder.go
Normal file
87
rest_server_zrok/operations/admin/grants_urlbuilder.go
Normal file
@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// GrantsURL generates an URL for the grants operation
|
||||
type GrantsURL 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 *GrantsURL) WithBasePath(bp string) *GrantsURL {
|
||||
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 *GrantsURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *GrantsURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/grants"
|
||||
|
||||
_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 *GrantsURL) 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 *GrantsURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *GrantsURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on GrantsURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on GrantsURL")
|
||||
}
|
||||
|
||||
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 *GrantsURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
@ -97,6 +97,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
MetadataGetShareMetricsHandler: metadata.GetShareMetricsHandlerFunc(func(params metadata.GetShareMetricsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation metadata.GetShareMetrics has not yet been implemented")
|
||||
}),
|
||||
AdminGrantsHandler: admin.GrantsHandlerFunc(func(params admin.GrantsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.Grants has not yet been implemented")
|
||||
}),
|
||||
AccountInviteHandler: account.InviteHandlerFunc(func(params account.InviteParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.Invite has not yet been implemented")
|
||||
}),
|
||||
@ -227,6 +230,8 @@ type ZrokAPI struct {
|
||||
MetadataGetShareDetailHandler metadata.GetShareDetailHandler
|
||||
// MetadataGetShareMetricsHandler sets the operation handler for the get share metrics operation
|
||||
MetadataGetShareMetricsHandler metadata.GetShareMetricsHandler
|
||||
// AdminGrantsHandler sets the operation handler for the grants operation
|
||||
AdminGrantsHandler admin.GrantsHandler
|
||||
// AccountInviteHandler sets the operation handler for the invite operation
|
||||
AccountInviteHandler account.InviteHandler
|
||||
// AdminInviteTokenGenerateHandler sets the operation handler for the invite token generate operation
|
||||
@ -388,6 +393,9 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.MetadataGetShareMetricsHandler == nil {
|
||||
unregistered = append(unregistered, "metadata.GetShareMetricsHandler")
|
||||
}
|
||||
if o.AdminGrantsHandler == nil {
|
||||
unregistered = append(unregistered, "admin.GrantsHandler")
|
||||
}
|
||||
if o.AccountInviteHandler == nil {
|
||||
unregistered = append(unregistered, "account.InviteHandler")
|
||||
}
|
||||
@ -602,6 +610,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/grants"] = admin.NewGrants(o.context, o.AdminGrantsHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/invite"] = account.NewInvite(o.context, o.AccountInviteHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
|
@ -23,6 +23,7 @@ model/enableResponse.ts
|
||||
model/environment.ts
|
||||
model/environmentAndResources.ts
|
||||
model/frontend.ts
|
||||
model/grantsRequest.ts
|
||||
model/inviteRequest.ts
|
||||
model/inviteTokenGenerateRequest.ts
|
||||
model/loginRequest.ts
|
||||
|
@ -21,6 +21,7 @@ import { CreateFrontendResponse } from '../model/createFrontendResponse';
|
||||
import { CreateIdentity201Response } from '../model/createIdentity201Response';
|
||||
import { CreateIdentityRequest } from '../model/createIdentityRequest';
|
||||
import { DeleteFrontendRequest } from '../model/deleteFrontendRequest';
|
||||
import { GrantsRequest } from '../model/grantsRequest';
|
||||
import { InviteTokenGenerateRequest } from '../model/inviteTokenGenerateRequest';
|
||||
import { PublicFrontend } from '../model/publicFrontend';
|
||||
import { RegenerateToken200Response } from '../model/regenerateToken200Response';
|
||||
@ -354,6 +355,64 @@ export class AdminApi {
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param body
|
||||
*/
|
||||
public async grants (body?: GrantsRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/grants';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||||
let localVarFormParams: any = {};
|
||||
|
||||
(<any>Object).assign(localVarHeaderParams, options.headers);
|
||||
|
||||
let localVarUseFormData = false;
|
||||
|
||||
let localVarRequestOptions: localVarRequest.Options = {
|
||||
method: 'POST',
|
||||
qs: localVarQueryParameters,
|
||||
headers: localVarHeaderParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
body: ObjectSerializer.serialize(body, "GrantsRequest")
|
||||
};
|
||||
|
||||
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) {
|
||||
(<any>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
|
||||
|
31
sdk/nodejs/sdk/src/zrok/api/model/grantsRequest.ts
Normal file
31
sdk/nodejs/sdk/src/zrok/api/model/grantsRequest.ts
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* zrok
|
||||
* zrok client access
|
||||
*
|
||||
* The version of the OpenAPI document: 0.3.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 GrantsRequest {
|
||||
'email'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "email",
|
||||
"baseName": "email",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return GrantsRequest.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ export * from './enableResponse';
|
||||
export * from './environment';
|
||||
export * from './environmentAndResources';
|
||||
export * from './frontend';
|
||||
export * from './grantsRequest';
|
||||
export * from './inviteRequest';
|
||||
export * from './inviteTokenGenerateRequest';
|
||||
export * from './loginRequest';
|
||||
@ -72,6 +73,7 @@ import { EnableResponse } from './enableResponse';
|
||||
import { Environment } from './environment';
|
||||
import { EnvironmentAndResources } from './environmentAndResources';
|
||||
import { Frontend } from './frontend';
|
||||
import { GrantsRequest } from './grantsRequest';
|
||||
import { InviteRequest } from './inviteRequest';
|
||||
import { InviteTokenGenerateRequest } from './inviteTokenGenerateRequest';
|
||||
import { LoginRequest } from './loginRequest';
|
||||
@ -135,6 +137,7 @@ let typeMap: {[index: string]: any} = {
|
||||
"Environment": Environment,
|
||||
"EnvironmentAndResources": EnvironmentAndResources,
|
||||
"Frontend": Frontend,
|
||||
"GrantsRequest": GrantsRequest,
|
||||
"InviteRequest": InviteRequest,
|
||||
"InviteTokenGenerateRequest": InviteTokenGenerateRequest,
|
||||
"LoginRequest": LoginRequest,
|
||||
|
@ -42,6 +42,7 @@ from zrok_api.models.environments import Environments
|
||||
from zrok_api.models.error_message import ErrorMessage
|
||||
from zrok_api.models.frontend import Frontend
|
||||
from zrok_api.models.frontends import Frontends
|
||||
from zrok_api.models.grants_body import GrantsBody
|
||||
from zrok_api.models.identity_body import IdentityBody
|
||||
from zrok_api.models.inline_response200 import InlineResponse200
|
||||
from zrok_api.models.inline_response201 import InlineResponse201
|
||||
|
@ -400,6 +400,95 @@ class AdminApi(object):
|
||||
_request_timeout=params.get('_request_timeout'),
|
||||
collection_formats=collection_formats)
|
||||
|
||||
def grants(self, **kwargs): # noqa: E501
|
||||
"""grants # noqa: E501
|
||||
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async_req=True
|
||||
>>> thread = api.grants(async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param GrantsBody 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.grants_with_http_info(**kwargs) # noqa: E501
|
||||
else:
|
||||
(data) = self.grants_with_http_info(**kwargs) # noqa: E501
|
||||
return data
|
||||
|
||||
def grants_with_http_info(self, **kwargs): # noqa: E501
|
||||
"""grants # noqa: E501
|
||||
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async_req=True
|
||||
>>> thread = api.grants_with_http_info(async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param GrantsBody 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 grants" % 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(
|
||||
'/grants', 'POST',
|
||||
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 invite_token_generate(self, **kwargs): # noqa: E501
|
||||
"""invite_token_generate # noqa: E501
|
||||
|
||||
|
@ -32,6 +32,7 @@ from zrok_api.models.environments import Environments
|
||||
from zrok_api.models.error_message import ErrorMessage
|
||||
from zrok_api.models.frontend import Frontend
|
||||
from zrok_api.models.frontends import Frontends
|
||||
from zrok_api.models.grants_body import GrantsBody
|
||||
from zrok_api.models.identity_body import IdentityBody
|
||||
from zrok_api.models.inline_response200 import InlineResponse200
|
||||
from zrok_api.models.inline_response201 import InlineResponse201
|
||||
|
110
sdk/python/sdk/zrok/zrok_api/models/grants_body.py
Normal file
110
sdk/python/sdk/zrok/zrok_api/models/grants_body.py
Normal file
@ -0,0 +1,110 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
zrok
|
||||
|
||||
zrok client access # noqa: E501
|
||||
|
||||
OpenAPI spec version: 0.3.0
|
||||
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
"""
|
||||
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
|
||||
import six
|
||||
|
||||
class GrantsBody(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 = {
|
||||
'email': 'str'
|
||||
}
|
||||
|
||||
attribute_map = {
|
||||
'email': 'email'
|
||||
}
|
||||
|
||||
def __init__(self, email=None): # noqa: E501
|
||||
"""GrantsBody - a model defined in Swagger""" # noqa: E501
|
||||
self._email = None
|
||||
self.discriminator = None
|
||||
if email is not None:
|
||||
self.email = email
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
"""Gets the email of this GrantsBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The email of this GrantsBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._email
|
||||
|
||||
@email.setter
|
||||
def email(self, email):
|
||||
"""Sets the email of this GrantsBody.
|
||||
|
||||
|
||||
:param email: The email of this GrantsBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._email = email
|
||||
|
||||
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(GrantsBody, 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, GrantsBody):
|
||||
return False
|
||||
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
@ -307,6 +307,29 @@ paths:
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
/grants:
|
||||
post:
|
||||
tags:
|
||||
- admin
|
||||
security:
|
||||
- key: []
|
||||
operationId: grants
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: ok
|
||||
401:
|
||||
description: unauthorized
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
|
||||
/identity:
|
||||
post:
|
||||
tags:
|
||||
|
@ -68,6 +68,21 @@ export function listFrontends() {
|
||||
return gateway.request(listFrontendsOperation)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {object} [options.body]
|
||||
* @return {Promise<object>} ok
|
||||
*/
|
||||
export function grants(options) {
|
||||
if (!options) options = {}
|
||||
const parameters = {
|
||||
body: {
|
||||
body: options.body
|
||||
}
|
||||
}
|
||||
return gateway.request(grantsOperation, parameters)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {object} [options.body]
|
||||
@ -152,6 +167,17 @@ const listFrontendsOperation = {
|
||||
]
|
||||
}
|
||||
|
||||
const grantsOperation = {
|
||||
path: '/grants',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
method: 'post',
|
||||
security: [
|
||||
{
|
||||
id: 'key'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const createIdentityOperation = {
|
||||
path: '/identity',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
|
Loading…
Reference in New Issue
Block a user