mirror of
https://github.com/openziti/zrok.git
synced 2025-06-11 12:26:46 +02:00
access endpoint tweaks (#834)
This commit is contained in:
parent
0fc139e6d9
commit
0a8c5f2054
@ -119,10 +119,9 @@ func (cmd *accessPrivateCommand) accessLocal(args []string, root env_core.Root)
|
||||
|
||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
||||
req := share.NewAccessParams()
|
||||
req.Body = &rest_model_zrok.AccessRequest{
|
||||
ShrToken: shrToken,
|
||||
EnvZID: root.Environment().ZitiIdentity,
|
||||
}
|
||||
req.Body.ShrToken = shrToken
|
||||
req.Body.EnvZID = root.Environment().ZitiIdentity
|
||||
|
||||
accessResp, err := zrok.Share.Access(req, auth)
|
||||
if err != nil {
|
||||
cmd.error(err)
|
||||
|
@ -106,7 +106,7 @@ func (h *accessHandler) Handle(params share.AccessParams, principal *rest_model_
|
||||
return share.NewAccessInternalServerError()
|
||||
}
|
||||
|
||||
return share.NewAccessCreated().WithPayload(&rest_model_zrok.AccessResponse{
|
||||
return share.NewAccessCreated().WithPayload(&share.AccessCreatedBody{
|
||||
FrontendToken: feToken,
|
||||
BackendMode: shr.BackendMode,
|
||||
})
|
||||
|
@ -14,8 +14,6 @@ import (
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// NewAccessParams creates a new AccessParams object,
|
||||
@ -64,7 +62,7 @@ AccessParams contains all the parameters to send to the API endpoint
|
||||
type AccessParams struct {
|
||||
|
||||
// Body.
|
||||
Body *rest_model_zrok.AccessRequest
|
||||
Body AccessBody
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
@ -120,13 +118,13 @@ func (o *AccessParams) SetHTTPClient(client *http.Client) {
|
||||
}
|
||||
|
||||
// WithBody adds the body to the access params
|
||||
func (o *AccessParams) WithBody(body *rest_model_zrok.AccessRequest) *AccessParams {
|
||||
func (o *AccessParams) WithBody(body AccessBody) *AccessParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the access params
|
||||
func (o *AccessParams) SetBody(body *rest_model_zrok.AccessRequest) {
|
||||
func (o *AccessParams) SetBody(body AccessBody) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
@ -137,10 +135,8 @@ func (o *AccessParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
|
@ -6,13 +6,13 @@ package share
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// AccessReader is a Reader for the Access structure.
|
||||
@ -63,7 +63,7 @@ AccessCreated describes a response with status code 201, with default header val
|
||||
access created
|
||||
*/
|
||||
type AccessCreated struct {
|
||||
Payload *rest_model_zrok.AccessResponse
|
||||
Payload *AccessCreatedBody
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this access created response has a 2xx status code
|
||||
@ -104,13 +104,13 @@ func (o *AccessCreated) String() string {
|
||||
return fmt.Sprintf("[POST /access][%d] accessCreated %+v", 201, o.Payload)
|
||||
}
|
||||
|
||||
func (o *AccessCreated) GetPayload() *rest_model_zrok.AccessResponse {
|
||||
func (o *AccessCreated) GetPayload() *AccessCreatedBody {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *AccessCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(rest_model_zrok.AccessResponse)
|
||||
o.Payload = new(AccessCreatedBody)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
@ -287,3 +287,85 @@ func (o *AccessInternalServerError) readResponse(response runtime.ClientResponse
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
AccessBody access body
|
||||
swagger:model AccessBody
|
||||
*/
|
||||
type AccessBody struct {
|
||||
|
||||
// env z Id
|
||||
EnvZID string `json:"envZId,omitempty"`
|
||||
|
||||
// shr token
|
||||
ShrToken string `json:"shrToken,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this access body
|
||||
func (o *AccessBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this access body based on context it is used
|
||||
func (o *AccessBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *AccessBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *AccessBody) UnmarshalBinary(b []byte) error {
|
||||
var res AccessBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
AccessCreatedBody access created body
|
||||
swagger:model AccessCreatedBody
|
||||
*/
|
||||
type AccessCreatedBody struct {
|
||||
|
||||
// backend mode
|
||||
BackendMode string `json:"backendMode,omitempty"`
|
||||
|
||||
// frontend token
|
||||
FrontendToken string `json:"frontendToken,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this access created body
|
||||
func (o *AccessCreatedBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this access created body based on context it is used
|
||||
func (o *AccessCreatedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *AccessCreatedBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *AccessCreatedBody) UnmarshalBinary(b []byte) error {
|
||||
var res AccessCreatedBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
@ -51,7 +51,14 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/accessRequest"
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -59,7 +66,14 @@ func init() {
|
||||
"201": {
|
||||
"description": "access created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/accessResponse"
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -1810,28 +1824,6 @@ func init() {
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"accessRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"accessResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"authUser": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -2291,7 +2283,14 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/accessRequest"
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -2299,7 +2298,14 @@ func init() {
|
||||
"201": {
|
||||
"description": "access created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/accessResponse"
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -4055,28 +4061,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"accessRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"accessResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"authUser": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -6,9 +6,12 @@ package share
|
||||
// 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"
|
||||
)
|
||||
@ -69,3 +72,83 @@ func (o *Access) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
|
||||
// AccessBody access body
|
||||
//
|
||||
// swagger:model AccessBody
|
||||
type AccessBody struct {
|
||||
|
||||
// env z Id
|
||||
EnvZID string `json:"envZId,omitempty"`
|
||||
|
||||
// shr token
|
||||
ShrToken string `json:"shrToken,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this access body
|
||||
func (o *AccessBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this access body based on context it is used
|
||||
func (o *AccessBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *AccessBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *AccessBody) UnmarshalBinary(b []byte) error {
|
||||
var res AccessBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccessCreatedBody access created body
|
||||
//
|
||||
// swagger:model AccessCreatedBody
|
||||
type AccessCreatedBody struct {
|
||||
|
||||
// backend mode
|
||||
BackendMode string `json:"backendMode,omitempty"`
|
||||
|
||||
// frontend token
|
||||
FrontendToken string `json:"frontendToken,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this access created body
|
||||
func (o *AccessCreatedBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this access created body based on context it is used
|
||||
func (o *AccessCreatedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *AccessCreatedBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *AccessCreatedBody) UnmarshalBinary(b []byte) error {
|
||||
var res AccessCreatedBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ import (
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// NewAccessParams creates a new AccessParams object
|
||||
@ -36,7 +34,7 @@ type AccessParams struct {
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body *rest_model_zrok.AccessRequest
|
||||
Body AccessBody
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
@ -50,7 +48,7 @@ func (o *AccessParams) BindRequest(r *http.Request, route *middleware.MatchedRou
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body rest_model_zrok.AccessRequest
|
||||
var body AccessBody
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
} else {
|
||||
@ -65,7 +63,7 @@ func (o *AccessParams) BindRequest(r *http.Request, route *middleware.MatchedRou
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// AccessCreatedCode is the HTTP code returned for type AccessCreated
|
||||
@ -26,7 +24,7 @@ type AccessCreated struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *rest_model_zrok.AccessResponse `json:"body,omitempty"`
|
||||
Payload *AccessCreatedBody `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewAccessCreated creates AccessCreated with default headers values
|
||||
@ -36,13 +34,13 @@ func NewAccessCreated() *AccessCreated {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the access created response
|
||||
func (o *AccessCreated) WithPayload(payload *rest_model_zrok.AccessResponse) *AccessCreated {
|
||||
func (o *AccessCreated) WithPayload(payload *AccessCreatedBody) *AccessCreated {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the access created response
|
||||
func (o *AccessCreated) SetPayload(payload *rest_model_zrok.AccessResponse) {
|
||||
func (o *AccessCreated) SetPayload(payload *AccessCreatedBody) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,8 @@ func CreateAccess(root env_core.Root, request *AccessRequest) (*Access, error) {
|
||||
}
|
||||
|
||||
out := share.NewAccessParams()
|
||||
out.Body = &rest_model_zrok.AccessRequest{
|
||||
ShrToken: request.ShareToken,
|
||||
EnvZID: root.Environment().ZitiIdentity,
|
||||
}
|
||||
out.Body.ShrToken = request.ShareToken
|
||||
out.Body.EnvZID = root.Environment().ZitiIdentity
|
||||
|
||||
zrok, err := root.Client()
|
||||
if err != nil {
|
||||
|
@ -6,8 +6,8 @@ api/apis.ts
|
||||
api/environmentApi.ts
|
||||
api/metadataApi.ts
|
||||
api/shareApi.ts
|
||||
model/access201Response.ts
|
||||
model/accessRequest.ts
|
||||
model/accessResponse.ts
|
||||
model/addOrganizationMemberRequest.ts
|
||||
model/authUser.ts
|
||||
model/changePasswordRequest.ts
|
||||
|
@ -15,8 +15,8 @@ import localVarRequest from 'request';
|
||||
import http from 'http';
|
||||
|
||||
/* tslint:disable:no-unused-locals */
|
||||
import { Access201Response } from '../model/access201Response';
|
||||
import { AccessRequest } from '../model/accessRequest';
|
||||
import { AccessResponse } from '../model/accessResponse';
|
||||
import { ShareRequest } from '../model/shareRequest';
|
||||
import { ShareResponse } from '../model/shareResponse';
|
||||
import { UnaccessRequest } from '../model/unaccessRequest';
|
||||
@ -99,7 +99,7 @@ export class ShareApi {
|
||||
*
|
||||
* @param body
|
||||
*/
|
||||
public async access (body?: AccessRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: AccessResponse; }> {
|
||||
public async access (body?: AccessRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Access201Response; }> {
|
||||
const localVarPath = this.basePath + '/access';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||||
@ -145,13 +145,13 @@ export class ShareApi {
|
||||
localVarRequestOptions.form = localVarFormParams;
|
||||
}
|
||||
}
|
||||
return new Promise<{ response: http.IncomingMessage; body: AccessResponse; }>((resolve, reject) => {
|
||||
return new Promise<{ response: http.IncomingMessage; body: Access201Response; }>((resolve, reject) => {
|
||||
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
body = ObjectSerializer.deserialize(body, "AccessResponse");
|
||||
body = ObjectSerializer.deserialize(body, "Access201Response");
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject(new HttpError(response, body, response.statusCode));
|
||||
|
37
sdk/nodejs/sdk/src/zrok/api/model/access201Response.ts
Normal file
37
sdk/nodejs/sdk/src/zrok/api/model/access201Response.ts
Normal file
@ -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 Access201Response {
|
||||
'frontendToken'?: string;
|
||||
'backendMode'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "frontendToken",
|
||||
"baseName": "frontendToken",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "backendMode",
|
||||
"baseName": "backendMode",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return Access201Response.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import localVarRequest from 'request';
|
||||
|
||||
export * from './access201Response';
|
||||
export * from './accessRequest';
|
||||
export * from './accessResponse';
|
||||
export * from './addOrganizationMemberRequest';
|
||||
export * from './authUser';
|
||||
export * from './changePasswordRequest';
|
||||
@ -60,8 +60,8 @@ export interface RequestDetailedFile {
|
||||
export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile;
|
||||
|
||||
|
||||
import { Access201Response } from './access201Response';
|
||||
import { AccessRequest } from './accessRequest';
|
||||
import { AccessResponse } from './accessResponse';
|
||||
import { AddOrganizationMemberRequest } from './addOrganizationMemberRequest';
|
||||
import { AuthUser } from './authUser';
|
||||
import { ChangePasswordRequest } from './changePasswordRequest';
|
||||
@ -128,8 +128,8 @@ let enumsMap: {[index: string]: any} = {
|
||||
}
|
||||
|
||||
let typeMap: {[index: string]: any} = {
|
||||
"Access201Response": Access201Response,
|
||||
"AccessRequest": AccessRequest,
|
||||
"AccessResponse": AccessResponse,
|
||||
"AddOrganizationMemberRequest": AddOrganizationMemberRequest,
|
||||
"AuthUser": AuthUser,
|
||||
"ChangePasswordRequest": ChangePasswordRequest,
|
||||
|
@ -24,8 +24,7 @@ from zrok_api.api.share_api import ShareApi
|
||||
from zrok_api.api_client import ApiClient
|
||||
from zrok_api.configuration import Configuration
|
||||
# import models into sdk package
|
||||
from zrok_api.models.access_request import AccessRequest
|
||||
from zrok_api.models.access_response import AccessResponse
|
||||
from zrok_api.models.access_body import AccessBody
|
||||
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
|
||||
@ -54,6 +53,7 @@ from zrok_api.models.inline_response2005 import InlineResponse2005
|
||||
from zrok_api.models.inline_response2005_memberships import InlineResponse2005Memberships
|
||||
from zrok_api.models.inline_response2006 import InlineResponse2006
|
||||
from zrok_api.models.inline_response201 import InlineResponse201
|
||||
from zrok_api.models.inline_response2011 import InlineResponse2011
|
||||
from zrok_api.models.invite_body import InviteBody
|
||||
from zrok_api.models.login_body import LoginBody
|
||||
from zrok_api.models.metrics import Metrics
|
||||
|
@ -41,8 +41,8 @@ class ShareApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param AccessRequest body:
|
||||
:return: AccessResponse
|
||||
:param AccessBody body:
|
||||
:return: InlineResponse2011
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
@ -62,8 +62,8 @@ class ShareApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param AccessRequest body:
|
||||
:return: AccessResponse
|
||||
:param AccessBody body:
|
||||
:return: InlineResponse2011
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
@ -117,7 +117,7 @@ class ShareApi(object):
|
||||
body=body_params,
|
||||
post_params=form_params,
|
||||
files=local_var_files,
|
||||
response_type='AccessResponse', # noqa: E501
|
||||
response_type='InlineResponse2011', # noqa: E501
|
||||
auth_settings=auth_settings,
|
||||
async_req=params.get('async_req'),
|
||||
_return_http_data_only=params.get('_return_http_data_only'),
|
||||
|
@ -14,8 +14,7 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
# import models into model package
|
||||
from zrok_api.models.access_request import AccessRequest
|
||||
from zrok_api.models.access_response import AccessResponse
|
||||
from zrok_api.models.access_body import AccessBody
|
||||
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
|
||||
@ -44,6 +43,7 @@ from zrok_api.models.inline_response2005 import InlineResponse2005
|
||||
from zrok_api.models.inline_response2005_memberships import InlineResponse2005Memberships
|
||||
from zrok_api.models.inline_response2006 import InlineResponse2006
|
||||
from zrok_api.models.inline_response201 import InlineResponse201
|
||||
from zrok_api.models.inline_response2011 import InlineResponse2011
|
||||
from zrok_api.models.invite_body import InviteBody
|
||||
from zrok_api.models.login_body import LoginBody
|
||||
from zrok_api.models.metrics import Metrics
|
||||
|
136
sdk/python/sdk/zrok/zrok_api/models/access_body.py
Normal file
136
sdk/python/sdk/zrok/zrok_api/models/access_body.py
Normal file
@ -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 AccessBody(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 = {
|
||||
'env_zid': 'str',
|
||||
'shr_token': 'str'
|
||||
}
|
||||
|
||||
attribute_map = {
|
||||
'env_zid': 'envZId',
|
||||
'shr_token': 'shrToken'
|
||||
}
|
||||
|
||||
def __init__(self, env_zid=None, shr_token=None): # noqa: E501
|
||||
"""AccessBody - a model defined in Swagger""" # noqa: E501
|
||||
self._env_zid = None
|
||||
self._shr_token = None
|
||||
self.discriminator = None
|
||||
if env_zid is not None:
|
||||
self.env_zid = env_zid
|
||||
if shr_token is not None:
|
||||
self.shr_token = shr_token
|
||||
|
||||
@property
|
||||
def env_zid(self):
|
||||
"""Gets the env_zid of this AccessBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The env_zid of this AccessBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._env_zid
|
||||
|
||||
@env_zid.setter
|
||||
def env_zid(self, env_zid):
|
||||
"""Sets the env_zid of this AccessBody.
|
||||
|
||||
|
||||
:param env_zid: The env_zid of this AccessBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._env_zid = env_zid
|
||||
|
||||
@property
|
||||
def shr_token(self):
|
||||
"""Gets the shr_token of this AccessBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The shr_token of this AccessBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._shr_token
|
||||
|
||||
@shr_token.setter
|
||||
def shr_token(self, shr_token):
|
||||
"""Sets the shr_token of this AccessBody.
|
||||
|
||||
|
||||
:param shr_token: The shr_token of this AccessBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._shr_token = shr_token
|
||||
|
||||
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(AccessBody, 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, AccessBody):
|
||||
return False
|
||||
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
136
sdk/python/sdk/zrok/zrok_api/models/inline_response2011.py
Normal file
136
sdk/python/sdk/zrok/zrok_api/models/inline_response2011.py
Normal file
@ -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 InlineResponse2011(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',
|
||||
'backend_mode': 'str'
|
||||
}
|
||||
|
||||
attribute_map = {
|
||||
'frontend_token': 'frontendToken',
|
||||
'backend_mode': 'backendMode'
|
||||
}
|
||||
|
||||
def __init__(self, frontend_token=None, backend_mode=None): # noqa: E501
|
||||
"""InlineResponse2011 - a model defined in Swagger""" # noqa: E501
|
||||
self._frontend_token = None
|
||||
self._backend_mode = None
|
||||
self.discriminator = None
|
||||
if frontend_token is not None:
|
||||
self.frontend_token = frontend_token
|
||||
if backend_mode is not None:
|
||||
self.backend_mode = backend_mode
|
||||
|
||||
@property
|
||||
def frontend_token(self):
|
||||
"""Gets the frontend_token of this InlineResponse2011. # noqa: E501
|
||||
|
||||
|
||||
:return: The frontend_token of this InlineResponse2011. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._frontend_token
|
||||
|
||||
@frontend_token.setter
|
||||
def frontend_token(self, frontend_token):
|
||||
"""Sets the frontend_token of this InlineResponse2011.
|
||||
|
||||
|
||||
:param frontend_token: The frontend_token of this InlineResponse2011. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._frontend_token = frontend_token
|
||||
|
||||
@property
|
||||
def backend_mode(self):
|
||||
"""Gets the backend_mode of this InlineResponse2011. # noqa: E501
|
||||
|
||||
|
||||
:return: The backend_mode of this InlineResponse2011. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._backend_mode
|
||||
|
||||
@backend_mode.setter
|
||||
def backend_mode(self, backend_mode):
|
||||
"""Sets the backend_mode of this InlineResponse2011.
|
||||
|
||||
|
||||
:param backend_mode: The backend_mode of this InlineResponse2011. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._backend_mode = backend_mode
|
||||
|
||||
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(InlineResponse2011, 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, InlineResponse2011):
|
||||
return False
|
||||
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
@ -1006,12 +1006,20 @@ paths:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
$ref: "#/definitions/accessRequest"
|
||||
properties:
|
||||
envZId:
|
||||
type: string
|
||||
shrToken:
|
||||
type: string
|
||||
responses:
|
||||
201:
|
||||
description: access created
|
||||
schema:
|
||||
$ref: "#/definitions/accessResponse"
|
||||
properties:
|
||||
frontendToken:
|
||||
type: string
|
||||
backendMode:
|
||||
type: string
|
||||
401:
|
||||
description: unauthorized
|
||||
404:
|
||||
@ -1118,21 +1126,6 @@ paths:
|
||||
$ref: "#/definitions/errorMessage"
|
||||
|
||||
definitions:
|
||||
accessRequest:
|
||||
type: object
|
||||
properties:
|
||||
envZId:
|
||||
type: string
|
||||
shrToken:
|
||||
type: string
|
||||
|
||||
accessResponse:
|
||||
type: object
|
||||
properties:
|
||||
frontendToken:
|
||||
type: string
|
||||
backendMode:
|
||||
type: string
|
||||
|
||||
authUser:
|
||||
type: object
|
||||
|
@ -5,8 +5,8 @@ apis/MetadataApi.ts
|
||||
apis/ShareApi.ts
|
||||
apis/index.ts
|
||||
index.ts
|
||||
models/Access201Response.ts
|
||||
models/AccessRequest.ts
|
||||
models/AccessResponse.ts
|
||||
models/AddOrganizationMemberRequest.ts
|
||||
models/AuthUser.ts
|
||||
models/ChangePasswordRequest.ts
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
import * as runtime from '../runtime';
|
||||
import type {
|
||||
Access201Response,
|
||||
AccessRequest,
|
||||
AccessResponse,
|
||||
ShareRequest,
|
||||
ShareResponse,
|
||||
UnaccessRequest,
|
||||
@ -24,10 +24,10 @@ import type {
|
||||
UpdateShareRequest,
|
||||
} from '../models/index';
|
||||
import {
|
||||
Access201ResponseFromJSON,
|
||||
Access201ResponseToJSON,
|
||||
AccessRequestFromJSON,
|
||||
AccessRequestToJSON,
|
||||
AccessResponseFromJSON,
|
||||
AccessResponseToJSON,
|
||||
ShareRequestFromJSON,
|
||||
ShareRequestToJSON,
|
||||
ShareResponseFromJSON,
|
||||
@ -67,7 +67,7 @@ export class ShareApi extends runtime.BaseAPI {
|
||||
|
||||
/**
|
||||
*/
|
||||
async accessRaw(requestParameters: AccessOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccessResponse>> {
|
||||
async accessRaw(requestParameters: AccessOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Access201Response>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
@ -86,12 +86,12 @@ export class ShareApi extends runtime.BaseAPI {
|
||||
body: AccessRequestToJSON(requestParameters['body']),
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => AccessResponseFromJSON(jsonValue));
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => Access201ResponseFromJSON(jsonValue));
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async access(requestParameters: AccessOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccessResponse> {
|
||||
async access(requestParameters: AccessOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Access201Response> {
|
||||
const response = await this.accessRaw(requestParameters, initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
68
ui/src/api/models/Access201Response.ts
Normal file
68
ui/src/api/models/Access201Response.ts
Normal file
@ -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 Access201Response
|
||||
*/
|
||||
export interface Access201Response {
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Access201Response
|
||||
*/
|
||||
frontendToken?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Access201Response
|
||||
*/
|
||||
backendMode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the Access201Response interface.
|
||||
*/
|
||||
export function instanceOfAccess201Response(value: object): value is Access201Response {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function Access201ResponseFromJSON(json: any): Access201Response {
|
||||
return Access201ResponseFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function Access201ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): Access201Response {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'frontendToken': json['frontendToken'] == null ? undefined : json['frontendToken'],
|
||||
'backendMode': json['backendMode'] == null ? undefined : json['backendMode'],
|
||||
};
|
||||
}
|
||||
|
||||
export function Access201ResponseToJSON(value?: Access201Response | null): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'frontendToken': value['frontendToken'],
|
||||
'backendMode': value['backendMode'],
|
||||
};
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export * from './Access201Response';
|
||||
export * from './AccessRequest';
|
||||
export * from './AccessResponse';
|
||||
export * from './AddOrganizationMemberRequest';
|
||||
export * from './AuthUser';
|
||||
export * from './ChangePasswordRequest';
|
||||
|
Loading…
x
Reference in New Issue
Block a user