mirror of
https://github.com/openziti/zrok.git
synced 2025-06-28 21:51:26 +02:00
unshare and unaccess lint removal (#834)
This commit is contained in:
parent
fc4a32b301
commit
835171056c
@ -20,7 +20,6 @@ import (
|
||||
"github.com/openziti/zrok/environment/env_core"
|
||||
"github.com/openziti/zrok/rest_client_zrok"
|
||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
"github.com/openziti/zrok/tui"
|
||||
"github.com/openziti/zrok/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -321,11 +320,9 @@ func (cmd *accessPrivateCommand) error(err error) {
|
||||
func (cmd *accessPrivateCommand) shutdown(frontendName, envZId, shrToken string, zrok *rest_client_zrok.Zrok, auth runtime.ClientAuthInfoWriter) {
|
||||
logrus.Infof("shutting down '%v'", shrToken)
|
||||
req := share.NewUnaccessParams()
|
||||
req.Body = &rest_model_zrok.UnaccessRequest{
|
||||
FrontendToken: frontendName,
|
||||
ShrToken: shrToken,
|
||||
EnvZID: envZId,
|
||||
}
|
||||
req.Body.FrontendToken = frontendName
|
||||
req.Body.ShrToken = shrToken
|
||||
req.Body.EnvZID = envZId
|
||||
if _, err := zrok.Share.Unaccess(req, auth); err == nil {
|
||||
logrus.Debugf("shutdown complete")
|
||||
} else {
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/openziti/zrok/environment"
|
||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
"github.com/openziti/zrok/tui"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
@ -53,11 +52,9 @@ func (cmd *releaseCommand) run(_ *cobra.Command, args []string) {
|
||||
|
||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", env.Environment().Token)
|
||||
req := share.NewUnshareParams()
|
||||
req.Body = &rest_model_zrok.UnshareRequest{
|
||||
EnvZID: env.Environment().ZitiIdentity,
|
||||
ShrToken: shrToken,
|
||||
Reserved: true,
|
||||
}
|
||||
req.Body.EnvZID = env.Environment().ZitiIdentity
|
||||
req.Body.ShrToken = shrToken
|
||||
req.Body.Reserved = true
|
||||
if _, err := zrok.Share.Unshare(req, auth); err != nil {
|
||||
if !panicInstead {
|
||||
tui.Error("error releasing share", err)
|
||||
|
@ -281,12 +281,10 @@ func (l *looper) shutdown() {
|
||||
}
|
||||
}
|
||||
|
||||
untunnelReq := share.NewUnshareParams()
|
||||
untunnelReq.Body = &rest_model_zrok.UnshareRequest{
|
||||
EnvZID: l.env.ZitiIdentity,
|
||||
ShrToken: l.shrToken,
|
||||
}
|
||||
if _, err := l.zrok.Share.Unshare(untunnelReq, l.auth); err != nil {
|
||||
req := share.NewUnshareParams()
|
||||
req.Body.EnvZID = l.env.ZitiIdentity
|
||||
req.Body.ShrToken = l.shrToken
|
||||
if _, err := l.zrok.Share.Unshare(req, l.auth); err != nil {
|
||||
logrus.Errorf("error shutting down looper #%d: %v", l.id, err)
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
// NewUnaccessParams creates a new UnaccessParams object,
|
||||
@ -64,7 +62,7 @@ UnaccessParams contains all the parameters to send to the API endpoint
|
||||
type UnaccessParams struct {
|
||||
|
||||
// Body.
|
||||
Body *rest_model_zrok.UnaccessRequest
|
||||
Body UnaccessBody
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
@ -120,13 +118,13 @@ func (o *UnaccessParams) SetHTTPClient(client *http.Client) {
|
||||
}
|
||||
|
||||
// WithBody adds the body to the unaccess params
|
||||
func (o *UnaccessParams) WithBody(body *rest_model_zrok.UnaccessRequest) *UnaccessParams {
|
||||
func (o *UnaccessParams) WithBody(body UnaccessBody) *UnaccessParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the unaccess params
|
||||
func (o *UnaccessParams) SetBody(body *rest_model_zrok.UnaccessRequest) {
|
||||
func (o *UnaccessParams) SetBody(body UnaccessBody) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
@ -137,11 +135,9 @@ func (o *UnaccessParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
|
@ -6,10 +6,12 @@ package share
|
||||
// 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"
|
||||
)
|
||||
|
||||
// UnaccessReader is a Reader for the Unaccess structure.
|
||||
@ -272,3 +274,47 @@ func (o *UnaccessInternalServerError) readResponse(response runtime.ClientRespon
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
UnaccessBody unaccess body
|
||||
swagger:model UnaccessBody
|
||||
*/
|
||||
type UnaccessBody struct {
|
||||
|
||||
// env z Id
|
||||
EnvZID string `json:"envZId,omitempty"`
|
||||
|
||||
// frontend token
|
||||
FrontendToken string `json:"frontendToken,omitempty"`
|
||||
|
||||
// shr token
|
||||
ShrToken string `json:"shrToken,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this unaccess body
|
||||
func (o *UnaccessBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this unaccess body based on context it is used
|
||||
func (o *UnaccessBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *UnaccessBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *UnaccessBody) UnmarshalBinary(b []byte) error {
|
||||
var res UnaccessBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
// NewUnshareParams creates a new UnshareParams object,
|
||||
@ -64,7 +62,7 @@ UnshareParams contains all the parameters to send to the API endpoint
|
||||
type UnshareParams struct {
|
||||
|
||||
// Body.
|
||||
Body *rest_model_zrok.UnshareRequest
|
||||
Body UnshareBody
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
@ -120,13 +118,13 @@ func (o *UnshareParams) SetHTTPClient(client *http.Client) {
|
||||
}
|
||||
|
||||
// WithBody adds the body to the unshare params
|
||||
func (o *UnshareParams) WithBody(body *rest_model_zrok.UnshareRequest) *UnshareParams {
|
||||
func (o *UnshareParams) WithBody(body UnshareBody) *UnshareParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the unshare params
|
||||
func (o *UnshareParams) SetBody(body *rest_model_zrok.UnshareRequest) {
|
||||
func (o *UnshareParams) SetBody(body UnshareBody) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
@ -137,11 +135,9 @@ func (o *UnshareParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
|
@ -6,11 +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/go-openapi/swag"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
@ -285,3 +287,47 @@ func (o *UnshareInternalServerError) readResponse(response runtime.ClientRespons
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
UnshareBody unshare body
|
||||
swagger:model UnshareBody
|
||||
*/
|
||||
type UnshareBody struct {
|
||||
|
||||
// env z Id
|
||||
EnvZID string `json:"envZId,omitempty"`
|
||||
|
||||
// reserved
|
||||
Reserved bool `json:"reserved,omitempty"`
|
||||
|
||||
// shr token
|
||||
ShrToken string `json:"shrToken,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this unshare body
|
||||
func (o *UnshareBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this unshare body based on context it is used
|
||||
func (o *UnshareBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *UnshareBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *UnshareBody) UnmarshalBinary(b []byte) error {
|
||||
var res UnshareBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
@ -1727,7 +1727,17 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unaccessRequest"
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendToken": {
|
||||
"type": "string"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -1763,7 +1773,17 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unshareRequest"
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -2205,34 +2225,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"unaccessRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendToken": {
|
||||
"type": "string"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"unshareRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
@ -3904,7 +3896,17 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unaccessRequest"
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendToken": {
|
||||
"type": "string"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -3940,7 +3942,17 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unshareRequest"
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -4438,34 +4450,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"unaccessRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendToken": {
|
||||
"type": "string"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"unshareRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"envZId": {
|
||||
"type": "string"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shrToken": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -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,46 @@ func (o *Unaccess) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
|
||||
// UnaccessBody unaccess body
|
||||
//
|
||||
// swagger:model UnaccessBody
|
||||
type UnaccessBody struct {
|
||||
|
||||
// env z Id
|
||||
EnvZID string `json:"envZId,omitempty"`
|
||||
|
||||
// frontend token
|
||||
FrontendToken string `json:"frontendToken,omitempty"`
|
||||
|
||||
// shr token
|
||||
ShrToken string `json:"shrToken,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this unaccess body
|
||||
func (o *UnaccessBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this unaccess body based on context it is used
|
||||
func (o *UnaccessBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *UnaccessBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *UnaccessBody) UnmarshalBinary(b []byte) error {
|
||||
var res UnaccessBody
|
||||
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"
|
||||
)
|
||||
|
||||
// NewUnaccessParams creates a new UnaccessParams object
|
||||
@ -36,7 +34,7 @@ type UnaccessParams struct {
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body *rest_model_zrok.UnaccessRequest
|
||||
Body UnaccessBody
|
||||
}
|
||||
|
||||
// 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 *UnaccessParams) BindRequest(r *http.Request, route *middleware.MatchedR
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body rest_model_zrok.UnaccessRequest
|
||||
var body UnaccessBody
|
||||
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 *UnaccessParams) BindRequest(r *http.Request, route *middleware.MatchedR
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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,46 @@ func (o *Unshare) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
|
||||
// UnshareBody unshare body
|
||||
//
|
||||
// swagger:model UnshareBody
|
||||
type UnshareBody struct {
|
||||
|
||||
// env z Id
|
||||
EnvZID string `json:"envZId,omitempty"`
|
||||
|
||||
// reserved
|
||||
Reserved bool `json:"reserved,omitempty"`
|
||||
|
||||
// shr token
|
||||
ShrToken string `json:"shrToken,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this unshare body
|
||||
func (o *UnshareBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this unshare body based on context it is used
|
||||
func (o *UnshareBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *UnshareBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *UnshareBody) UnmarshalBinary(b []byte) error {
|
||||
var res UnshareBody
|
||||
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"
|
||||
)
|
||||
|
||||
// NewUnshareParams creates a new UnshareParams object
|
||||
@ -36,7 +34,7 @@ type UnshareParams struct {
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body *rest_model_zrok.UnshareRequest
|
||||
Body UnshareBody
|
||||
}
|
||||
|
||||
// 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 *UnshareParams) BindRequest(r *http.Request, route *middleware.MatchedRo
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body rest_model_zrok.UnshareRequest
|
||||
var body UnshareBody
|
||||
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 *UnshareParams) BindRequest(r *http.Request, route *middleware.MatchedRo
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/openziti/zrok/environment/env_core"
|
||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -33,11 +32,9 @@ func CreateAccess(root env_core.Root, request *AccessRequest) (*Access, error) {
|
||||
|
||||
func DeleteAccess(root env_core.Root, acc *Access) error {
|
||||
out := share.NewUnaccessParams()
|
||||
out.Body = &rest_model_zrok.UnaccessRequest{
|
||||
FrontendToken: acc.Token,
|
||||
ShrToken: acc.ShareToken,
|
||||
EnvZID: root.Environment().ZitiIdentity,
|
||||
}
|
||||
out.Body.FrontendToken = acc.Token
|
||||
out.Body.ShrToken = acc.ShareToken
|
||||
out.Body.EnvZID = root.Environment().ZitiIdentity
|
||||
|
||||
zrok, err := root.Client()
|
||||
if err != nil {
|
||||
|
@ -97,10 +97,8 @@ func newPublicShare(root env_core.Root, request *ShareRequest) *share.ShareParam
|
||||
|
||||
func DeleteShare(root env_core.Root, shr *Share) error {
|
||||
req := share.NewUnshareParams()
|
||||
req.Body = &rest_model_zrok.UnshareRequest{
|
||||
EnvZID: root.Environment().ZitiIdentity,
|
||||
ShrToken: shr.Token,
|
||||
}
|
||||
req.Body.EnvZID = root.Environment().ZitiIdentity
|
||||
req.Body.ShrToken = shr.Token
|
||||
|
||||
zrok, err := root.Client()
|
||||
if err != nil {
|
||||
|
@ -79,7 +79,7 @@ from zrok_api.models.spark_data import SparkData
|
||||
from zrok_api.models.spark_data_sample import SparkDataSample
|
||||
from zrok_api.models.sparklines_body import SparklinesBody
|
||||
from zrok_api.models.token_generate_body import TokenGenerateBody
|
||||
from zrok_api.models.unaccess_request import UnaccessRequest
|
||||
from zrok_api.models.unshare_request import UnshareRequest
|
||||
from zrok_api.models.unaccess_body import UnaccessBody
|
||||
from zrok_api.models.unshare_body import UnshareBody
|
||||
from zrok_api.models.verify_body import VerifyBody
|
||||
from zrok_api.models.version import Version
|
||||
|
@ -227,7 +227,7 @@ class ShareApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param UnaccessRequest body:
|
||||
:param UnaccessBody body:
|
||||
:return: None
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
@ -248,7 +248,7 @@ class ShareApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param UnaccessRequest body:
|
||||
:param UnaccessBody body:
|
||||
:return: None
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
@ -316,7 +316,7 @@ class ShareApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param UnshareRequest body:
|
||||
:param UnshareBody body:
|
||||
:return: None
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
@ -337,7 +337,7 @@ class ShareApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param UnshareRequest body:
|
||||
:param UnshareBody body:
|
||||
:return: None
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
|
@ -69,7 +69,7 @@ from zrok_api.models.spark_data import SparkData
|
||||
from zrok_api.models.spark_data_sample import SparkDataSample
|
||||
from zrok_api.models.sparklines_body import SparklinesBody
|
||||
from zrok_api.models.token_generate_body import TokenGenerateBody
|
||||
from zrok_api.models.unaccess_request import UnaccessRequest
|
||||
from zrok_api.models.unshare_request import UnshareRequest
|
||||
from zrok_api.models.unaccess_body import UnaccessBody
|
||||
from zrok_api.models.unshare_body import UnshareBody
|
||||
from zrok_api.models.verify_body import VerifyBody
|
||||
from zrok_api.models.version import Version
|
||||
|
162
sdk/python/sdk/zrok/zrok_api/models/unaccess_body.py
Normal file
162
sdk/python/sdk/zrok/zrok_api/models/unaccess_body.py
Normal file
@ -0,0 +1,162 @@
|
||||
# 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 UnaccessBody(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',
|
||||
'env_zid': 'str',
|
||||
'shr_token': 'str'
|
||||
}
|
||||
|
||||
attribute_map = {
|
||||
'frontend_token': 'frontendToken',
|
||||
'env_zid': 'envZId',
|
||||
'shr_token': 'shrToken'
|
||||
}
|
||||
|
||||
def __init__(self, frontend_token=None, env_zid=None, shr_token=None): # noqa: E501
|
||||
"""UnaccessBody - a model defined in Swagger""" # noqa: E501
|
||||
self._frontend_token = None
|
||||
self._env_zid = None
|
||||
self._shr_token = None
|
||||
self.discriminator = None
|
||||
if frontend_token is not None:
|
||||
self.frontend_token = frontend_token
|
||||
if env_zid is not None:
|
||||
self.env_zid = env_zid
|
||||
if shr_token is not None:
|
||||
self.shr_token = shr_token
|
||||
|
||||
@property
|
||||
def frontend_token(self):
|
||||
"""Gets the frontend_token of this UnaccessBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The frontend_token of this UnaccessBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._frontend_token
|
||||
|
||||
@frontend_token.setter
|
||||
def frontend_token(self, frontend_token):
|
||||
"""Sets the frontend_token of this UnaccessBody.
|
||||
|
||||
|
||||
:param frontend_token: The frontend_token of this UnaccessBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._frontend_token = frontend_token
|
||||
|
||||
@property
|
||||
def env_zid(self):
|
||||
"""Gets the env_zid of this UnaccessBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The env_zid of this UnaccessBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._env_zid
|
||||
|
||||
@env_zid.setter
|
||||
def env_zid(self, env_zid):
|
||||
"""Sets the env_zid of this UnaccessBody.
|
||||
|
||||
|
||||
:param env_zid: The env_zid of this UnaccessBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._env_zid = env_zid
|
||||
|
||||
@property
|
||||
def shr_token(self):
|
||||
"""Gets the shr_token of this UnaccessBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The shr_token of this UnaccessBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._shr_token
|
||||
|
||||
@shr_token.setter
|
||||
def shr_token(self, shr_token):
|
||||
"""Sets the shr_token of this UnaccessBody.
|
||||
|
||||
|
||||
:param shr_token: The shr_token of this UnaccessBody. # 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(UnaccessBody, 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, UnaccessBody):
|
||||
return False
|
||||
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
162
sdk/python/sdk/zrok/zrok_api/models/unshare_body.py
Normal file
162
sdk/python/sdk/zrok/zrok_api/models/unshare_body.py
Normal file
@ -0,0 +1,162 @@
|
||||
# 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 UnshareBody(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',
|
||||
'reserved': 'bool'
|
||||
}
|
||||
|
||||
attribute_map = {
|
||||
'env_zid': 'envZId',
|
||||
'shr_token': 'shrToken',
|
||||
'reserved': 'reserved'
|
||||
}
|
||||
|
||||
def __init__(self, env_zid=None, shr_token=None, reserved=None): # noqa: E501
|
||||
"""UnshareBody - a model defined in Swagger""" # noqa: E501
|
||||
self._env_zid = None
|
||||
self._shr_token = None
|
||||
self._reserved = 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
|
||||
if reserved is not None:
|
||||
self.reserved = reserved
|
||||
|
||||
@property
|
||||
def env_zid(self):
|
||||
"""Gets the env_zid of this UnshareBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The env_zid of this UnshareBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._env_zid
|
||||
|
||||
@env_zid.setter
|
||||
def env_zid(self, env_zid):
|
||||
"""Sets the env_zid of this UnshareBody.
|
||||
|
||||
|
||||
:param env_zid: The env_zid of this UnshareBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._env_zid = env_zid
|
||||
|
||||
@property
|
||||
def shr_token(self):
|
||||
"""Gets the shr_token of this UnshareBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The shr_token of this UnshareBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._shr_token
|
||||
|
||||
@shr_token.setter
|
||||
def shr_token(self, shr_token):
|
||||
"""Sets the shr_token of this UnshareBody.
|
||||
|
||||
|
||||
:param shr_token: The shr_token of this UnshareBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._shr_token = shr_token
|
||||
|
||||
@property
|
||||
def reserved(self):
|
||||
"""Gets the reserved of this UnshareBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The reserved of this UnshareBody. # noqa: E501
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._reserved
|
||||
|
||||
@reserved.setter
|
||||
def reserved(self, reserved):
|
||||
"""Sets the reserved of this UnshareBody.
|
||||
|
||||
|
||||
:param reserved: The reserved of this UnshareBody. # noqa: E501
|
||||
:type: bool
|
||||
"""
|
||||
|
||||
self._reserved = reserved
|
||||
|
||||
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(UnshareBody, 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, UnshareBody):
|
||||
return False
|
||||
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
@ -1102,7 +1102,13 @@ paths:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
$ref: "#/definitions/unaccessRequest"
|
||||
properties:
|
||||
frontendToken:
|
||||
type: string
|
||||
envZId:
|
||||
type: string
|
||||
shrToken:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: access removed
|
||||
@ -1124,7 +1130,13 @@ paths:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
$ref: "#/definitions/unshareRequest"
|
||||
properties:
|
||||
envZId:
|
||||
type: string
|
||||
shrToken:
|
||||
type: string
|
||||
reserved:
|
||||
type: boolean
|
||||
responses:
|
||||
200:
|
||||
description: share removed
|
||||
@ -1138,7 +1150,6 @@ paths:
|
||||
$ref: "#/definitions/errorMessage"
|
||||
|
||||
definitions:
|
||||
|
||||
authUser:
|
||||
type: object
|
||||
properties:
|
||||
@ -1384,26 +1395,6 @@ definitions:
|
||||
tx:
|
||||
type: number
|
||||
|
||||
unaccessRequest:
|
||||
type: object
|
||||
properties:
|
||||
frontendToken:
|
||||
type: string
|
||||
envZId:
|
||||
type: string
|
||||
shrToken:
|
||||
type: string
|
||||
|
||||
unshareRequest:
|
||||
type: object
|
||||
properties:
|
||||
envZId:
|
||||
type: string
|
||||
shrToken:
|
||||
type: string
|
||||
reserved:
|
||||
type: boolean
|
||||
|
||||
version:
|
||||
type: string
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user