mirror of
https://github.com/openziti/zrok.git
synced 2025-06-27 13:11:27 +02:00
enable endpoint refactoring (#834)
This commit is contained in:
parent
fc45d4b690
commit
9f63b911ed
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment"
|
||||||
"github.com/openziti/zrok/environment/env_core"
|
"github.com/openziti/zrok/environment/env_core"
|
||||||
restEnvironment "github.com/openziti/zrok/rest_client_zrok/environment"
|
restEnvironment "github.com/openziti/zrok/rest_client_zrok/environment"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
"github.com/shirou/gopsutil/v3/host"
|
"github.com/shirou/gopsutil/v3/host"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -77,10 +76,8 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", token)
|
||||||
req := restEnvironment.NewEnableParams()
|
req := restEnvironment.NewEnableParams()
|
||||||
req.Body = &rest_model_zrok.EnableRequest{
|
req.Body.Description = cmd.description
|
||||||
Description: cmd.description,
|
req.Body.Host = hostDetail
|
||||||
Host: hostDetail,
|
|
||||||
}
|
|
||||||
|
|
||||||
var prg *tea.Program
|
var prg *tea.Program
|
||||||
var done = make(chan struct{})
|
var done = make(chan struct{})
|
||||||
|
@ -81,9 +81,7 @@ func (h *enableHandler) Handle(params environment.EnableParams, principal *rest_
|
|||||||
}
|
}
|
||||||
logrus.Infof("created environment for '%v', with ziti identity '%v', and database id '%v'", principal.Email, ident.Payload.Data.ID, envId)
|
logrus.Infof("created environment for '%v', with ziti identity '%v', and database id '%v'", principal.Email, ident.Payload.Data.ID, envId)
|
||||||
|
|
||||||
resp := environment.NewEnableCreated().WithPayload(&rest_model_zrok.EnableResponse{
|
resp := environment.NewEnableCreated().WithPayload(&environment.EnableCreatedBody{Identity: envZId})
|
||||||
Identity: envZId,
|
|
||||||
})
|
|
||||||
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
enc := json.NewEncoder(&out)
|
enc := json.NewEncoder(&out)
|
||||||
|
@ -14,8 +14,6 @@ import (
|
|||||||
"github.com/go-openapi/runtime"
|
"github.com/go-openapi/runtime"
|
||||||
cr "github.com/go-openapi/runtime/client"
|
cr "github.com/go-openapi/runtime/client"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewEnableParams creates a new EnableParams object,
|
// NewEnableParams creates a new EnableParams object,
|
||||||
@ -64,7 +62,7 @@ EnableParams contains all the parameters to send to the API endpoint
|
|||||||
type EnableParams struct {
|
type EnableParams struct {
|
||||||
|
|
||||||
// Body.
|
// Body.
|
||||||
Body *rest_model_zrok.EnableRequest
|
Body EnableBody
|
||||||
|
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
Context context.Context
|
Context context.Context
|
||||||
@ -120,13 +118,13 @@ func (o *EnableParams) SetHTTPClient(client *http.Client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WithBody adds the body to the enable params
|
// WithBody adds the body to the enable params
|
||||||
func (o *EnableParams) WithBody(body *rest_model_zrok.EnableRequest) *EnableParams {
|
func (o *EnableParams) WithBody(body EnableBody) *EnableParams {
|
||||||
o.SetBody(body)
|
o.SetBody(body)
|
||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody adds the body to the enable params
|
// SetBody adds the body to the enable params
|
||||||
func (o *EnableParams) SetBody(body *rest_model_zrok.EnableRequest) {
|
func (o *EnableParams) SetBody(body EnableBody) {
|
||||||
o.Body = body
|
o.Body = body
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,11 +135,9 @@ func (o *EnableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var res []error
|
var res []error
|
||||||
if o.Body != nil {
|
|
||||||
if err := r.SetBodyParam(o.Body); err != nil {
|
if err := r.SetBodyParam(o.Body); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if len(res) > 0 {
|
if len(res) > 0 {
|
||||||
return errors.CompositeValidationError(res...)
|
return errors.CompositeValidationError(res...)
|
||||||
|
@ -6,13 +6,13 @@ package environment
|
|||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/go-openapi/runtime"
|
"github.com/go-openapi/runtime"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableReader is a Reader for the Enable structure.
|
// EnableReader is a Reader for the Enable structure.
|
||||||
@ -63,7 +63,7 @@ EnableCreated describes a response with status code 201, with default header val
|
|||||||
environment enabled
|
environment enabled
|
||||||
*/
|
*/
|
||||||
type EnableCreated struct {
|
type EnableCreated struct {
|
||||||
Payload *rest_model_zrok.EnableResponse
|
Payload *EnableCreatedBody
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsSuccess returns true when this enable created response has a 2xx status code
|
// IsSuccess returns true when this enable created response has a 2xx status code
|
||||||
@ -104,13 +104,13 @@ func (o *EnableCreated) String() string {
|
|||||||
return fmt.Sprintf("[POST /enable][%d] enableCreated %+v", 201, o.Payload)
|
return fmt.Sprintf("[POST /enable][%d] enableCreated %+v", 201, o.Payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *EnableCreated) GetPayload() *rest_model_zrok.EnableResponse {
|
func (o *EnableCreated) GetPayload() *EnableCreatedBody {
|
||||||
return o.Payload
|
return o.Payload
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *EnableCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
func (o *EnableCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
o.Payload = new(rest_model_zrok.EnableResponse)
|
o.Payload = new(EnableCreatedBody)
|
||||||
|
|
||||||
// response payload
|
// response payload
|
||||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
@ -287,3 +287,85 @@ func (o *EnableInternalServerError) readResponse(response runtime.ClientResponse
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
EnableBody enable body
|
||||||
|
swagger:model EnableBody
|
||||||
|
*/
|
||||||
|
type EnableBody struct {
|
||||||
|
|
||||||
|
// description
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
|
||||||
|
// host
|
||||||
|
Host string `json:"host,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this enable body
|
||||||
|
func (o *EnableBody) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this enable body based on context it is used
|
||||||
|
func (o *EnableBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (o *EnableBody) MarshalBinary() ([]byte, error) {
|
||||||
|
if o == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (o *EnableBody) UnmarshalBinary(b []byte) error {
|
||||||
|
var res EnableBody
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*o = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
EnableCreatedBody enable created body
|
||||||
|
swagger:model EnableCreatedBody
|
||||||
|
*/
|
||||||
|
type EnableCreatedBody struct {
|
||||||
|
|
||||||
|
// cfg
|
||||||
|
Cfg string `json:"cfg,omitempty"`
|
||||||
|
|
||||||
|
// identity
|
||||||
|
Identity string `json:"identity,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this enable created body
|
||||||
|
func (o *EnableCreatedBody) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this enable created body based on context it is used
|
||||||
|
func (o *EnableCreatedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (o *EnableCreatedBody) MarshalBinary() ([]byte, error) {
|
||||||
|
if o == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (o *EnableCreatedBody) UnmarshalBinary(b []byte) error {
|
||||||
|
var res EnableCreatedBody
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*o = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -376,7 +376,14 @@ func init() {
|
|||||||
"name": "body",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/enableRequest"
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"host": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -384,7 +391,14 @@ func init() {
|
|||||||
"201": {
|
"201": {
|
||||||
"description": "environment enabled",
|
"description": "environment enabled",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/enableResponse"
|
"properties": {
|
||||||
|
"cfg": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"identity": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"401": {
|
"401": {
|
||||||
@ -1856,28 +1870,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"enableRequest": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"host": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enableResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"cfg": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"identity": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"environment": {
|
"environment": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -2628,7 +2620,14 @@ func init() {
|
|||||||
"name": "body",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/enableRequest"
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"host": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -2636,7 +2635,14 @@ func init() {
|
|||||||
"201": {
|
"201": {
|
||||||
"description": "environment enabled",
|
"description": "environment enabled",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/enableResponse"
|
"properties": {
|
||||||
|
"cfg": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"identity": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"401": {
|
"401": {
|
||||||
@ -4113,28 +4119,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"enableRequest": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"host": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enableResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"cfg": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"identity": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"environment": {
|
"environment": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -6,9 +6,12 @@ package environment
|
|||||||
// Editing this file might prove futile when you re-run the generate command
|
// Editing this file might prove futile when you re-run the generate command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/go-openapi/runtime/middleware"
|
"github.com/go-openapi/runtime/middleware"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
)
|
)
|
||||||
@ -69,3 +72,83 @@ func (o *Enable) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EnableBody enable body
|
||||||
|
//
|
||||||
|
// swagger:model EnableBody
|
||||||
|
type EnableBody struct {
|
||||||
|
|
||||||
|
// description
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
|
||||||
|
// host
|
||||||
|
Host string `json:"host,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this enable body
|
||||||
|
func (o *EnableBody) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this enable body based on context it is used
|
||||||
|
func (o *EnableBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (o *EnableBody) MarshalBinary() ([]byte, error) {
|
||||||
|
if o == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (o *EnableBody) UnmarshalBinary(b []byte) error {
|
||||||
|
var res EnableBody
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*o = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnableCreatedBody enable created body
|
||||||
|
//
|
||||||
|
// swagger:model EnableCreatedBody
|
||||||
|
type EnableCreatedBody struct {
|
||||||
|
|
||||||
|
// cfg
|
||||||
|
Cfg string `json:"cfg,omitempty"`
|
||||||
|
|
||||||
|
// identity
|
||||||
|
Identity string `json:"identity,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this enable created body
|
||||||
|
func (o *EnableCreatedBody) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this enable created body based on context it is used
|
||||||
|
func (o *EnableCreatedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (o *EnableCreatedBody) MarshalBinary() ([]byte, error) {
|
||||||
|
if o == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (o *EnableCreatedBody) UnmarshalBinary(b []byte) error {
|
||||||
|
var res EnableCreatedBody
|
||||||
|
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"
|
||||||
"github.com/go-openapi/runtime/middleware"
|
"github.com/go-openapi/runtime/middleware"
|
||||||
"github.com/go-openapi/validate"
|
"github.com/go-openapi/validate"
|
||||||
|
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewEnableParams creates a new EnableParams object
|
// NewEnableParams creates a new EnableParams object
|
||||||
@ -36,7 +34,7 @@ type EnableParams struct {
|
|||||||
/*
|
/*
|
||||||
In: body
|
In: body
|
||||||
*/
|
*/
|
||||||
Body *rest_model_zrok.EnableRequest
|
Body EnableBody
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
// 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 *EnableParams) BindRequest(r *http.Request, route *middleware.MatchedRou
|
|||||||
|
|
||||||
if runtime.HasBody(r) {
|
if runtime.HasBody(r) {
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
var body rest_model_zrok.EnableRequest
|
var body EnableBody
|
||||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||||
} else {
|
} else {
|
||||||
@ -65,7 +63,7 @@ func (o *EnableParams) BindRequest(r *http.Request, route *middleware.MatchedRou
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(res) == 0 {
|
if len(res) == 0 {
|
||||||
o.Body = &body
|
o.Body = body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/go-openapi/runtime"
|
"github.com/go-openapi/runtime"
|
||||||
|
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableCreatedCode is the HTTP code returned for type EnableCreated
|
// EnableCreatedCode is the HTTP code returned for type EnableCreated
|
||||||
@ -26,7 +24,7 @@ type EnableCreated struct {
|
|||||||
/*
|
/*
|
||||||
In: Body
|
In: Body
|
||||||
*/
|
*/
|
||||||
Payload *rest_model_zrok.EnableResponse `json:"body,omitempty"`
|
Payload *EnableCreatedBody `json:"body,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEnableCreated creates EnableCreated with default headers values
|
// NewEnableCreated creates EnableCreated with default headers values
|
||||||
@ -36,13 +34,13 @@ func NewEnableCreated() *EnableCreated {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WithPayload adds the payload to the enable created response
|
// WithPayload adds the payload to the enable created response
|
||||||
func (o *EnableCreated) WithPayload(payload *rest_model_zrok.EnableResponse) *EnableCreated {
|
func (o *EnableCreated) WithPayload(payload *EnableCreatedBody) *EnableCreated {
|
||||||
o.Payload = payload
|
o.Payload = payload
|
||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPayload sets the payload to the enable created response
|
// SetPayload sets the payload to the enable created response
|
||||||
func (o *EnableCreated) SetPayload(payload *rest_model_zrok.EnableResponse) {
|
func (o *EnableCreated) SetPayload(payload *EnableCreatedBody) {
|
||||||
o.Payload = payload
|
o.Payload = payload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ model/createOrganizationRequest.ts
|
|||||||
model/deleteFrontendRequest.ts
|
model/deleteFrontendRequest.ts
|
||||||
model/disableRequest.ts
|
model/disableRequest.ts
|
||||||
model/enableRequest.ts
|
model/enableRequest.ts
|
||||||
model/enableResponse.ts
|
|
||||||
model/environment.ts
|
model/environment.ts
|
||||||
model/environmentAndResources.ts
|
model/environmentAndResources.ts
|
||||||
model/frontend.ts
|
model/frontend.ts
|
||||||
|
@ -15,9 +15,9 @@ import localVarRequest from 'request';
|
|||||||
import http from 'http';
|
import http from 'http';
|
||||||
|
|
||||||
/* tslint:disable:no-unused-locals */
|
/* tslint:disable:no-unused-locals */
|
||||||
|
import { CreateIdentity201Response } from '../model/createIdentity201Response';
|
||||||
import { DisableRequest } from '../model/disableRequest';
|
import { DisableRequest } from '../model/disableRequest';
|
||||||
import { EnableRequest } from '../model/enableRequest';
|
import { EnableRequest } from '../model/enableRequest';
|
||||||
import { EnableResponse } from '../model/enableResponse';
|
|
||||||
|
|
||||||
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
|
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
|
||||||
import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
|
import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
|
||||||
@ -153,7 +153,7 @@ export class EnvironmentApi {
|
|||||||
*
|
*
|
||||||
* @param body
|
* @param body
|
||||||
*/
|
*/
|
||||||
public async enable (body?: EnableRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: EnableResponse; }> {
|
public async enable (body?: EnableRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateIdentity201Response; }> {
|
||||||
const localVarPath = this.basePath + '/enable';
|
const localVarPath = this.basePath + '/enable';
|
||||||
let localVarQueryParameters: any = {};
|
let localVarQueryParameters: any = {};
|
||||||
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||||||
@ -199,13 +199,13 @@ export class EnvironmentApi {
|
|||||||
localVarRequestOptions.form = localVarFormParams;
|
localVarRequestOptions.form = localVarFormParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Promise<{ response: http.IncomingMessage; body: EnableResponse; }>((resolve, reject) => {
|
return new Promise<{ response: http.IncomingMessage; body: CreateIdentity201Response; }>((resolve, reject) => {
|
||||||
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} else {
|
||||||
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||||||
body = ObjectSerializer.deserialize(body, "EnableResponse");
|
body = ObjectSerializer.deserialize(body, "CreateIdentity201Response");
|
||||||
resolve({ response: response, body: body });
|
resolve({ response: response, body: body });
|
||||||
} else {
|
} else {
|
||||||
reject(new HttpError(response, body, response.statusCode));
|
reject(new HttpError(response, body, response.statusCode));
|
||||||
|
@ -13,7 +13,6 @@ export * from './createOrganizationRequest';
|
|||||||
export * from './deleteFrontendRequest';
|
export * from './deleteFrontendRequest';
|
||||||
export * from './disableRequest';
|
export * from './disableRequest';
|
||||||
export * from './enableRequest';
|
export * from './enableRequest';
|
||||||
export * from './enableResponse';
|
|
||||||
export * from './environment';
|
export * from './environment';
|
||||||
export * from './environmentAndResources';
|
export * from './environmentAndResources';
|
||||||
export * from './frontend';
|
export * from './frontend';
|
||||||
@ -74,7 +73,6 @@ import { CreateOrganizationRequest } from './createOrganizationRequest';
|
|||||||
import { DeleteFrontendRequest } from './deleteFrontendRequest';
|
import { DeleteFrontendRequest } from './deleteFrontendRequest';
|
||||||
import { DisableRequest } from './disableRequest';
|
import { DisableRequest } from './disableRequest';
|
||||||
import { EnableRequest } from './enableRequest';
|
import { EnableRequest } from './enableRequest';
|
||||||
import { EnableResponse } from './enableResponse';
|
|
||||||
import { Environment } from './environment';
|
import { Environment } from './environment';
|
||||||
import { EnvironmentAndResources } from './environmentAndResources';
|
import { EnvironmentAndResources } from './environmentAndResources';
|
||||||
import { Frontend } from './frontend';
|
import { Frontend } from './frontend';
|
||||||
@ -143,7 +141,6 @@ let typeMap: {[index: string]: any} = {
|
|||||||
"DeleteFrontendRequest": DeleteFrontendRequest,
|
"DeleteFrontendRequest": DeleteFrontendRequest,
|
||||||
"DisableRequest": DisableRequest,
|
"DisableRequest": DisableRequest,
|
||||||
"EnableRequest": EnableRequest,
|
"EnableRequest": EnableRequest,
|
||||||
"EnableResponse": EnableResponse,
|
|
||||||
"Environment": Environment,
|
"Environment": Environment,
|
||||||
"EnvironmentAndResources": EnvironmentAndResources,
|
"EnvironmentAndResources": EnvironmentAndResources,
|
||||||
"Frontend": Frontend,
|
"Frontend": Frontend,
|
||||||
|
@ -31,8 +31,7 @@ from zrok_api.models.auth_user import AuthUser
|
|||||||
from zrok_api.models.change_password_body import ChangePasswordBody
|
from zrok_api.models.change_password_body import ChangePasswordBody
|
||||||
from zrok_api.models.configuration import Configuration
|
from zrok_api.models.configuration import Configuration
|
||||||
from zrok_api.models.disable_request import DisableRequest
|
from zrok_api.models.disable_request import DisableRequest
|
||||||
from zrok_api.models.enable_request import EnableRequest
|
from zrok_api.models.enable_body import EnableBody
|
||||||
from zrok_api.models.enable_response import EnableResponse
|
|
||||||
from zrok_api.models.environment import Environment
|
from zrok_api.models.environment import Environment
|
||||||
from zrok_api.models.environment_and_resources import EnvironmentAndResources
|
from zrok_api.models.environment_and_resources import EnvironmentAndResources
|
||||||
from zrok_api.models.environments import Environments
|
from zrok_api.models.environments import Environments
|
||||||
|
@ -130,8 +130,8 @@ class EnvironmentApi(object):
|
|||||||
>>> result = thread.get()
|
>>> result = thread.get()
|
||||||
|
|
||||||
:param async_req bool
|
:param async_req bool
|
||||||
:param EnableRequest body:
|
:param EnableBody body:
|
||||||
:return: EnableResponse
|
:return: InlineResponse201
|
||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
@ -151,8 +151,8 @@ class EnvironmentApi(object):
|
|||||||
>>> result = thread.get()
|
>>> result = thread.get()
|
||||||
|
|
||||||
:param async_req bool
|
:param async_req bool
|
||||||
:param EnableRequest body:
|
:param EnableBody body:
|
||||||
:return: EnableResponse
|
:return: InlineResponse201
|
||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
@ -206,7 +206,7 @@ class EnvironmentApi(object):
|
|||||||
body=body_params,
|
body=body_params,
|
||||||
post_params=form_params,
|
post_params=form_params,
|
||||||
files=local_var_files,
|
files=local_var_files,
|
||||||
response_type='EnableResponse', # noqa: E501
|
response_type='InlineResponse201', # noqa: E501
|
||||||
auth_settings=auth_settings,
|
auth_settings=auth_settings,
|
||||||
async_req=params.get('async_req'),
|
async_req=params.get('async_req'),
|
||||||
_return_http_data_only=params.get('_return_http_data_only'),
|
_return_http_data_only=params.get('_return_http_data_only'),
|
||||||
|
@ -21,8 +21,7 @@ from zrok_api.models.auth_user import AuthUser
|
|||||||
from zrok_api.models.change_password_body import ChangePasswordBody
|
from zrok_api.models.change_password_body import ChangePasswordBody
|
||||||
from zrok_api.models.configuration import Configuration
|
from zrok_api.models.configuration import Configuration
|
||||||
from zrok_api.models.disable_request import DisableRequest
|
from zrok_api.models.disable_request import DisableRequest
|
||||||
from zrok_api.models.enable_request import EnableRequest
|
from zrok_api.models.enable_body import EnableBody
|
||||||
from zrok_api.models.enable_response import EnableResponse
|
|
||||||
from zrok_api.models.environment import Environment
|
from zrok_api.models.environment import Environment
|
||||||
from zrok_api.models.environment_and_resources import EnvironmentAndResources
|
from zrok_api.models.environment_and_resources import EnvironmentAndResources
|
||||||
from zrok_api.models.environments import Environments
|
from zrok_api.models.environments import Environments
|
||||||
|
136
sdk/python/sdk/zrok/zrok_api/models/enable_body.py
Normal file
136
sdk/python/sdk/zrok/zrok_api/models/enable_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 EnableBody(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 = {
|
||||||
|
'description': 'str',
|
||||||
|
'host': 'str'
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute_map = {
|
||||||
|
'description': 'description',
|
||||||
|
'host': 'host'
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, description=None, host=None): # noqa: E501
|
||||||
|
"""EnableBody - a model defined in Swagger""" # noqa: E501
|
||||||
|
self._description = None
|
||||||
|
self._host = None
|
||||||
|
self.discriminator = None
|
||||||
|
if description is not None:
|
||||||
|
self.description = description
|
||||||
|
if host is not None:
|
||||||
|
self.host = host
|
||||||
|
|
||||||
|
@property
|
||||||
|
def description(self):
|
||||||
|
"""Gets the description of this EnableBody. # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
:return: The description of this EnableBody. # noqa: E501
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return self._description
|
||||||
|
|
||||||
|
@description.setter
|
||||||
|
def description(self, description):
|
||||||
|
"""Sets the description of this EnableBody.
|
||||||
|
|
||||||
|
|
||||||
|
:param description: The description of this EnableBody. # noqa: E501
|
||||||
|
:type: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._description = description
|
||||||
|
|
||||||
|
@property
|
||||||
|
def host(self):
|
||||||
|
"""Gets the host of this EnableBody. # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
:return: The host of this EnableBody. # noqa: E501
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return self._host
|
||||||
|
|
||||||
|
@host.setter
|
||||||
|
def host(self, host):
|
||||||
|
"""Sets the host of this EnableBody.
|
||||||
|
|
||||||
|
|
||||||
|
:param host: The host of this EnableBody. # noqa: E501
|
||||||
|
:type: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._host = host
|
||||||
|
|
||||||
|
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(EnableBody, 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, EnableBody):
|
||||||
|
return False
|
||||||
|
|
||||||
|
return self.__dict__ == other.__dict__
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
"""Returns true if both objects are not equal"""
|
||||||
|
return not self == other
|
@ -627,12 +627,20 @@ paths:
|
|||||||
- name: body
|
- name: body
|
||||||
in: body
|
in: body
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/enableRequest"
|
properties:
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
host:
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
201:
|
201:
|
||||||
description: environment enabled
|
description: environment enabled
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/enableResponse"
|
properties:
|
||||||
|
identity:
|
||||||
|
type: string
|
||||||
|
cfg:
|
||||||
|
type: string
|
||||||
401:
|
401:
|
||||||
description: unauthorized
|
description: unauthorized
|
||||||
404:
|
404:
|
||||||
@ -1154,22 +1162,6 @@ definitions:
|
|||||||
identity:
|
identity:
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
enableRequest:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
description:
|
|
||||||
type: string
|
|
||||||
host:
|
|
||||||
type: string
|
|
||||||
|
|
||||||
enableResponse:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
identity:
|
|
||||||
type: string
|
|
||||||
cfg:
|
|
||||||
type: string
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -17,7 +17,6 @@ models/CreateOrganizationRequest.ts
|
|||||||
models/DeleteFrontendRequest.ts
|
models/DeleteFrontendRequest.ts
|
||||||
models/DisableRequest.ts
|
models/DisableRequest.ts
|
||||||
models/EnableRequest.ts
|
models/EnableRequest.ts
|
||||||
models/EnableResponse.ts
|
|
||||||
models/Environment.ts
|
models/Environment.ts
|
||||||
models/EnvironmentAndResources.ts
|
models/EnvironmentAndResources.ts
|
||||||
models/Frontend.ts
|
models/Frontend.ts
|
||||||
|
@ -15,17 +15,17 @@
|
|||||||
|
|
||||||
import * as runtime from '../runtime';
|
import * as runtime from '../runtime';
|
||||||
import type {
|
import type {
|
||||||
|
CreateIdentity201Response,
|
||||||
DisableRequest,
|
DisableRequest,
|
||||||
EnableRequest,
|
EnableRequest,
|
||||||
EnableResponse,
|
|
||||||
} from '../models/index';
|
} from '../models/index';
|
||||||
import {
|
import {
|
||||||
|
CreateIdentity201ResponseFromJSON,
|
||||||
|
CreateIdentity201ResponseToJSON,
|
||||||
DisableRequestFromJSON,
|
DisableRequestFromJSON,
|
||||||
DisableRequestToJSON,
|
DisableRequestToJSON,
|
||||||
EnableRequestFromJSON,
|
EnableRequestFromJSON,
|
||||||
EnableRequestToJSON,
|
EnableRequestToJSON,
|
||||||
EnableResponseFromJSON,
|
|
||||||
EnableResponseToJSON,
|
|
||||||
} from '../models/index';
|
} from '../models/index';
|
||||||
|
|
||||||
export interface DisableOperationRequest {
|
export interface DisableOperationRequest {
|
||||||
@ -73,7 +73,7 @@ export class EnvironmentApi extends runtime.BaseAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
async enableRaw(requestParameters: EnableOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EnableResponse>> {
|
async enableRaw(requestParameters: EnableOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateIdentity201Response>> {
|
||||||
const queryParameters: any = {};
|
const queryParameters: any = {};
|
||||||
|
|
||||||
const headerParameters: runtime.HTTPHeaders = {};
|
const headerParameters: runtime.HTTPHeaders = {};
|
||||||
@ -92,12 +92,12 @@ export class EnvironmentApi extends runtime.BaseAPI {
|
|||||||
body: EnableRequestToJSON(requestParameters['body']),
|
body: EnableRequestToJSON(requestParameters['body']),
|
||||||
}, initOverrides);
|
}, initOverrides);
|
||||||
|
|
||||||
return new runtime.JSONApiResponse(response, (jsonValue) => EnableResponseFromJSON(jsonValue));
|
return new runtime.JSONApiResponse(response, (jsonValue) => CreateIdentity201ResponseFromJSON(jsonValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
async enable(requestParameters: EnableOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EnableResponse> {
|
async enable(requestParameters: EnableOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateIdentity201Response> {
|
||||||
const response = await this.enableRaw(requestParameters, initOverrides);
|
const response = await this.enableRaw(requestParameters, initOverrides);
|
||||||
return await response.value();
|
return await response.value();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ export * from './CreateOrganizationRequest';
|
|||||||
export * from './DeleteFrontendRequest';
|
export * from './DeleteFrontendRequest';
|
||||||
export * from './DisableRequest';
|
export * from './DisableRequest';
|
||||||
export * from './EnableRequest';
|
export * from './EnableRequest';
|
||||||
export * from './EnableResponse';
|
|
||||||
export * from './Environment';
|
export * from './Environment';
|
||||||
export * from './EnvironmentAndResources';
|
export * from './EnvironmentAndResources';
|
||||||
export * from './Frontend';
|
export * from './Frontend';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user