mirror of
https://github.com/openziti/zrok.git
synced 2024-11-28 19:14:07 +01:00
rudimentary account registration swagger
This commit is contained in:
parent
0e37be14b4
commit
23896ab3fa
53
rest_model/account_request.go
Normal file
53
rest_model/account_request.go
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package rest_model
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AccountRequest account request
|
||||||
|
//
|
||||||
|
// swagger:model accountRequest
|
||||||
|
type AccountRequest struct {
|
||||||
|
|
||||||
|
// password
|
||||||
|
Password string `json:"password,omitempty"`
|
||||||
|
|
||||||
|
// username
|
||||||
|
Username string `json:"username,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this account request
|
||||||
|
func (m *AccountRequest) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this account request based on context it is used
|
||||||
|
func (m *AccountRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *AccountRequest) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *AccountRequest) UnmarshalBinary(b []byte) error {
|
||||||
|
var res AccountRequest
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
50
rest_model/account_response.go
Normal file
50
rest_model/account_response.go
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package rest_model
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AccountResponse account response
|
||||||
|
//
|
||||||
|
// swagger:model accountResponse
|
||||||
|
type AccountResponse struct {
|
||||||
|
|
||||||
|
// api token
|
||||||
|
APIToken string `json:"apiToken,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this account response
|
||||||
|
func (m *AccountResponse) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this account response based on context it is used
|
||||||
|
func (m *AccountResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *AccountResponse) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *AccountResponse) UnmarshalBinary(b []byte) error {
|
||||||
|
var res AccountResponse
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
110
rest_model/base_entity.go
Normal file
110
rest_model/base_entity.go
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package rest_model
|
||||||
|
|
||||||
|
// 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/errors"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
"github.com/go-openapi/validate"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BaseEntity Fields shared by all zrok entities
|
||||||
|
//
|
||||||
|
// swagger:model baseEntity
|
||||||
|
type BaseEntity struct {
|
||||||
|
|
||||||
|
// created at
|
||||||
|
// Required: true
|
||||||
|
CreatedAt *string `json:"createdAt"`
|
||||||
|
|
||||||
|
// id
|
||||||
|
// Required: true
|
||||||
|
ID *string `json:"id"`
|
||||||
|
|
||||||
|
// updated at
|
||||||
|
// Required: true
|
||||||
|
// Format: date-time
|
||||||
|
UpdatedAt *strfmt.DateTime `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this base entity
|
||||||
|
func (m *BaseEntity) Validate(formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.validateCreatedAt(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateID(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateUpdatedAt(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *BaseEntity) validateCreatedAt(formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := validate.Required("createdAt", "body", m.CreatedAt); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *BaseEntity) validateID(formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := validate.Required("id", "body", m.ID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *BaseEntity) validateUpdatedAt(formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := validate.Required("updatedAt", "body", m.UpdatedAt); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this base entity based on context it is used
|
||||||
|
func (m *BaseEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *BaseEntity) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *BaseEntity) UnmarshalBinary(b []byte) error {
|
||||||
|
var res BaseEntity
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
@ -8,10 +8,8 @@ package rest_model
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/go-openapi/errors"
|
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
"github.com/go-openapi/swag"
|
"github.com/go-openapi/swag"
|
||||||
"github.com/go-openapi/validate"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version version
|
// Version version
|
||||||
@ -20,33 +18,11 @@ import (
|
|||||||
type Version struct {
|
type Version struct {
|
||||||
|
|
||||||
// version
|
// version
|
||||||
// Min Length: 1
|
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates this version
|
// Validate validates this version
|
||||||
func (m *Version) Validate(formats strfmt.Registry) error {
|
func (m *Version) Validate(formats strfmt.Registry) error {
|
||||||
var res []error
|
|
||||||
|
|
||||||
if err := m.validateVersion(formats); err != nil {
|
|
||||||
res = append(res, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(res) > 0 {
|
|
||||||
return errors.CompositeValidationError(res...)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Version) validateVersion(formats strfmt.Registry) error {
|
|
||||||
if swag.IsZero(m.Version) { // not required
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := validate.MinLength("version", "body", m.Version, 1); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
148
rest_zrok_client/identity/create_account_parameters.go
Normal file
148
rest_zrok_client/identity/create_account_parameters.go
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewCreateAccountParams creates a new CreateAccountParams 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 NewCreateAccountParams() *CreateAccountParams {
|
||||||
|
return &CreateAccountParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCreateAccountParamsWithTimeout creates a new CreateAccountParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewCreateAccountParamsWithTimeout(timeout time.Duration) *CreateAccountParams {
|
||||||
|
return &CreateAccountParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCreateAccountParamsWithContext creates a new CreateAccountParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewCreateAccountParamsWithContext(ctx context.Context) *CreateAccountParams {
|
||||||
|
return &CreateAccountParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCreateAccountParamsWithHTTPClient creates a new CreateAccountParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewCreateAccountParamsWithHTTPClient(client *http.Client) *CreateAccountParams {
|
||||||
|
return &CreateAccountParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CreateAccountParams contains all the parameters to send to the API endpoint
|
||||||
|
for the create account operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type CreateAccountParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *rest_model.AccountRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the create account params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *CreateAccountParams) WithDefaults() *CreateAccountParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the create account params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *CreateAccountParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the create account params
|
||||||
|
func (o *CreateAccountParams) WithTimeout(timeout time.Duration) *CreateAccountParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the create account params
|
||||||
|
func (o *CreateAccountParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the create account params
|
||||||
|
func (o *CreateAccountParams) WithContext(ctx context.Context) *CreateAccountParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the create account params
|
||||||
|
func (o *CreateAccountParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the create account params
|
||||||
|
func (o *CreateAccountParams) WithHTTPClient(client *http.Client) *CreateAccountParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the create account params
|
||||||
|
func (o *CreateAccountParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the create account params
|
||||||
|
func (o *CreateAccountParams) WithBody(body *rest_model.AccountRequest) *CreateAccountParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the create account params
|
||||||
|
func (o *CreateAccountParams) SetBody(body *rest_model.AccountRequest) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *CreateAccountParams) 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
|
||||||
|
}
|
67
rest_zrok_client/identity/create_account_responses.go
Normal file
67
rest_zrok_client/identity/create_account_responses.go
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateAccountReader is a Reader for the CreateAccount structure.
|
||||||
|
type CreateAccountReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *CreateAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 201:
|
||||||
|
result := NewCreateAccountCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
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())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCreateAccountCreated creates a CreateAccountCreated with default headers values
|
||||||
|
func NewCreateAccountCreated() *CreateAccountCreated {
|
||||||
|
return &CreateAccountCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CreateAccountCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
account created
|
||||||
|
*/
|
||||||
|
type CreateAccountCreated struct {
|
||||||
|
Payload *rest_model.AccountResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *CreateAccountCreated) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /account][%d] createAccountCreated %+v", 201, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *CreateAccountCreated) GetPayload() *rest_model.AccountResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *CreateAccountCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(rest_model.AccountResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
79
rest_zrok_client/identity/identity_client.go
Normal file
79
rest_zrok_client/identity/identity_client.go
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
// 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"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// New creates a new identity API client.
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||||
|
return &Client{transport: transport, formats: formats}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Client for identity API
|
||||||
|
*/
|
||||||
|
type Client struct {
|
||||||
|
transport runtime.ClientTransport
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
CreateAccount(params *CreateAccountParams, opts ...ClientOption) (*CreateAccountCreated, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
CreateAccount create account API
|
||||||
|
*/
|
||||||
|
func (a *Client) CreateAccount(params *CreateAccountParams, opts ...ClientOption) (*CreateAccountCreated, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewCreateAccountParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "createAccount",
|
||||||
|
Method: "POST",
|
||||||
|
PathPattern: "/account",
|
||||||
|
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &CreateAccountReader{formats: a.formats},
|
||||||
|
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.(*CreateAccountCreated)
|
||||||
|
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 createAccount: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTransport changes the transport on the client
|
||||||
|
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||||
|
a.transport = transport
|
||||||
|
}
|
@ -10,6 +10,7 @@ import (
|
|||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"github.com/openziti-test-kitchen/zrok/rest_zrok_client/identity"
|
||||||
"github.com/openziti-test-kitchen/zrok/rest_zrok_client/metadata"
|
"github.com/openziti-test-kitchen/zrok/rest_zrok_client/metadata"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Zrok {
|
|||||||
|
|
||||||
cli := new(Zrok)
|
cli := new(Zrok)
|
||||||
cli.Transport = transport
|
cli.Transport = transport
|
||||||
|
cli.Identity = identity.New(transport, formats)
|
||||||
cli.Metadata = metadata.New(transport, formats)
|
cli.Metadata = metadata.New(transport, formats)
|
||||||
return cli
|
return cli
|
||||||
}
|
}
|
||||||
@ -67,10 +69,10 @@ func DefaultTransportConfig() *TransportConfig {
|
|||||||
BasePath: DefaultBasePath,
|
BasePath: DefaultBasePath,
|
||||||
Schemes: DefaultSchemes,
|
Schemes: DefaultSchemes,
|
||||||
}
|
}
|
||||||
// TransportConfig contains the transport related info,
|
|
||||||
// found in the meta section of the spec file.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TransportConfig contains the transport related info,
|
||||||
|
// found in the meta section of the spec file.
|
||||||
type TransportConfig struct {
|
type TransportConfig struct {
|
||||||
Host string
|
Host string
|
||||||
BasePath string
|
BasePath string
|
||||||
@ -100,6 +102,8 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
|||||||
|
|
||||||
// Zrok is a client for zrok
|
// Zrok is a client for zrok
|
||||||
type Zrok struct {
|
type Zrok struct {
|
||||||
|
Identity identity.ClientService
|
||||||
|
|
||||||
Metadata metadata.ClientService
|
Metadata metadata.ClientService
|
||||||
|
|
||||||
Transport runtime.ClientTransport
|
Transport runtime.ClientTransport
|
||||||
@ -108,5 +112,6 @@ type Zrok struct {
|
|||||||
// SetTransport changes the transport on the client and all its subresources
|
// SetTransport changes the transport on the client and all its subresources
|
||||||
func (c *Zrok) SetTransport(transport runtime.ClientTransport) {
|
func (c *Zrok) SetTransport(transport runtime.ClientTransport) {
|
||||||
c.Transport = transport
|
c.Transport = transport
|
||||||
|
c.Identity.SetTransport(transport)
|
||||||
c.Metadata.SetTransport(transport)
|
c.Metadata.SetTransport(transport)
|
||||||
}
|
}
|
||||||
|
@ -48,15 +48,58 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/account": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"identity"
|
||||||
|
],
|
||||||
|
"operationId": "createAccount",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/accountRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "account created",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/accountResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"accountRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"username": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"accountResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"apiToken": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"version": {
|
"version": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"minLength": 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,15 +136,58 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/account": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"identity"
|
||||||
|
],
|
||||||
|
"operationId": "createAccount",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/accountRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "account created",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/accountResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"accountRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"username": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"accountResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"apiToken": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"version": {
|
"version": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"minLength": 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
56
rest_zrok_server/operations/identity/create_account.go
Normal file
56
rest_zrok_server/operations/identity/create_account.go
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateAccountHandlerFunc turns a function with the right signature into a create account handler
|
||||||
|
type CreateAccountHandlerFunc func(CreateAccountParams) middleware.Responder
|
||||||
|
|
||||||
|
// Handle executing the request and returning a response
|
||||||
|
func (fn CreateAccountHandlerFunc) Handle(params CreateAccountParams) middleware.Responder {
|
||||||
|
return fn(params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateAccountHandler interface for that can handle valid create account params
|
||||||
|
type CreateAccountHandler interface {
|
||||||
|
Handle(CreateAccountParams) middleware.Responder
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCreateAccount creates a new http.Handler for the create account operation
|
||||||
|
func NewCreateAccount(ctx *middleware.Context, handler CreateAccountHandler) *CreateAccount {
|
||||||
|
return &CreateAccount{Context: ctx, Handler: handler}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CreateAccount swagger:route POST /account identity createAccount
|
||||||
|
|
||||||
|
CreateAccount create account API
|
||||||
|
|
||||||
|
*/
|
||||||
|
type CreateAccount struct {
|
||||||
|
Context *middleware.Context
|
||||||
|
Handler CreateAccountHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *CreateAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
|
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||||
|
if rCtx != nil {
|
||||||
|
*r = *rCtx
|
||||||
|
}
|
||||||
|
var Params = NewCreateAccountParams()
|
||||||
|
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) // actually handle the request
|
||||||
|
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
// 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"
|
||||||
|
|
||||||
|
"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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewCreateAccountParams creates a new CreateAccountParams object
|
||||||
|
//
|
||||||
|
// There are no default values defined in the spec.
|
||||||
|
func NewCreateAccountParams() CreateAccountParams {
|
||||||
|
|
||||||
|
return CreateAccountParams{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateAccountParams contains all the bound params for the create account operation
|
||||||
|
// typically these are obtained from a http.Request
|
||||||
|
//
|
||||||
|
// swagger:parameters createAccount
|
||||||
|
type CreateAccountParams struct {
|
||||||
|
|
||||||
|
// HTTP Request Object
|
||||||
|
HTTPRequest *http.Request `json:"-"`
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: body
|
||||||
|
*/
|
||||||
|
Body *rest_model.AccountRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 NewCreateAccountParams() beforehand.
|
||||||
|
func (o *CreateAccountParams) 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.AccountRequest
|
||||||
|
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(context.Background())
|
||||||
|
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
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateAccountCreatedCode is the HTTP code returned for type CreateAccountCreated
|
||||||
|
const CreateAccountCreatedCode int = 201
|
||||||
|
|
||||||
|
/*CreateAccountCreated account created
|
||||||
|
|
||||||
|
swagger:response createAccountCreated
|
||||||
|
*/
|
||||||
|
type CreateAccountCreated struct {
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: Body
|
||||||
|
*/
|
||||||
|
Payload *rest_model.AccountResponse `json:"body,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCreateAccountCreated creates CreateAccountCreated with default headers values
|
||||||
|
func NewCreateAccountCreated() *CreateAccountCreated {
|
||||||
|
|
||||||
|
return &CreateAccountCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPayload adds the payload to the create account created response
|
||||||
|
func (o *CreateAccountCreated) WithPayload(payload *rest_model.AccountResponse) *CreateAccountCreated {
|
||||||
|
o.Payload = payload
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPayload sets the payload to the create account created response
|
||||||
|
func (o *CreateAccountCreated) SetPayload(payload *rest_model.AccountResponse) {
|
||||||
|
o.Payload = payload
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *CreateAccountCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||||
|
|
||||||
|
rw.WriteHeader(201)
|
||||||
|
if o.Payload != nil {
|
||||||
|
payload := o.Payload
|
||||||
|
if err := producer.Produce(rw, payload); err != nil {
|
||||||
|
panic(err) // let the recovery middleware deal with this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateAccountURL generates an URL for the create account operation
|
||||||
|
type CreateAccountURL 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 *CreateAccountURL) WithBasePath(bp string) *CreateAccountURL {
|
||||||
|
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 *CreateAccountURL) SetBasePath(bp string) {
|
||||||
|
o._basePath = bp
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build a url path and query string
|
||||||
|
func (o *CreateAccountURL) Build() (*url.URL, error) {
|
||||||
|
var _result url.URL
|
||||||
|
|
||||||
|
var _path = "/account"
|
||||||
|
|
||||||
|
_basePath := o._basePath
|
||||||
|
_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 *CreateAccountURL) 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 *CreateAccountURL) String() string {
|
||||||
|
return o.Must(o.Build()).String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildFull builds a full url with scheme, host, path and query string
|
||||||
|
func (o *CreateAccountURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||||
|
if scheme == "" {
|
||||||
|
return nil, errors.New("scheme is required for a full url on CreateAccountURL")
|
||||||
|
}
|
||||||
|
if host == "" {
|
||||||
|
return nil, errors.New("host is required for a full url on CreateAccountURL")
|
||||||
|
}
|
||||||
|
|
||||||
|
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 *CreateAccountURL) StringFull(scheme, host string) string {
|
||||||
|
return o.Must(o.BuildFull(scheme, host)).String()
|
||||||
|
}
|
@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
"github.com/go-openapi/swag"
|
"github.com/go-openapi/swag"
|
||||||
|
|
||||||
|
"github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations/identity"
|
||||||
"github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations/metadata"
|
"github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations/metadata"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -47,6 +48,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
|||||||
MetadataGetHandler: metadata.GetHandlerFunc(func(params metadata.GetParams) middleware.Responder {
|
MetadataGetHandler: metadata.GetHandlerFunc(func(params metadata.GetParams) middleware.Responder {
|
||||||
return middleware.NotImplemented("operation metadata.Get has not yet been implemented")
|
return middleware.NotImplemented("operation metadata.Get has not yet been implemented")
|
||||||
}),
|
}),
|
||||||
|
IdentityCreateAccountHandler: identity.CreateAccountHandlerFunc(func(params identity.CreateAccountParams) middleware.Responder {
|
||||||
|
return middleware.NotImplemented("operation identity.CreateAccount has not yet been implemented")
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +89,8 @@ type ZrokAPI struct {
|
|||||||
|
|
||||||
// MetadataGetHandler sets the operation handler for the get operation
|
// MetadataGetHandler sets the operation handler for the get operation
|
||||||
MetadataGetHandler metadata.GetHandler
|
MetadataGetHandler metadata.GetHandler
|
||||||
|
// IdentityCreateAccountHandler sets the operation handler for the create account operation
|
||||||
|
IdentityCreateAccountHandler identity.CreateAccountHandler
|
||||||
|
|
||||||
// ServeError is called when an error is received, there is a default handler
|
// ServeError is called when an error is received, there is a default handler
|
||||||
// but you can set your own with this
|
// but you can set your own with this
|
||||||
@ -165,6 +171,9 @@ func (o *ZrokAPI) Validate() error {
|
|||||||
if o.MetadataGetHandler == nil {
|
if o.MetadataGetHandler == nil {
|
||||||
unregistered = append(unregistered, "metadata.GetHandler")
|
unregistered = append(unregistered, "metadata.GetHandler")
|
||||||
}
|
}
|
||||||
|
if o.IdentityCreateAccountHandler == nil {
|
||||||
|
unregistered = append(unregistered, "identity.CreateAccountHandler")
|
||||||
|
}
|
||||||
|
|
||||||
if len(unregistered) > 0 {
|
if len(unregistered) > 0 {
|
||||||
return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
|
return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
|
||||||
@ -257,6 +266,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
|||||||
o.handlers["GET"] = make(map[string]http.Handler)
|
o.handlers["GET"] = make(map[string]http.Handler)
|
||||||
}
|
}
|
||||||
o.handlers["GET"][""] = metadata.NewGet(o.context, o.MetadataGetHandler)
|
o.handlers["GET"][""] = metadata.NewGet(o.context, o.MetadataGetHandler)
|
||||||
|
if o.handlers["POST"] == nil {
|
||||||
|
o.handlers["POST"] = make(map[string]http.Handler)
|
||||||
|
}
|
||||||
|
o.handlers["POST"]["/account"] = identity.NewCreateAccount(o.context, o.IdentityCreateAccountHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serve creates a http handler to serve the API over HTTP
|
// Serve creates a http handler to serve the API over HTTP
|
||||||
|
@ -2,6 +2,7 @@ info:
|
|||||||
description: zrok client access
|
description: zrok client access
|
||||||
title: zrok
|
title: zrok
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
/:
|
/:
|
||||||
get:
|
get:
|
||||||
@ -12,13 +13,41 @@ paths:
|
|||||||
description: retrieve the current server version
|
description: retrieve the current server version
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/version"
|
$ref: "#/definitions/version"
|
||||||
|
/account:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- identity
|
||||||
|
operationId: createAccount
|
||||||
|
parameters:
|
||||||
|
- name: body
|
||||||
|
in: body
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/accountRequest"
|
||||||
|
responses:
|
||||||
|
201:
|
||||||
|
description: account created
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/accountResponse"
|
||||||
|
|
||||||
definitions:
|
definitions:
|
||||||
version:
|
version:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
version:
|
version:
|
||||||
type: string
|
type: string
|
||||||
minLength: 1
|
accountRequest:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
accountResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
apiToken:
|
||||||
|
type: string
|
||||||
|
|
||||||
produces:
|
produces:
|
||||||
- application/zrok.v1+json
|
- application/zrok.v1+json
|
||||||
consumes:
|
consumes:
|
||||||
|
Loading…
Reference in New Issue
Block a user