/disable endpoint in openapi definition (#30)

This commit is contained in:
Michael Quigley 2022-09-01 17:39:02 -04:00
parent 2b65166f2a
commit 386c41f41a
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
51 changed files with 1649 additions and 116 deletions

View File

@ -54,10 +54,12 @@ func NewCreateAccountParamsWithHTTPClient(client *http.Client) *CreateAccountPar
}
}
/* CreateAccountParams contains all the parameters to send to the API endpoint
for the create account operation.
/*
CreateAccountParams contains all the parameters to send to the API endpoint
Typically these are written to a http.Request.
for the create account operation.
Typically these are written to a http.Request.
*/
type CreateAccountParams struct {

View File

@ -51,7 +51,8 @@ func NewCreateAccountCreated() *CreateAccountCreated {
return &CreateAccountCreated{}
}
/* CreateAccountCreated describes a response with status code 201, with default header values.
/*
CreateAccountCreated describes a response with status code 201, with default header values.
account created
*/
@ -59,9 +60,39 @@ type CreateAccountCreated struct {
Payload *rest_model_zrok.AccountResponse
}
// IsSuccess returns true when this create account created response has a 2xx status code
func (o *CreateAccountCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this create account created response has a 3xx status code
func (o *CreateAccountCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this create account created response has a 4xx status code
func (o *CreateAccountCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this create account created response has a 5xx status code
func (o *CreateAccountCreated) IsServerError() bool {
return false
}
// IsCode returns true when this create account created response a status code equal to that given
func (o *CreateAccountCreated) IsCode(code int) bool {
return code == 201
}
func (o *CreateAccountCreated) Error() string {
return fmt.Sprintf("[POST /account][%d] createAccountCreated %+v", 201, o.Payload)
}
func (o *CreateAccountCreated) String() string {
return fmt.Sprintf("[POST /account][%d] createAccountCreated %+v", 201, o.Payload)
}
func (o *CreateAccountCreated) GetPayload() *rest_model_zrok.AccountResponse {
return o.Payload
}
@ -83,7 +114,8 @@ func NewCreateAccountBadRequest() *CreateAccountBadRequest {
return &CreateAccountBadRequest{}
}
/* CreateAccountBadRequest describes a response with status code 400, with default header values.
/*
CreateAccountBadRequest describes a response with status code 400, with default header values.
account not created (already exists)
*/
@ -91,9 +123,39 @@ type CreateAccountBadRequest struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this create account bad request response has a 2xx status code
func (o *CreateAccountBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create account bad request response has a 3xx status code
func (o *CreateAccountBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this create account bad request response has a 4xx status code
func (o *CreateAccountBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this create account bad request response has a 5xx status code
func (o *CreateAccountBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this create account bad request response a status code equal to that given
func (o *CreateAccountBadRequest) IsCode(code int) bool {
return code == 400
}
func (o *CreateAccountBadRequest) Error() string {
return fmt.Sprintf("[POST /account][%d] createAccountBadRequest %+v", 400, o.Payload)
}
func (o *CreateAccountBadRequest) String() string {
return fmt.Sprintf("[POST /account][%d] createAccountBadRequest %+v", 400, o.Payload)
}
func (o *CreateAccountBadRequest) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
@ -113,7 +175,8 @@ func NewCreateAccountInternalServerError() *CreateAccountInternalServerError {
return &CreateAccountInternalServerError{}
}
/* CreateAccountInternalServerError describes a response with status code 500, with default header values.
/*
CreateAccountInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
@ -121,9 +184,39 @@ type CreateAccountInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this create account internal server error response has a 2xx status code
func (o *CreateAccountInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create account internal server error response has a 3xx status code
func (o *CreateAccountInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this create account internal server error response has a 4xx status code
func (o *CreateAccountInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this create account internal server error response has a 5xx status code
func (o *CreateAccountInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this create account internal server error response a status code equal to that given
func (o *CreateAccountInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *CreateAccountInternalServerError) Error() string {
return fmt.Sprintf("[POST /account][%d] createAccountInternalServerError %+v", 500, o.Payload)
}
func (o *CreateAccountInternalServerError) String() string {
return fmt.Sprintf("[POST /account][%d] createAccountInternalServerError %+v", 500, o.Payload)
}
func (o *CreateAccountInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}

View File

@ -0,0 +1,150 @@
// Code generated by go-swagger; DO NOT EDIT.
package identity
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
)
// NewDisableParams creates a new DisableParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDisableParams() *DisableParams {
return &DisableParams{
timeout: cr.DefaultTimeout,
}
}
// NewDisableParamsWithTimeout creates a new DisableParams object
// with the ability to set a timeout on a request.
func NewDisableParamsWithTimeout(timeout time.Duration) *DisableParams {
return &DisableParams{
timeout: timeout,
}
}
// NewDisableParamsWithContext creates a new DisableParams object
// with the ability to set a context for a request.
func NewDisableParamsWithContext(ctx context.Context) *DisableParams {
return &DisableParams{
Context: ctx,
}
}
// NewDisableParamsWithHTTPClient creates a new DisableParams object
// with the ability to set a custom HTTPClient for a request.
func NewDisableParamsWithHTTPClient(client *http.Client) *DisableParams {
return &DisableParams{
HTTPClient: client,
}
}
/*
DisableParams contains all the parameters to send to the API endpoint
for the disable operation.
Typically these are written to a http.Request.
*/
type DisableParams struct {
// Body.
Body *rest_model_zrok.DisableRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the disable params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DisableParams) WithDefaults() *DisableParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the disable params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DisableParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the disable params
func (o *DisableParams) WithTimeout(timeout time.Duration) *DisableParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the disable params
func (o *DisableParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the disable params
func (o *DisableParams) WithContext(ctx context.Context) *DisableParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the disable params
func (o *DisableParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the disable params
func (o *DisableParams) WithHTTPClient(client *http.Client) *DisableParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the disable params
func (o *DisableParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the disable params
func (o *DisableParams) WithBody(body *rest_model_zrok.DisableRequest) *DisableParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the disable params
func (o *DisableParams) SetBody(body *rest_model_zrok.DisableRequest) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *DisableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
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...)
}
return nil
}

View File

@ -0,0 +1,210 @@
// Code generated by go-swagger; DO NOT EDIT.
package identity
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
)
// DisableReader is a Reader for the Disable structure.
type DisableReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DisableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDisableOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewDisableUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewDisableInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewDisableOK creates a DisableOK with default headers values
func NewDisableOK() *DisableOK {
return &DisableOK{}
}
/*
DisableOK describes a response with status code 200, with default header values.
environment disabled
*/
type DisableOK struct {
}
// IsSuccess returns true when this disable o k response has a 2xx status code
func (o *DisableOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this disable o k response has a 3xx status code
func (o *DisableOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this disable o k response has a 4xx status code
func (o *DisableOK) IsClientError() bool {
return false
}
// IsServerError returns true when this disable o k response has a 5xx status code
func (o *DisableOK) IsServerError() bool {
return false
}
// IsCode returns true when this disable o k response a status code equal to that given
func (o *DisableOK) IsCode(code int) bool {
return code == 200
}
func (o *DisableOK) Error() string {
return fmt.Sprintf("[POST /disable][%d] disableOK ", 200)
}
func (o *DisableOK) String() string {
return fmt.Sprintf("[POST /disable][%d] disableOK ", 200)
}
func (o *DisableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDisableUnauthorized creates a DisableUnauthorized with default headers values
func NewDisableUnauthorized() *DisableUnauthorized {
return &DisableUnauthorized{}
}
/*
DisableUnauthorized describes a response with status code 401, with default header values.
invalid environment
*/
type DisableUnauthorized struct {
}
// IsSuccess returns true when this disable unauthorized response has a 2xx status code
func (o *DisableUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this disable unauthorized response has a 3xx status code
func (o *DisableUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this disable unauthorized response has a 4xx status code
func (o *DisableUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this disable unauthorized response has a 5xx status code
func (o *DisableUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this disable unauthorized response a status code equal to that given
func (o *DisableUnauthorized) IsCode(code int) bool {
return code == 401
}
func (o *DisableUnauthorized) Error() string {
return fmt.Sprintf("[POST /disable][%d] disableUnauthorized ", 401)
}
func (o *DisableUnauthorized) String() string {
return fmt.Sprintf("[POST /disable][%d] disableUnauthorized ", 401)
}
func (o *DisableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDisableInternalServerError creates a DisableInternalServerError with default headers values
func NewDisableInternalServerError() *DisableInternalServerError {
return &DisableInternalServerError{}
}
/*
DisableInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type DisableInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this disable internal server error response has a 2xx status code
func (o *DisableInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this disable internal server error response has a 3xx status code
func (o *DisableInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this disable internal server error response has a 4xx status code
func (o *DisableInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this disable internal server error response has a 5xx status code
func (o *DisableInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this disable internal server error response a status code equal to that given
func (o *DisableInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *DisableInternalServerError) Error() string {
return fmt.Sprintf("[POST /disable][%d] disableInternalServerError %+v", 500, o.Payload)
}
func (o *DisableInternalServerError) String() string {
return fmt.Sprintf("[POST /disable][%d] disableInternalServerError %+v", 500, o.Payload)
}
func (o *DisableInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *DisableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -54,10 +54,12 @@ func NewEnableParamsWithHTTPClient(client *http.Client) *EnableParams {
}
}
/* EnableParams contains all the parameters to send to the API endpoint
for the enable operation.
/*
EnableParams contains all the parameters to send to the API endpoint
Typically these are written to a http.Request.
for the enable operation.
Typically these are written to a http.Request.
*/
type EnableParams struct {

View File

@ -57,7 +57,8 @@ func NewEnableCreated() *EnableCreated {
return &EnableCreated{}
}
/* EnableCreated describes a response with status code 201, with default header values.
/*
EnableCreated describes a response with status code 201, with default header values.
environment enabled
*/
@ -65,9 +66,39 @@ type EnableCreated struct {
Payload *rest_model_zrok.EnableResponse
}
// IsSuccess returns true when this enable created response has a 2xx status code
func (o *EnableCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this enable created response has a 3xx status code
func (o *EnableCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this enable created response has a 4xx status code
func (o *EnableCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this enable created response has a 5xx status code
func (o *EnableCreated) IsServerError() bool {
return false
}
// IsCode returns true when this enable created response a status code equal to that given
func (o *EnableCreated) IsCode(code int) bool {
return code == 201
}
func (o *EnableCreated) Error() string {
return fmt.Sprintf("[POST /enable][%d] enableCreated %+v", 201, o.Payload)
}
func (o *EnableCreated) String() string {
return fmt.Sprintf("[POST /enable][%d] enableCreated %+v", 201, o.Payload)
}
func (o *EnableCreated) GetPayload() *rest_model_zrok.EnableResponse {
return o.Payload
}
@ -89,17 +120,47 @@ func NewEnableUnauthorized() *EnableUnauthorized {
return &EnableUnauthorized{}
}
/* EnableUnauthorized describes a response with status code 401, with default header values.
/*
EnableUnauthorized describes a response with status code 401, with default header values.
invalid api key
*/
type EnableUnauthorized struct {
}
// IsSuccess returns true when this enable unauthorized response has a 2xx status code
func (o *EnableUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this enable unauthorized response has a 3xx status code
func (o *EnableUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this enable unauthorized response has a 4xx status code
func (o *EnableUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this enable unauthorized response has a 5xx status code
func (o *EnableUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this enable unauthorized response a status code equal to that given
func (o *EnableUnauthorized) IsCode(code int) bool {
return code == 401
}
func (o *EnableUnauthorized) Error() string {
return fmt.Sprintf("[POST /enable][%d] enableUnauthorized ", 401)
}
func (o *EnableUnauthorized) String() string {
return fmt.Sprintf("[POST /enable][%d] enableUnauthorized ", 401)
}
func (o *EnableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
@ -110,17 +171,47 @@ func NewEnableNotFound() *EnableNotFound {
return &EnableNotFound{}
}
/* EnableNotFound describes a response with status code 404, with default header values.
/*
EnableNotFound describes a response with status code 404, with default header values.
account not found
*/
type EnableNotFound struct {
}
// IsSuccess returns true when this enable not found response has a 2xx status code
func (o *EnableNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this enable not found response has a 3xx status code
func (o *EnableNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this enable not found response has a 4xx status code
func (o *EnableNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this enable not found response has a 5xx status code
func (o *EnableNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this enable not found response a status code equal to that given
func (o *EnableNotFound) IsCode(code int) bool {
return code == 404
}
func (o *EnableNotFound) Error() string {
return fmt.Sprintf("[POST /enable][%d] enableNotFound ", 404)
}
func (o *EnableNotFound) String() string {
return fmt.Sprintf("[POST /enable][%d] enableNotFound ", 404)
}
func (o *EnableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
@ -131,7 +222,8 @@ func NewEnableInternalServerError() *EnableInternalServerError {
return &EnableInternalServerError{}
}
/* EnableInternalServerError describes a response with status code 500, with default header values.
/*
EnableInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
@ -139,9 +231,39 @@ type EnableInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this enable internal server error response has a 2xx status code
func (o *EnableInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this enable internal server error response has a 3xx status code
func (o *EnableInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this enable internal server error response has a 4xx status code
func (o *EnableInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this enable internal server error response has a 5xx status code
func (o *EnableInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this enable internal server error response a status code equal to that given
func (o *EnableInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *EnableInternalServerError) Error() string {
return fmt.Sprintf("[POST /enable][%d] enableInternalServerError %+v", 500, o.Payload)
}
func (o *EnableInternalServerError) String() string {
return fmt.Sprintf("[POST /enable][%d] enableInternalServerError %+v", 500, o.Payload)
}
func (o *EnableInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}

View File

@ -32,6 +32,8 @@ type ClientOption func(*runtime.ClientOperation)
type ClientService interface {
CreateAccount(params *CreateAccountParams, opts ...ClientOption) (*CreateAccountCreated, error)
Disable(params *DisableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DisableOK, error)
Enable(params *EnableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EnableCreated, error)
Login(params *LoginParams, opts ...ClientOption) (*LoginOK, error)
@ -40,7 +42,7 @@ type ClientService interface {
}
/*
CreateAccount create account API
CreateAccount create account API
*/
func (a *Client) CreateAccount(params *CreateAccountParams, opts ...ClientOption) (*CreateAccountCreated, error) {
// TODO: Validate the params before sending
@ -78,7 +80,46 @@ func (a *Client) CreateAccount(params *CreateAccountParams, opts ...ClientOption
}
/*
Enable enable API
Disable disable API
*/
func (a *Client) Disable(params *DisableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DisableOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDisableParams()
}
op := &runtime.ClientOperation{
ID: "disable",
Method: "POST",
PathPattern: "/disable",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &DisableReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DisableOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for disable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
Enable enable API
*/
func (a *Client) Enable(params *EnableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EnableCreated, error) {
// TODO: Validate the params before sending
@ -117,7 +158,7 @@ func (a *Client) Enable(params *EnableParams, authInfo runtime.ClientAuthInfoWri
}
/*
Login login API
Login login API
*/
func (a *Client) Login(params *LoginParams, opts ...ClientOption) (*LoginOK, error) {
// TODO: Validate the params before sending

View File

@ -54,10 +54,12 @@ func NewLoginParamsWithHTTPClient(client *http.Client) *LoginParams {
}
}
/* LoginParams contains all the parameters to send to the API endpoint
for the login operation.
/*
LoginParams contains all the parameters to send to the API endpoint
Typically these are written to a http.Request.
for the login operation.
Typically these are written to a http.Request.
*/
type LoginParams struct {

View File

@ -45,7 +45,8 @@ func NewLoginOK() *LoginOK {
return &LoginOK{}
}
/* LoginOK describes a response with status code 200, with default header values.
/*
LoginOK describes a response with status code 200, with default header values.
login successful
*/
@ -53,9 +54,39 @@ type LoginOK struct {
Payload rest_model_zrok.LoginResponse
}
// IsSuccess returns true when this login o k response has a 2xx status code
func (o *LoginOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this login o k response has a 3xx status code
func (o *LoginOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this login o k response has a 4xx status code
func (o *LoginOK) IsClientError() bool {
return false
}
// IsServerError returns true when this login o k response has a 5xx status code
func (o *LoginOK) IsServerError() bool {
return false
}
// IsCode returns true when this login o k response a status code equal to that given
func (o *LoginOK) IsCode(code int) bool {
return code == 200
}
func (o *LoginOK) Error() string {
return fmt.Sprintf("[POST /login][%d] loginOK %+v", 200, o.Payload)
}
func (o *LoginOK) String() string {
return fmt.Sprintf("[POST /login][%d] loginOK %+v", 200, o.Payload)
}
func (o *LoginOK) GetPayload() rest_model_zrok.LoginResponse {
return o.Payload
}
@ -75,17 +106,47 @@ func NewLoginUnauthorized() *LoginUnauthorized {
return &LoginUnauthorized{}
}
/* LoginUnauthorized describes a response with status code 401, with default header values.
/*
LoginUnauthorized describes a response with status code 401, with default header values.
invalid login
*/
type LoginUnauthorized struct {
}
// IsSuccess returns true when this login unauthorized response has a 2xx status code
func (o *LoginUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this login unauthorized response has a 3xx status code
func (o *LoginUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this login unauthorized response has a 4xx status code
func (o *LoginUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this login unauthorized response has a 5xx status code
func (o *LoginUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this login unauthorized response a status code equal to that given
func (o *LoginUnauthorized) IsCode(code int) bool {
return code == 401
}
func (o *LoginUnauthorized) Error() string {
return fmt.Sprintf("[POST /login][%d] loginUnauthorized ", 401)
}
func (o *LoginUnauthorized) String() string {
return fmt.Sprintf("[POST /login][%d] loginUnauthorized ", 401)
}
func (o *LoginUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil

View File

@ -38,7 +38,7 @@ type ClientService interface {
}
/*
Overview overview API
Overview overview API
*/
func (a *Client) Overview(params *OverviewParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OverviewOK, error) {
// TODO: Validate the params before sending
@ -77,7 +77,7 @@ func (a *Client) Overview(params *OverviewParams, authInfo runtime.ClientAuthInf
}
/*
Version version API
Version version API
*/
func (a *Client) Version(params *VersionParams, opts ...ClientOption) (*VersionOK, error) {
// TODO: Validate the params before sending

View File

@ -52,10 +52,12 @@ func NewOverviewParamsWithHTTPClient(client *http.Client) *OverviewParams {
}
}
/* OverviewParams contains all the parameters to send to the API endpoint
for the overview operation.
/*
OverviewParams contains all the parameters to send to the API endpoint
Typically these are written to a http.Request.
for the overview operation.
Typically these are written to a http.Request.
*/
type OverviewParams struct {
timeout time.Duration

View File

@ -45,7 +45,8 @@ func NewOverviewOK() *OverviewOK {
return &OverviewOK{}
}
/* OverviewOK describes a response with status code 200, with default header values.
/*
OverviewOK describes a response with status code 200, with default header values.
overview returned
*/
@ -53,9 +54,39 @@ type OverviewOK struct {
Payload rest_model_zrok.EnvironmentServicesList
}
// IsSuccess returns true when this overview o k response has a 2xx status code
func (o *OverviewOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this overview o k response has a 3xx status code
func (o *OverviewOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this overview o k response has a 4xx status code
func (o *OverviewOK) IsClientError() bool {
return false
}
// IsServerError returns true when this overview o k response has a 5xx status code
func (o *OverviewOK) IsServerError() bool {
return false
}
// IsCode returns true when this overview o k response a status code equal to that given
func (o *OverviewOK) IsCode(code int) bool {
return code == 200
}
func (o *OverviewOK) Error() string {
return fmt.Sprintf("[GET /overview][%d] overviewOK %+v", 200, o.Payload)
}
func (o *OverviewOK) String() string {
return fmt.Sprintf("[GET /overview][%d] overviewOK %+v", 200, o.Payload)
}
func (o *OverviewOK) GetPayload() rest_model_zrok.EnvironmentServicesList {
return o.Payload
}
@ -75,7 +106,8 @@ func NewOverviewInternalServerError() *OverviewInternalServerError {
return &OverviewInternalServerError{}
}
/* OverviewInternalServerError describes a response with status code 500, with default header values.
/*
OverviewInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
@ -83,9 +115,39 @@ type OverviewInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this overview internal server error response has a 2xx status code
func (o *OverviewInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this overview internal server error response has a 3xx status code
func (o *OverviewInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this overview internal server error response has a 4xx status code
func (o *OverviewInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this overview internal server error response has a 5xx status code
func (o *OverviewInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this overview internal server error response a status code equal to that given
func (o *OverviewInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *OverviewInternalServerError) Error() string {
return fmt.Sprintf("[GET /overview][%d] overviewInternalServerError %+v", 500, o.Payload)
}
func (o *OverviewInternalServerError) String() string {
return fmt.Sprintf("[GET /overview][%d] overviewInternalServerError %+v", 500, o.Payload)
}
func (o *OverviewInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}

View File

@ -52,10 +52,12 @@ func NewVersionParamsWithHTTPClient(client *http.Client) *VersionParams {
}
}
/* VersionParams contains all the parameters to send to the API endpoint
for the version operation.
/*
VersionParams contains all the parameters to send to the API endpoint
Typically these are written to a http.Request.
for the version operation.
Typically these are written to a http.Request.
*/
type VersionParams struct {
timeout time.Duration

View File

@ -39,7 +39,8 @@ func NewVersionOK() *VersionOK {
return &VersionOK{}
}
/* VersionOK describes a response with status code 200, with default header values.
/*
VersionOK describes a response with status code 200, with default header values.
retrieve the current server version
*/
@ -47,9 +48,39 @@ type VersionOK struct {
Payload rest_model_zrok.Version
}
// IsSuccess returns true when this version o k response has a 2xx status code
func (o *VersionOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this version o k response has a 3xx status code
func (o *VersionOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this version o k response has a 4xx status code
func (o *VersionOK) IsClientError() bool {
return false
}
// IsServerError returns true when this version o k response has a 5xx status code
func (o *VersionOK) IsServerError() bool {
return false
}
// IsCode returns true when this version o k response a status code equal to that given
func (o *VersionOK) IsCode(code int) bool {
return code == 200
}
func (o *VersionOK) Error() string {
return fmt.Sprintf("[GET /version][%d] versionOK %+v", 200, o.Payload)
}
func (o *VersionOK) String() string {
return fmt.Sprintf("[GET /version][%d] versionOK %+v", 200, o.Payload)
}
func (o *VersionOK) GetPayload() rest_model_zrok.Version {
return o.Payload
}

View File

@ -38,7 +38,7 @@ type ClientService interface {
}
/*
Tunnel tunnel API
Tunnel tunnel API
*/
func (a *Client) Tunnel(params *TunnelParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TunnelCreated, error) {
// TODO: Validate the params before sending
@ -77,7 +77,7 @@ func (a *Client) Tunnel(params *TunnelParams, authInfo runtime.ClientAuthInfoWri
}
/*
Untunnel untunnel API
Untunnel untunnel API
*/
func (a *Client) Untunnel(params *UntunnelParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UntunnelOK, error) {
// TODO: Validate the params before sending

View File

@ -54,10 +54,12 @@ func NewTunnelParamsWithHTTPClient(client *http.Client) *TunnelParams {
}
}
/* TunnelParams contains all the parameters to send to the API endpoint
for the tunnel operation.
/*
TunnelParams contains all the parameters to send to the API endpoint
Typically these are written to a http.Request.
for the tunnel operation.
Typically these are written to a http.Request.
*/
type TunnelParams struct {

View File

@ -51,7 +51,8 @@ func NewTunnelCreated() *TunnelCreated {
return &TunnelCreated{}
}
/* TunnelCreated describes a response with status code 201, with default header values.
/*
TunnelCreated describes a response with status code 201, with default header values.
tunnel created
*/
@ -59,9 +60,39 @@ type TunnelCreated struct {
Payload *rest_model_zrok.TunnelResponse
}
// IsSuccess returns true when this tunnel created response has a 2xx status code
func (o *TunnelCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this tunnel created response has a 3xx status code
func (o *TunnelCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this tunnel created response has a 4xx status code
func (o *TunnelCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this tunnel created response has a 5xx status code
func (o *TunnelCreated) IsServerError() bool {
return false
}
// IsCode returns true when this tunnel created response a status code equal to that given
func (o *TunnelCreated) IsCode(code int) bool {
return code == 201
}
func (o *TunnelCreated) Error() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelCreated %+v", 201, o.Payload)
}
func (o *TunnelCreated) String() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelCreated %+v", 201, o.Payload)
}
func (o *TunnelCreated) GetPayload() *rest_model_zrok.TunnelResponse {
return o.Payload
}
@ -83,7 +114,8 @@ func NewTunnelUnauthorized() *TunnelUnauthorized {
return &TunnelUnauthorized{}
}
/* TunnelUnauthorized describes a response with status code 401, with default header values.
/*
TunnelUnauthorized describes a response with status code 401, with default header values.
invalid environment identity
*/
@ -91,9 +123,39 @@ type TunnelUnauthorized struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this tunnel unauthorized response has a 2xx status code
func (o *TunnelUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this tunnel unauthorized response has a 3xx status code
func (o *TunnelUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this tunnel unauthorized response has a 4xx status code
func (o *TunnelUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this tunnel unauthorized response has a 5xx status code
func (o *TunnelUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this tunnel unauthorized response a status code equal to that given
func (o *TunnelUnauthorized) IsCode(code int) bool {
return code == 401
}
func (o *TunnelUnauthorized) Error() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelUnauthorized %+v", 401, o.Payload)
}
func (o *TunnelUnauthorized) String() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelUnauthorized %+v", 401, o.Payload)
}
func (o *TunnelUnauthorized) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
@ -113,7 +175,8 @@ func NewTunnelInternalServerError() *TunnelInternalServerError {
return &TunnelInternalServerError{}
}
/* TunnelInternalServerError describes a response with status code 500, with default header values.
/*
TunnelInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
@ -121,9 +184,39 @@ type TunnelInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this tunnel internal server error response has a 2xx status code
func (o *TunnelInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this tunnel internal server error response has a 3xx status code
func (o *TunnelInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this tunnel internal server error response has a 4xx status code
func (o *TunnelInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this tunnel internal server error response has a 5xx status code
func (o *TunnelInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this tunnel internal server error response a status code equal to that given
func (o *TunnelInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *TunnelInternalServerError) Error() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelInternalServerError %+v", 500, o.Payload)
}
func (o *TunnelInternalServerError) String() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelInternalServerError %+v", 500, o.Payload)
}
func (o *TunnelInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}

View File

@ -54,10 +54,12 @@ func NewUntunnelParamsWithHTTPClient(client *http.Client) *UntunnelParams {
}
}
/* UntunnelParams contains all the parameters to send to the API endpoint
for the untunnel operation.
/*
UntunnelParams contains all the parameters to send to the API endpoint
Typically these are written to a http.Request.
for the untunnel operation.
Typically these are written to a http.Request.
*/
type UntunnelParams struct {

View File

@ -51,17 +51,47 @@ func NewUntunnelOK() *UntunnelOK {
return &UntunnelOK{}
}
/* UntunnelOK describes a response with status code 200, with default header values.
/*
UntunnelOK describes a response with status code 200, with default header values.
tunnel removed
*/
type UntunnelOK struct {
}
// IsSuccess returns true when this untunnel o k response has a 2xx status code
func (o *UntunnelOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this untunnel o k response has a 3xx status code
func (o *UntunnelOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this untunnel o k response has a 4xx status code
func (o *UntunnelOK) IsClientError() bool {
return false
}
// IsServerError returns true when this untunnel o k response has a 5xx status code
func (o *UntunnelOK) IsServerError() bool {
return false
}
// IsCode returns true when this untunnel o k response a status code equal to that given
func (o *UntunnelOK) IsCode(code int) bool {
return code == 200
}
func (o *UntunnelOK) Error() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelOK ", 200)
}
func (o *UntunnelOK) String() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelOK ", 200)
}
func (o *UntunnelOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
@ -72,7 +102,8 @@ func NewUntunnelNotFound() *UntunnelNotFound {
return &UntunnelNotFound{}
}
/* UntunnelNotFound describes a response with status code 404, with default header values.
/*
UntunnelNotFound describes a response with status code 404, with default header values.
not found
*/
@ -80,9 +111,39 @@ type UntunnelNotFound struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this untunnel not found response has a 2xx status code
func (o *UntunnelNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this untunnel not found response has a 3xx status code
func (o *UntunnelNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this untunnel not found response has a 4xx status code
func (o *UntunnelNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this untunnel not found response has a 5xx status code
func (o *UntunnelNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this untunnel not found response a status code equal to that given
func (o *UntunnelNotFound) IsCode(code int) bool {
return code == 404
}
func (o *UntunnelNotFound) Error() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelNotFound %+v", 404, o.Payload)
}
func (o *UntunnelNotFound) String() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelNotFound %+v", 404, o.Payload)
}
func (o *UntunnelNotFound) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
@ -102,7 +163,8 @@ func NewUntunnelInternalServerError() *UntunnelInternalServerError {
return &UntunnelInternalServerError{}
}
/* UntunnelInternalServerError describes a response with status code 500, with default header values.
/*
UntunnelInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
@ -110,9 +172,39 @@ type UntunnelInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this untunnel internal server error response has a 2xx status code
func (o *UntunnelInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this untunnel internal server error response has a 3xx status code
func (o *UntunnelInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this untunnel internal server error response has a 4xx status code
func (o *UntunnelInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this untunnel internal server error response has a 5xx status code
func (o *UntunnelInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this untunnel internal server error response a status code equal to that given
func (o *UntunnelInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *UntunnelInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelInternalServerError %+v", 500, o.Payload)
}
func (o *UntunnelInternalServerError) String() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelInternalServerError %+v", 500, o.Payload)
}
func (o *UntunnelInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}

View File

@ -19,7 +19,7 @@ import (
var Default = NewHTTPClient(nil)
const (
// DefaultHost is the default HostHeader
// DefaultHost is the default Host
// found in Meta (info) section of spec file
DefaultHost string = "localhost"
// DefaultBasePath is the default BasePath

View File

@ -0,0 +1,50 @@
// Code generated by go-swagger; DO NOT EDIT.
package rest_model_zrok
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// DisableRequest disable request
//
// swagger:model disableRequest
type DisableRequest struct {
// identity
Identity string `json:"identity,omitempty"`
}
// Validate validates this disable request
func (m *DisableRequest) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this disable request based on context it is used
func (m *DisableRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *DisableRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DisableRequest) UnmarshalBinary(b []byte) error {
var res DisableRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -2,18 +2,18 @@
// Package rest_server_zrok zrok
//
// zrok client access
// Schemes:
// http
// HostHeader: localhost
// BasePath: /api/v1
// Version: 1.0.0
// zrok client access
// Schemes:
// http
// Host: localhost
// BasePath: /api/v1
// Version: 1.0.0
//
// Consumes:
// - application/zrok.v1+json
// Consumes:
// - application/zrok.v1+json
//
// Produces:
// - application/zrok.v1+json
// Produces:
// - application/zrok.v1+json
//
// swagger:meta
package rest_server_zrok

View File

@ -72,6 +72,42 @@ func init() {
}
}
},
"/disable": {
"post": {
"security": [
{
"key": []
}
],
"tags": [
"identity"
],
"operationId": "disable",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
"$ref": "#/definitions/disableRequest"
}
}
],
"responses": {
"200": {
"description": "environment disabled"
},
"401": {
"description": "invalid environment"
},
"500": {
"description": "internal server error",
"schema": {
"$ref": "#/definitions/errorMessage"
}
}
}
}
},
"/enable": {
"post": {
"security": [
@ -298,6 +334,14 @@ func init() {
}
}
},
"disableRequest": {
"type": "object",
"properties": {
"identity": {
"type": "string"
}
}
},
"enableRequest": {
"type": "object",
"properties": {
@ -535,6 +579,42 @@ func init() {
}
}
},
"/disable": {
"post": {
"security": [
{
"key": []
}
],
"tags": [
"identity"
],
"operationId": "disable",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
"$ref": "#/definitions/disableRequest"
}
}
],
"responses": {
"200": {
"description": "environment disabled"
},
"401": {
"description": "invalid environment"
},
"500": {
"description": "internal server error",
"schema": {
"$ref": "#/definitions/errorMessage"
}
}
}
}
},
"/enable": {
"post": {
"security": [
@ -761,6 +841,14 @@ func init() {
}
}
},
"disableRequest": {
"type": "object",
"properties": {
"identity": {
"type": "string"
}
}
},
"enableRequest": {
"type": "object",
"properties": {

View File

@ -29,10 +29,10 @@ func NewCreateAccount(ctx *middleware.Context, handler CreateAccountHandler) *Cr
return &CreateAccount{Context: ctx, Handler: handler}
}
/* CreateAccount swagger:route POST /account identity createAccount
/*
CreateAccount swagger:route POST /account identity createAccount
CreateAccount create account API
*/
type CreateAccount struct {
Context *middleware.Context
@ -45,7 +45,7 @@ func (o *CreateAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
*r = *rCtx
}
var Params = NewCreateAccountParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}

View File

@ -6,7 +6,6 @@ package identity
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"github.com/go-openapi/errors"
@ -60,7 +59,7 @@ func (o *CreateAccountParams) BindRequest(r *http.Request, route *middleware.Mat
res = append(res, err)
}
ctx := validate.WithOperationRequest(context.Background())
ctx := validate.WithOperationRequest(r.Context())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}

View File

@ -16,7 +16,8 @@ import (
// CreateAccountCreatedCode is the HTTP code returned for type CreateAccountCreated
const CreateAccountCreatedCode int = 201
/*CreateAccountCreated account created
/*
CreateAccountCreated account created
swagger:response createAccountCreated
*/
@ -60,7 +61,8 @@ func (o *CreateAccountCreated) WriteResponse(rw http.ResponseWriter, producer ru
// CreateAccountBadRequestCode is the HTTP code returned for type CreateAccountBadRequest
const CreateAccountBadRequestCode int = 400
/*CreateAccountBadRequest account not created (already exists)
/*
CreateAccountBadRequest account not created (already exists)
swagger:response createAccountBadRequest
*/
@ -102,7 +104,8 @@ func (o *CreateAccountBadRequest) WriteResponse(rw http.ResponseWriter, producer
// CreateAccountInternalServerErrorCode is the HTTP code returned for type CreateAccountInternalServerError
const CreateAccountInternalServerErrorCode int = 500
/*CreateAccountInternalServerError internal server error
/*
CreateAccountInternalServerError internal server error
swagger:response createAccountInternalServerError
*/

View File

@ -0,0 +1,71 @@
// Code generated by go-swagger; DO NOT EDIT.
package identity
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
)
// DisableHandlerFunc turns a function with the right signature into a disable handler
type DisableHandlerFunc func(DisableParams, *rest_model_zrok.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn DisableHandlerFunc) Handle(params DisableParams, principal *rest_model_zrok.Principal) middleware.Responder {
return fn(params, principal)
}
// DisableHandler interface for that can handle valid disable params
type DisableHandler interface {
Handle(DisableParams, *rest_model_zrok.Principal) middleware.Responder
}
// NewDisable creates a new http.Handler for the disable operation
func NewDisable(ctx *middleware.Context, handler DisableHandler) *Disable {
return &Disable{Context: ctx, Handler: handler}
}
/*
Disable swagger:route POST /disable identity disable
Disable disable API
*/
type Disable struct {
Context *middleware.Context
Handler DisableHandler
}
func (o *Disable) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewDisableParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *rest_model_zrok.Principal
if uprinc != nil {
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,76 @@
// Code generated by go-swagger; DO NOT EDIT.
package identity
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/validate"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
)
// NewDisableParams creates a new DisableParams object
//
// There are no default values defined in the spec.
func NewDisableParams() DisableParams {
return DisableParams{}
}
// DisableParams contains all the bound params for the disable operation
// typically these are obtained from a http.Request
//
// swagger:parameters disable
type DisableParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
In: body
*/
Body *rest_model_zrok.DisableRequest
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewDisableParams() beforehand.
func (o *DisableParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body rest_model_zrok.DisableRequest
if err := route.Consumer.Consume(r.Body, &body); err != nil {
res = append(res, errors.NewParseError("body", "body", "", err))
} else {
// validate body object
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
ctx := validate.WithOperationRequest(r.Context())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Body = &body
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,107 @@
// Code generated by go-swagger; DO NOT EDIT.
package identity
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
)
// DisableOKCode is the HTTP code returned for type DisableOK
const DisableOKCode int = 200
/*
DisableOK environment disabled
swagger:response disableOK
*/
type DisableOK struct {
}
// NewDisableOK creates DisableOK with default headers values
func NewDisableOK() *DisableOK {
return &DisableOK{}
}
// WriteResponse to the client
func (o *DisableOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(200)
}
// DisableUnauthorizedCode is the HTTP code returned for type DisableUnauthorized
const DisableUnauthorizedCode int = 401
/*
DisableUnauthorized invalid environment
swagger:response disableUnauthorized
*/
type DisableUnauthorized struct {
}
// NewDisableUnauthorized creates DisableUnauthorized with default headers values
func NewDisableUnauthorized() *DisableUnauthorized {
return &DisableUnauthorized{}
}
// WriteResponse to the client
func (o *DisableUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(401)
}
// DisableInternalServerErrorCode is the HTTP code returned for type DisableInternalServerError
const DisableInternalServerErrorCode int = 500
/*
DisableInternalServerError internal server error
swagger:response disableInternalServerError
*/
type DisableInternalServerError struct {
/*
In: Body
*/
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
}
// NewDisableInternalServerError creates DisableInternalServerError with default headers values
func NewDisableInternalServerError() *DisableInternalServerError {
return &DisableInternalServerError{}
}
// WithPayload adds the payload to the disable internal server error response
func (o *DisableInternalServerError) WithPayload(payload rest_model_zrok.ErrorMessage) *DisableInternalServerError {
o.Payload = payload
return o
}
// SetPayload sets the payload to the disable internal server error response
func (o *DisableInternalServerError) SetPayload(payload rest_model_zrok.ErrorMessage) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DisableInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(500)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -0,0 +1,87 @@
// Code generated by go-swagger; DO NOT EDIT.
package identity
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
)
// DisableURL generates an URL for the disable operation
type DisableURL struct {
_basePath string
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *DisableURL) WithBasePath(bp string) *DisableURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *DisableURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *DisableURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/disable"
_basePath := o._basePath
if _basePath == "" {
_basePath = "/api/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *DisableURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *DisableURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *DisableURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on DisableURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on DisableURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *DisableURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@ -31,10 +31,10 @@ func NewEnable(ctx *middleware.Context, handler EnableHandler) *Enable {
return &Enable{Context: ctx, Handler: handler}
}
/* Enable swagger:route POST /enable identity enable
/*
Enable swagger:route POST /enable identity enable
Enable enable API
*/
type Enable struct {
Context *middleware.Context
@ -60,7 +60,7 @@ func (o *Enable) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}

View File

@ -6,7 +6,6 @@ package identity
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"github.com/go-openapi/errors"
@ -60,7 +59,7 @@ func (o *EnableParams) BindRequest(r *http.Request, route *middleware.MatchedRou
res = append(res, err)
}
ctx := validate.WithOperationRequest(context.Background())
ctx := validate.WithOperationRequest(r.Context())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}

View File

@ -16,7 +16,8 @@ import (
// EnableCreatedCode is the HTTP code returned for type EnableCreated
const EnableCreatedCode int = 201
/*EnableCreated environment enabled
/*
EnableCreated environment enabled
swagger:response enableCreated
*/
@ -60,7 +61,8 @@ func (o *EnableCreated) WriteResponse(rw http.ResponseWriter, producer runtime.P
// EnableUnauthorizedCode is the HTTP code returned for type EnableUnauthorized
const EnableUnauthorizedCode int = 401
/*EnableUnauthorized invalid api key
/*
EnableUnauthorized invalid api key
swagger:response enableUnauthorized
*/
@ -84,7 +86,8 @@ func (o *EnableUnauthorized) WriteResponse(rw http.ResponseWriter, producer runt
// EnableNotFoundCode is the HTTP code returned for type EnableNotFound
const EnableNotFoundCode int = 404
/*EnableNotFound account not found
/*
EnableNotFound account not found
swagger:response enableNotFound
*/
@ -108,7 +111,8 @@ func (o *EnableNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.
// EnableInternalServerErrorCode is the HTTP code returned for type EnableInternalServerError
const EnableInternalServerErrorCode int = 500
/*EnableInternalServerError internal server error
/*
EnableInternalServerError internal server error
swagger:response enableInternalServerError
*/

View File

@ -29,10 +29,10 @@ func NewLogin(ctx *middleware.Context, handler LoginHandler) *Login {
return &Login{Context: ctx, Handler: handler}
}
/* Login swagger:route POST /login identity login
/*
Login swagger:route POST /login identity login
Login login API
*/
type Login struct {
Context *middleware.Context
@ -45,7 +45,7 @@ func (o *Login) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
*r = *rCtx
}
var Params = NewLoginParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}

View File

@ -6,7 +6,6 @@ package identity
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"github.com/go-openapi/errors"
@ -60,7 +59,7 @@ func (o *LoginParams) BindRequest(r *http.Request, route *middleware.MatchedRout
res = append(res, err)
}
ctx := validate.WithOperationRequest(context.Background())
ctx := validate.WithOperationRequest(r.Context())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}

View File

@ -16,7 +16,8 @@ import (
// LoginOKCode is the HTTP code returned for type LoginOK
const LoginOKCode int = 200
/*LoginOK login successful
/*
LoginOK login successful
swagger:response loginOK
*/
@ -58,7 +59,8 @@ func (o *LoginOK) WriteResponse(rw http.ResponseWriter, producer runtime.Produce
// LoginUnauthorizedCode is the HTTP code returned for type LoginUnauthorized
const LoginUnauthorizedCode int = 401
/*LoginUnauthorized invalid login
/*
LoginUnauthorized invalid login
swagger:response loginUnauthorized
*/

View File

@ -31,10 +31,10 @@ func NewOverview(ctx *middleware.Context, handler OverviewHandler) *Overview {
return &Overview{Context: ctx, Handler: handler}
}
/* Overview swagger:route GET /overview metadata overview
/*
Overview swagger:route GET /overview metadata overview
Overview overview API
*/
type Overview struct {
Context *middleware.Context
@ -60,7 +60,7 @@ func (o *Overview) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}

View File

@ -16,7 +16,8 @@ import (
// OverviewOKCode is the HTTP code returned for type OverviewOK
const OverviewOKCode int = 200
/*OverviewOK overview returned
/*
OverviewOK overview returned
swagger:response overviewOK
*/
@ -63,7 +64,8 @@ func (o *OverviewOK) WriteResponse(rw http.ResponseWriter, producer runtime.Prod
// OverviewInternalServerErrorCode is the HTTP code returned for type OverviewInternalServerError
const OverviewInternalServerErrorCode int = 500
/*OverviewInternalServerError internal server error
/*
OverviewInternalServerError internal server error
swagger:response overviewInternalServerError
*/

View File

@ -29,10 +29,10 @@ func NewVersion(ctx *middleware.Context, handler VersionHandler) *Version {
return &Version{Context: ctx, Handler: handler}
}
/* Version swagger:route GET /version metadata version
/*
Version swagger:route GET /version metadata version
Version version API
*/
type Version struct {
Context *middleware.Context
@ -45,7 +45,7 @@ func (o *Version) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
*r = *rCtx
}
var Params = NewVersionParams()
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}

View File

@ -16,7 +16,8 @@ import (
// VersionOKCode is the HTTP code returned for type VersionOK
const VersionOKCode int = 200
/*VersionOK retrieve the current server version
/*
VersionOK retrieve the current server version
swagger:response versionOK
*/

View File

@ -31,10 +31,10 @@ func NewTunnel(ctx *middleware.Context, handler TunnelHandler) *Tunnel {
return &Tunnel{Context: ctx, Handler: handler}
}
/* Tunnel swagger:route POST /tunnel tunnel tunnel
/*
Tunnel swagger:route POST /tunnel tunnel tunnel
Tunnel tunnel API
*/
type Tunnel struct {
Context *middleware.Context
@ -60,7 +60,7 @@ func (o *Tunnel) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}

View File

@ -6,7 +6,6 @@ package tunnel
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"github.com/go-openapi/errors"
@ -60,7 +59,7 @@ func (o *TunnelParams) BindRequest(r *http.Request, route *middleware.MatchedRou
res = append(res, err)
}
ctx := validate.WithOperationRequest(context.Background())
ctx := validate.WithOperationRequest(r.Context())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}

View File

@ -16,7 +16,8 @@ import (
// TunnelCreatedCode is the HTTP code returned for type TunnelCreated
const TunnelCreatedCode int = 201
/*TunnelCreated tunnel created
/*
TunnelCreated tunnel created
swagger:response tunnelCreated
*/
@ -60,7 +61,8 @@ func (o *TunnelCreated) WriteResponse(rw http.ResponseWriter, producer runtime.P
// TunnelUnauthorizedCode is the HTTP code returned for type TunnelUnauthorized
const TunnelUnauthorizedCode int = 401
/*TunnelUnauthorized invalid environment identity
/*
TunnelUnauthorized invalid environment identity
swagger:response tunnelUnauthorized
*/
@ -102,7 +104,8 @@ func (o *TunnelUnauthorized) WriteResponse(rw http.ResponseWriter, producer runt
// TunnelInternalServerErrorCode is the HTTP code returned for type TunnelInternalServerError
const TunnelInternalServerErrorCode int = 500
/*TunnelInternalServerError internal server error
/*
TunnelInternalServerError internal server error
swagger:response tunnelInternalServerError
*/

View File

@ -31,10 +31,10 @@ func NewUntunnel(ctx *middleware.Context, handler UntunnelHandler) *Untunnel {
return &Untunnel{Context: ctx, Handler: handler}
}
/* Untunnel swagger:route DELETE /untunnel tunnel untunnel
/*
Untunnel swagger:route DELETE /untunnel tunnel untunnel
Untunnel untunnel API
*/
type Untunnel struct {
Context *middleware.Context
@ -60,7 +60,7 @@ func (o *Untunnel) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}

View File

@ -6,7 +6,6 @@ package tunnel
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"github.com/go-openapi/errors"
@ -60,7 +59,7 @@ func (o *UntunnelParams) BindRequest(r *http.Request, route *middleware.MatchedR
res = append(res, err)
}
ctx := validate.WithOperationRequest(context.Background())
ctx := validate.WithOperationRequest(r.Context())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}

View File

@ -16,7 +16,8 @@ import (
// UntunnelOKCode is the HTTP code returned for type UntunnelOK
const UntunnelOKCode int = 200
/*UntunnelOK tunnel removed
/*
UntunnelOK tunnel removed
swagger:response untunnelOK
*/
@ -40,7 +41,8 @@ func (o *UntunnelOK) WriteResponse(rw http.ResponseWriter, producer runtime.Prod
// UntunnelNotFoundCode is the HTTP code returned for type UntunnelNotFound
const UntunnelNotFoundCode int = 404
/*UntunnelNotFound not found
/*
UntunnelNotFound not found
swagger:response untunnelNotFound
*/
@ -82,7 +84,8 @@ func (o *UntunnelNotFound) WriteResponse(rw http.ResponseWriter, producer runtim
// UntunnelInternalServerErrorCode is the HTTP code returned for type UntunnelInternalServerError
const UntunnelInternalServerErrorCode int = 500
/*UntunnelInternalServerError internal server error
/*
UntunnelInternalServerError internal server error
swagger:response untunnelInternalServerError
*/

View File

@ -50,6 +50,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
IdentityCreateAccountHandler: identity.CreateAccountHandlerFunc(func(params identity.CreateAccountParams) middleware.Responder {
return middleware.NotImplemented("operation identity.CreateAccount has not yet been implemented")
}),
IdentityDisableHandler: identity.DisableHandlerFunc(func(params identity.DisableParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation identity.Disable has not yet been implemented")
}),
IdentityEnableHandler: identity.EnableHandlerFunc(func(params identity.EnableParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation identity.Enable has not yet been implemented")
}),
@ -120,6 +123,8 @@ type ZrokAPI struct {
// IdentityCreateAccountHandler sets the operation handler for the create account operation
IdentityCreateAccountHandler identity.CreateAccountHandler
// IdentityDisableHandler sets the operation handler for the disable operation
IdentityDisableHandler identity.DisableHandler
// IdentityEnableHandler sets the operation handler for the enable operation
IdentityEnableHandler identity.EnableHandler
// IdentityLoginHandler sets the operation handler for the login operation
@ -216,6 +221,9 @@ func (o *ZrokAPI) Validate() error {
if o.IdentityCreateAccountHandler == nil {
unregistered = append(unregistered, "identity.CreateAccountHandler")
}
if o.IdentityDisableHandler == nil {
unregistered = append(unregistered, "identity.DisableHandler")
}
if o.IdentityEnableHandler == nil {
unregistered = append(unregistered, "identity.EnableHandler")
}
@ -340,6 +348,10 @@ func (o *ZrokAPI) initHandlerCache() {
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/disable"] = identity.NewDisable(o.context, o.IdentityDisableHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/enable"] = identity.NewEnable(o.context, o.IdentityEnableHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)

View File

@ -8,7 +8,6 @@ import (
"crypto/x509"
"errors"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
@ -73,23 +72,23 @@ type Server struct {
GracefulTimeout time.Duration `long:"graceful-timeout" description:"grace period for which to wait before shutting down the server" default:"15s"`
MaxHeaderSize flagext.ByteSize `long:"max-header-size" description:"controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body." default:"1MiB"`
SocketPath flags.Filename `long:"socket-path" description:"the unix socket to frontend on" default:"/var/run/zrok.sock"`
SocketPath flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/zrok.sock"`
domainSocketL net.Listener
Host string `long:"host" description:"the IP to frontend on" default:"localhost" env:"HOST"`
Port int `long:"port" description:"the port to frontend on for insecure connections, defaults to a random value" env:"PORT"`
ListenLimit int `long:"frontend-limit" description:"limit the number of outstanding requests"`
Host string `long:"host" description:"the IP to listen on" default:"localhost" env:"HOST"`
Port int `long:"port" description:"the port to listen on for insecure connections, defaults to a random value" env:"PORT"`
ListenLimit int `long:"listen-limit" description:"limit the number of outstanding requests"`
KeepAlive time.Duration `long:"keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)" default:"3m"`
ReadTimeout time.Duration `long:"read-timeout" description:"maximum duration before timing out read of the request" default:"30s"`
WriteTimeout time.Duration `long:"write-timeout" description:"maximum duration before timing out write of the response" default:"60s"`
httpServerL net.Listener
TLSHost string `long:"tls-host" description:"the IP to frontend on for tls, when not specified it's the same as --host" env:"TLS_HOST"`
TLSPort int `long:"tls-port" description:"the port to frontend on for secure connections, defaults to a random value" env:"TLS_PORT"`
TLSHost string `long:"tls-host" description:"the IP to listen on for tls, when not specified it's the same as --host" env:"TLS_HOST"`
TLSPort int `long:"tls-port" description:"the port to listen on for secure connections, defaults to a random value" env:"TLS_PORT"`
TLSCertificate flags.Filename `long:"tls-certificate" description:"the certificate to use for secure connections" env:"TLS_CERTIFICATE"`
TLSCertificateKey flags.Filename `long:"tls-key" description:"the private key to use for secure connections" env:"TLS_PRIVATE_KEY"`
TLSCACertificate flags.Filename `long:"tls-ca" description:"the certificate authority file to be used with mutual tls auth" env:"TLS_CA_CERTIFICATE"`
TLSListenLimit int `long:"tls-frontend-limit" description:"limit the number of outstanding requests"`
TLSListenLimit int `long:"tls-listen-limit" description:"limit the number of outstanding requests"`
TLSKeepAlive time.Duration `long:"tls-keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)"`
TLSReadTimeout time.Duration `long:"tls-read-timeout" description:"maximum duration before timing out read of the request"`
TLSWriteTimeout time.Duration `long:"tls-write-timeout" description:"maximum duration before timing out write of the response"`
@ -274,7 +273,7 @@ func (s *Server) Serve() (err error) {
if s.TLSCACertificate != "" {
// include specified CA certificate
caCert, caCertErr := ioutil.ReadFile(string(s.TLSCACertificate))
caCert, caCertErr := os.ReadFile(string(s.TLSCACertificate))
if caCertErr != nil {
return caCertErr
}
@ -337,7 +336,7 @@ func (s *Server) Listen() error {
if s.TLSHost == "" {
s.TLSHost = s.Host
}
// Use http frontend limit if https frontend limit wasn't defined
// Use http listen limit if https listen limit wasn't defined
if s.TLSListenLimit == 0 {
s.TLSListenLimit = s.ListenLimit
}

View File

@ -62,6 +62,28 @@ paths:
schema:
$ref: "#/definitions/errorMessage"
/disable:
post:
tags:
- identity
security:
- key: []
operationId: disable
parameters:
- name: body
in: body
schema:
$ref: "#/definitions/disableRequest"
responses:
200:
description: environment disabled
401:
description: invalid environment
500:
description: internal server error
schema:
$ref: "#/definitions/errorMessage"
/login:
post:
tags:
@ -194,6 +216,12 @@ definitions:
cfg:
type: string
disableRequest:
type: object
properties:
identity:
type: string
environments:
type: array
items:

View File

@ -32,6 +32,21 @@ export function enable(options) {
return gateway.request(enableOperation, parameters)
}
/**
* @param {object} options Optional options
* @param {module:types.disableRequest} [options.body]
* @return {Promise<object>} environment disabled
*/
export function disable(options) {
if (!options) options = {}
const parameters = {
body: {
body: options.body
}
}
return gateway.request(disableOperation, parameters)
}
/**
* @param {object} options Optional options
* @param {module:types.loginRequest} [options.body]
@ -64,6 +79,17 @@ const enableOperation = {
]
}
const disableOperation = {
path: '/disable',
contentTypes: ['application/zrok.v1+json'],
method: 'post',
security: [
{
id: 'key'
}
]
}
const loginOperation = {
path: '/login',
contentTypes: ['application/zrok.v1+json'],

View File

@ -40,6 +40,13 @@
* @property {string} cfg
*/
/**
* @typedef disableRequest
* @memberof module:types
*
* @property {string} identity
*/
/**
* @typedef environment
* @memberof module:types