/account delete endpoint (#591)

This commit is contained in:
Michael Quigley
2025-06-24 16:58:24 -04:00
parent eafaf56f13
commit 59e73e8d6b
16 changed files with 1419 additions and 0 deletions

View File

@@ -42,6 +42,8 @@ type ClientService interface {
CreateOrganization(params *CreateOrganizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrganizationCreated, error) CreateOrganization(params *CreateOrganizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrganizationCreated, error)
DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error)
DeleteFrontend(params *DeleteFrontendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteFrontendOK, error) DeleteFrontend(params *DeleteFrontendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteFrontendOK, error)
DeleteFrontendGrant(params *DeleteFrontendGrantParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteFrontendGrantOK, error) DeleteFrontendGrant(params *DeleteFrontendGrantParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteFrontendGrantOK, error)
@@ -299,6 +301,45 @@ func (a *Client) CreateOrganization(params *CreateOrganizationParams, authInfo r
panic(msg) panic(msg)
} }
/*
DeleteAccount delete account API
*/
func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAccountParams()
}
op := &runtime.ClientOperation{
ID: "deleteAccount",
Method: "DELETE",
PathPattern: "/account",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteAccountReader{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.(*DeleteAccountOK)
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 deleteAccount: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/* /*
DeleteFrontend delete frontend API DeleteFrontend delete frontend API
*/ */

View File

@@ -0,0 +1,146 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// 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"
)
// NewDeleteAccountParams creates a new DeleteAccountParams 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 NewDeleteAccountParams() *DeleteAccountParams {
return &DeleteAccountParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAccountParamsWithTimeout creates a new DeleteAccountParams object
// with the ability to set a timeout on a request.
func NewDeleteAccountParamsWithTimeout(timeout time.Duration) *DeleteAccountParams {
return &DeleteAccountParams{
timeout: timeout,
}
}
// NewDeleteAccountParamsWithContext creates a new DeleteAccountParams object
// with the ability to set a context for a request.
func NewDeleteAccountParamsWithContext(ctx context.Context) *DeleteAccountParams {
return &DeleteAccountParams{
Context: ctx,
}
}
// NewDeleteAccountParamsWithHTTPClient creates a new DeleteAccountParams object
// with the ability to set a custom HTTPClient for a request.
func NewDeleteAccountParamsWithHTTPClient(client *http.Client) *DeleteAccountParams {
return &DeleteAccountParams{
HTTPClient: client,
}
}
/*
DeleteAccountParams contains all the parameters to send to the API endpoint
for the delete account operation.
Typically these are written to a http.Request.
*/
type DeleteAccountParams struct {
// Body.
Body DeleteAccountBody
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the delete account params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAccountParams) WithDefaults() *DeleteAccountParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the delete account params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAccountParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete account params
func (o *DeleteAccountParams) WithTimeout(timeout time.Duration) *DeleteAccountParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete account params
func (o *DeleteAccountParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete account params
func (o *DeleteAccountParams) WithContext(ctx context.Context) *DeleteAccountParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete account params
func (o *DeleteAccountParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete account params
func (o *DeleteAccountParams) WithHTTPClient(client *http.Client) *DeleteAccountParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete account params
func (o *DeleteAccountParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the delete account params
func (o *DeleteAccountParams) WithBody(body DeleteAccountBody) *DeleteAccountParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the delete account params
func (o *DeleteAccountParams) SetBody(body DeleteAccountBody) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
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,314 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// DeleteAccountReader is a Reader for the DeleteAccount structure.
type DeleteAccountReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteAccountOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewDeleteAccountUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewDeleteAccountNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewDeleteAccountInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[DELETE /account] deleteAccount", response, response.Code())
}
}
// NewDeleteAccountOK creates a DeleteAccountOK with default headers values
func NewDeleteAccountOK() *DeleteAccountOK {
return &DeleteAccountOK{}
}
/*
DeleteAccountOK describes a response with status code 200, with default header values.
ok
*/
type DeleteAccountOK struct {
}
// IsSuccess returns true when this delete account o k response has a 2xx status code
func (o *DeleteAccountOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this delete account o k response has a 3xx status code
func (o *DeleteAccountOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete account o k response has a 4xx status code
func (o *DeleteAccountOK) IsClientError() bool {
return false
}
// IsServerError returns true when this delete account o k response has a 5xx status code
func (o *DeleteAccountOK) IsServerError() bool {
return false
}
// IsCode returns true when this delete account o k response a status code equal to that given
func (o *DeleteAccountOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the delete account o k response
func (o *DeleteAccountOK) Code() int {
return 200
}
func (o *DeleteAccountOK) Error() string {
return fmt.Sprintf("[DELETE /account][%d] deleteAccountOK ", 200)
}
func (o *DeleteAccountOK) String() string {
return fmt.Sprintf("[DELETE /account][%d] deleteAccountOK ", 200)
}
func (o *DeleteAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteAccountUnauthorized creates a DeleteAccountUnauthorized with default headers values
func NewDeleteAccountUnauthorized() *DeleteAccountUnauthorized {
return &DeleteAccountUnauthorized{}
}
/*
DeleteAccountUnauthorized describes a response with status code 401, with default header values.
unauthorizer
*/
type DeleteAccountUnauthorized struct {
}
// IsSuccess returns true when this delete account unauthorized response has a 2xx status code
func (o *DeleteAccountUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this delete account unauthorized response has a 3xx status code
func (o *DeleteAccountUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete account unauthorized response has a 4xx status code
func (o *DeleteAccountUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this delete account unauthorized response has a 5xx status code
func (o *DeleteAccountUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this delete account unauthorized response a status code equal to that given
func (o *DeleteAccountUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the delete account unauthorized response
func (o *DeleteAccountUnauthorized) Code() int {
return 401
}
func (o *DeleteAccountUnauthorized) Error() string {
return fmt.Sprintf("[DELETE /account][%d] deleteAccountUnauthorized ", 401)
}
func (o *DeleteAccountUnauthorized) String() string {
return fmt.Sprintf("[DELETE /account][%d] deleteAccountUnauthorized ", 401)
}
func (o *DeleteAccountUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteAccountNotFound creates a DeleteAccountNotFound with default headers values
func NewDeleteAccountNotFound() *DeleteAccountNotFound {
return &DeleteAccountNotFound{}
}
/*
DeleteAccountNotFound describes a response with status code 404, with default header values.
not found
*/
type DeleteAccountNotFound struct {
}
// IsSuccess returns true when this delete account not found response has a 2xx status code
func (o *DeleteAccountNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this delete account not found response has a 3xx status code
func (o *DeleteAccountNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete account not found response has a 4xx status code
func (o *DeleteAccountNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this delete account not found response has a 5xx status code
func (o *DeleteAccountNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this delete account not found response a status code equal to that given
func (o *DeleteAccountNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the delete account not found response
func (o *DeleteAccountNotFound) Code() int {
return 404
}
func (o *DeleteAccountNotFound) Error() string {
return fmt.Sprintf("[DELETE /account][%d] deleteAccountNotFound ", 404)
}
func (o *DeleteAccountNotFound) String() string {
return fmt.Sprintf("[DELETE /account][%d] deleteAccountNotFound ", 404)
}
func (o *DeleteAccountNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteAccountInternalServerError creates a DeleteAccountInternalServerError with default headers values
func NewDeleteAccountInternalServerError() *DeleteAccountInternalServerError {
return &DeleteAccountInternalServerError{}
}
/*
DeleteAccountInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type DeleteAccountInternalServerError struct {
}
// IsSuccess returns true when this delete account internal server error response has a 2xx status code
func (o *DeleteAccountInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this delete account internal server error response has a 3xx status code
func (o *DeleteAccountInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete account internal server error response has a 4xx status code
func (o *DeleteAccountInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this delete account internal server error response has a 5xx status code
func (o *DeleteAccountInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this delete account internal server error response a status code equal to that given
func (o *DeleteAccountInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the delete account internal server error response
func (o *DeleteAccountInternalServerError) Code() int {
return 500
}
func (o *DeleteAccountInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /account][%d] deleteAccountInternalServerError ", 500)
}
func (o *DeleteAccountInternalServerError) String() string {
return fmt.Sprintf("[DELETE /account][%d] deleteAccountInternalServerError ", 500)
}
func (o *DeleteAccountInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
/*
DeleteAccountBody delete account body
swagger:model DeleteAccountBody
*/
type DeleteAccountBody struct {
// email
Email string `json:"email,omitempty"`
}
// Validate validates this delete account body
func (o *DeleteAccountBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this delete account body based on context it is used
func (o *DeleteAccountBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *DeleteAccountBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *DeleteAccountBody) UnmarshalBinary(b []byte) error {
var res DeleteAccountBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -183,6 +183,44 @@ func init() {
"description": "internal server error" "description": "internal server error"
} }
} }
},
"delete": {
"security": [
{
"key": []
}
],
"tags": [
"admin"
],
"operationId": "deleteAccount",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
"properties": {
"email": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "ok"
},
"401": {
"description": "unauthorizer"
},
"404": {
"description": "not found"
},
"500": {
"description": "internal server error"
}
}
} }
}, },
"/agent/access": { "/agent/access": {
@@ -3090,6 +3128,44 @@ func init() {
"description": "internal server error" "description": "internal server error"
} }
} }
},
"delete": {
"security": [
{
"key": []
}
],
"tags": [
"admin"
],
"operationId": "deleteAccount",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
"properties": {
"email": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "ok"
},
"401": {
"description": "unauthorizer"
},
"404": {
"description": "not found"
},
"500": {
"description": "internal server error"
}
}
} }
}, },
"/agent/access": { "/agent/access": {

View File

@@ -0,0 +1,111 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"context"
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/openziti/zrok/rest_model_zrok"
)
// DeleteAccountHandlerFunc turns a function with the right signature into a delete account handler
type DeleteAccountHandlerFunc func(DeleteAccountParams, *rest_model_zrok.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteAccountHandlerFunc) Handle(params DeleteAccountParams, principal *rest_model_zrok.Principal) middleware.Responder {
return fn(params, principal)
}
// DeleteAccountHandler interface for that can handle valid delete account params
type DeleteAccountHandler interface {
Handle(DeleteAccountParams, *rest_model_zrok.Principal) middleware.Responder
}
// NewDeleteAccount creates a new http.Handler for the delete account operation
func NewDeleteAccount(ctx *middleware.Context, handler DeleteAccountHandler) *DeleteAccount {
return &DeleteAccount{Context: ctx, Handler: handler}
}
/*
DeleteAccount swagger:route DELETE /account admin deleteAccount
DeleteAccount delete account API
*/
type DeleteAccount struct {
Context *middleware.Context
Handler DeleteAccountHandler
}
func (o *DeleteAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewDeleteAccountParams()
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)
}
// DeleteAccountBody delete account body
//
// swagger:model DeleteAccountBody
type DeleteAccountBody struct {
// email
Email string `json:"email,omitempty"`
}
// Validate validates this delete account body
func (o *DeleteAccountBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this delete account body based on context it is used
func (o *DeleteAccountBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *DeleteAccountBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *DeleteAccountBody) UnmarshalBinary(b []byte) error {
var res DeleteAccountBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@@ -0,0 +1,74 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// 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"
)
// NewDeleteAccountParams creates a new DeleteAccountParams object
//
// There are no default values defined in the spec.
func NewDeleteAccountParams() DeleteAccountParams {
return DeleteAccountParams{}
}
// DeleteAccountParams contains all the bound params for the delete account operation
// typically these are obtained from a http.Request
//
// swagger:parameters deleteAccount
type DeleteAccountParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
In: body
*/
Body DeleteAccountBody
}
// 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 NewDeleteAccountParams() beforehand.
func (o *DeleteAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body DeleteAccountBody
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,112 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// 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"
)
// DeleteAccountOKCode is the HTTP code returned for type DeleteAccountOK
const DeleteAccountOKCode int = 200
/*
DeleteAccountOK ok
swagger:response deleteAccountOK
*/
type DeleteAccountOK struct {
}
// NewDeleteAccountOK creates DeleteAccountOK with default headers values
func NewDeleteAccountOK() *DeleteAccountOK {
return &DeleteAccountOK{}
}
// WriteResponse to the client
func (o *DeleteAccountOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(200)
}
// DeleteAccountUnauthorizedCode is the HTTP code returned for type DeleteAccountUnauthorized
const DeleteAccountUnauthorizedCode int = 401
/*
DeleteAccountUnauthorized unauthorizer
swagger:response deleteAccountUnauthorized
*/
type DeleteAccountUnauthorized struct {
}
// NewDeleteAccountUnauthorized creates DeleteAccountUnauthorized with default headers values
func NewDeleteAccountUnauthorized() *DeleteAccountUnauthorized {
return &DeleteAccountUnauthorized{}
}
// WriteResponse to the client
func (o *DeleteAccountUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(401)
}
// DeleteAccountNotFoundCode is the HTTP code returned for type DeleteAccountNotFound
const DeleteAccountNotFoundCode int = 404
/*
DeleteAccountNotFound not found
swagger:response deleteAccountNotFound
*/
type DeleteAccountNotFound struct {
}
// NewDeleteAccountNotFound creates DeleteAccountNotFound with default headers values
func NewDeleteAccountNotFound() *DeleteAccountNotFound {
return &DeleteAccountNotFound{}
}
// WriteResponse to the client
func (o *DeleteAccountNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(404)
}
// DeleteAccountInternalServerErrorCode is the HTTP code returned for type DeleteAccountInternalServerError
const DeleteAccountInternalServerErrorCode int = 500
/*
DeleteAccountInternalServerError internal server error
swagger:response deleteAccountInternalServerError
*/
type DeleteAccountInternalServerError struct {
}
// NewDeleteAccountInternalServerError creates DeleteAccountInternalServerError with default headers values
func NewDeleteAccountInternalServerError() *DeleteAccountInternalServerError {
return &DeleteAccountInternalServerError{}
}
// WriteResponse to the client
func (o *DeleteAccountInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(500)
}

View File

@@ -0,0 +1,87 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// 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"
)
// DeleteAccountURL generates an URL for the delete account operation
type DeleteAccountURL 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 *DeleteAccountURL) WithBasePath(bp string) *DeleteAccountURL {
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 *DeleteAccountURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *DeleteAccountURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/account"
_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 *DeleteAccountURL) 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 *DeleteAccountURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *DeleteAccountURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on DeleteAccountURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on DeleteAccountURL")
}
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 *DeleteAccountURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -80,6 +80,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
AdminCreateOrganizationHandler: admin.CreateOrganizationHandlerFunc(func(params admin.CreateOrganizationParams, principal *rest_model_zrok.Principal) middleware.Responder { AdminCreateOrganizationHandler: admin.CreateOrganizationHandlerFunc(func(params admin.CreateOrganizationParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation admin.CreateOrganization has not yet been implemented") return middleware.NotImplemented("operation admin.CreateOrganization has not yet been implemented")
}), }),
AdminDeleteAccountHandler: admin.DeleteAccountHandlerFunc(func(params admin.DeleteAccountParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation admin.DeleteAccount has not yet been implemented")
}),
AdminDeleteFrontendHandler: admin.DeleteFrontendHandlerFunc(func(params admin.DeleteFrontendParams, principal *rest_model_zrok.Principal) middleware.Responder { AdminDeleteFrontendHandler: admin.DeleteFrontendHandlerFunc(func(params admin.DeleteFrontendParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation admin.DeleteFrontend has not yet been implemented") return middleware.NotImplemented("operation admin.DeleteFrontend has not yet been implemented")
}), }),
@@ -288,6 +291,8 @@ type ZrokAPI struct {
AdminCreateIdentityHandler admin.CreateIdentityHandler AdminCreateIdentityHandler admin.CreateIdentityHandler
// AdminCreateOrganizationHandler sets the operation handler for the create organization operation // AdminCreateOrganizationHandler sets the operation handler for the create organization operation
AdminCreateOrganizationHandler admin.CreateOrganizationHandler AdminCreateOrganizationHandler admin.CreateOrganizationHandler
// AdminDeleteAccountHandler sets the operation handler for the delete account operation
AdminDeleteAccountHandler admin.DeleteAccountHandler
// AdminDeleteFrontendHandler sets the operation handler for the delete frontend operation // AdminDeleteFrontendHandler sets the operation handler for the delete frontend operation
AdminDeleteFrontendHandler admin.DeleteFrontendHandler AdminDeleteFrontendHandler admin.DeleteFrontendHandler
// AdminDeleteFrontendGrantHandler sets the operation handler for the delete frontend grant operation // AdminDeleteFrontendGrantHandler sets the operation handler for the delete frontend grant operation
@@ -491,6 +496,9 @@ func (o *ZrokAPI) Validate() error {
if o.AdminCreateOrganizationHandler == nil { if o.AdminCreateOrganizationHandler == nil {
unregistered = append(unregistered, "admin.CreateOrganizationHandler") unregistered = append(unregistered, "admin.CreateOrganizationHandler")
} }
if o.AdminDeleteAccountHandler == nil {
unregistered = append(unregistered, "admin.DeleteAccountHandler")
}
if o.AdminDeleteFrontendHandler == nil { if o.AdminDeleteFrontendHandler == nil {
unregistered = append(unregistered, "admin.DeleteFrontendHandler") unregistered = append(unregistered, "admin.DeleteFrontendHandler")
} }
@@ -771,6 +779,10 @@ func (o *ZrokAPI) initHandlerCache() {
if o.handlers["DELETE"] == nil { if o.handlers["DELETE"] == nil {
o.handlers["DELETE"] = make(map[string]http.Handler) o.handlers["DELETE"] = make(map[string]http.Handler)
} }
o.handlers["DELETE"]["/account"] = admin.NewDeleteAccount(o.context, o.AdminDeleteAccountHandler)
if o.handlers["DELETE"] == nil {
o.handlers["DELETE"] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/frontend"] = admin.NewDeleteFrontend(o.context, o.AdminDeleteFrontendHandler) o.handlers["DELETE"]["/frontend"] = admin.NewDeleteFrontend(o.context, o.AdminDeleteFrontendHandler)
if o.handlers["DELETE"] == nil { if o.handlers["DELETE"] == nil {
o.handlers["DELETE"] = make(map[string]http.Handler) o.handlers["DELETE"] = make(map[string]http.Handler)

View File

@@ -94,6 +94,10 @@ export interface CreateOrganizationOperationRequest {
body?: CreateOrganizationRequest; body?: CreateOrganizationRequest;
} }
export interface DeleteAccountRequest {
body?: Verify200Response;
}
export interface DeleteFrontendRequest { export interface DeleteFrontendRequest {
body?: CreateFrontend201Response; body?: CreateFrontend201Response;
} }
@@ -315,6 +319,36 @@ export class AdminApi extends runtime.BaseAPI {
return await response.value(); return await response.value();
} }
/**
*/
async deleteAccountRaw(requestParameters: DeleteAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/zrok.v1+json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-token"] = await this.configuration.apiKey("x-token"); // key authentication
}
const response = await this.request({
path: `/account`,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
body: Verify200ResponseToJSON(requestParameters['body']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
*/
async deleteAccount(requestParameters: DeleteAccountRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.deleteAccountRaw(requestParameters, initOverrides);
}
/** /**
*/ */
async deleteFrontendRaw(requestParameters: DeleteFrontendRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { async deleteFrontendRaw(requestParameters: DeleteFrontendRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {

View File

@@ -106,6 +106,7 @@ Class | Method | HTTP request | Description
*AdminApi* | [**create_frontend**](docs/AdminApi.md#create_frontend) | **POST** /frontend | *AdminApi* | [**create_frontend**](docs/AdminApi.md#create_frontend) | **POST** /frontend |
*AdminApi* | [**create_identity**](docs/AdminApi.md#create_identity) | **POST** /identity | *AdminApi* | [**create_identity**](docs/AdminApi.md#create_identity) | **POST** /identity |
*AdminApi* | [**create_organization**](docs/AdminApi.md#create_organization) | **POST** /organization | *AdminApi* | [**create_organization**](docs/AdminApi.md#create_organization) | **POST** /organization |
*AdminApi* | [**delete_account**](docs/AdminApi.md#delete_account) | **DELETE** /account |
*AdminApi* | [**delete_frontend**](docs/AdminApi.md#delete_frontend) | **DELETE** /frontend | *AdminApi* | [**delete_frontend**](docs/AdminApi.md#delete_frontend) | **DELETE** /frontend |
*AdminApi* | [**delete_frontend_grant**](docs/AdminApi.md#delete_frontend_grant) | **DELETE** /frontend/grant | *AdminApi* | [**delete_frontend_grant**](docs/AdminApi.md#delete_frontend_grant) | **DELETE** /frontend/grant |
*AdminApi* | [**delete_organization**](docs/AdminApi.md#delete_organization) | **DELETE** /organization | *AdminApi* | [**delete_organization**](docs/AdminApi.md#delete_organization) | **DELETE** /organization |

View File

@@ -10,6 +10,7 @@ Method | HTTP request | Description
[**create_frontend**](AdminApi.md#create_frontend) | **POST** /frontend | [**create_frontend**](AdminApi.md#create_frontend) | **POST** /frontend |
[**create_identity**](AdminApi.md#create_identity) | **POST** /identity | [**create_identity**](AdminApi.md#create_identity) | **POST** /identity |
[**create_organization**](AdminApi.md#create_organization) | **POST** /organization | [**create_organization**](AdminApi.md#create_organization) | **POST** /organization |
[**delete_account**](AdminApi.md#delete_account) | **DELETE** /account |
[**delete_frontend**](AdminApi.md#delete_frontend) | **DELETE** /frontend | [**delete_frontend**](AdminApi.md#delete_frontend) | **DELETE** /frontend |
[**delete_frontend_grant**](AdminApi.md#delete_frontend_grant) | **DELETE** /frontend/grant | [**delete_frontend_grant**](AdminApi.md#delete_frontend_grant) | **DELETE** /frontend/grant |
[**delete_organization**](AdminApi.md#delete_organization) | **DELETE** /organization | [**delete_organization**](AdminApi.md#delete_organization) | **DELETE** /organization |
@@ -481,6 +482,81 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **delete_account**
> delete_account(body=body)
### Example
* Api Key Authentication (key):
```python
import zrok_api
from zrok_api.models.verify200_response import Verify200Response
from zrok_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to /api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = zrok_api.Configuration(
host = "/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: key
configuration.api_key['key'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['key'] = 'Bearer'
# Enter a context with an instance of the API client
with zrok_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = zrok_api.AdminApi(api_client)
body = zrok_api.Verify200Response() # Verify200Response | (optional)
try:
api_instance.delete_account(body=body)
except Exception as e:
print("Exception when calling AdminApi->delete_account: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Verify200Response**](Verify200Response.md)| | [optional]
### Return type
void (empty response body)
### Authorization
[key](../README.md#key)
### HTTP request headers
- **Content-Type**: application/zrok.v1+json
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | ok | - |
**401** | unauthorizer | - |
**404** | not found | - |
**500** | internal server error | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **delete_frontend** # **delete_frontend**
> delete_frontend(body=body) > delete_frontend(body=body)

View File

@@ -62,6 +62,12 @@ class TestAdminApi(unittest.TestCase):
""" """
pass pass
def test_delete_account(self) -> None:
"""Test case for delete_account
"""
pass
def test_delete_frontend(self) -> None: def test_delete_frontend(self) -> None:
"""Test case for delete_frontend """Test case for delete_frontend

View File

@@ -1710,6 +1710,279 @@ class AdminApi:
@validate_call
def delete_account(
self,
body: Optional[Verify200Response] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> None:
"""delete_account
:param body:
:type body: Verify200Response
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._delete_account_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'401': None,
'404': None,
'500': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def delete_account_with_http_info(
self,
body: Optional[Verify200Response] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[None]:
"""delete_account
:param body:
:type body: Verify200Response
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._delete_account_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'401': None,
'404': None,
'500': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def delete_account_without_preload_content(
self,
body: Optional[Verify200Response] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""delete_account
:param body:
:type body: Verify200Response
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._delete_account_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': None,
'401': None,
'404': None,
'500': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _delete_account_serialize(
self,
body,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
if body is not None:
_body_params = body
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/zrok.v1+json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'key'
]
return self.api_client.param_serialize(
method='DELETE',
resource_path='/account',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call @validate_call
def delete_frontend( def delete_frontend(
self, self,

View File

@@ -251,6 +251,28 @@ paths:
description: unauthorized description: unauthorized
500: 500:
description: internal server error description: internal server error
delete:
tags:
- admin
security:
- key: []
operationId: deleteAccount
parameters:
- name: body
in: body
schema:
properties:
email:
type: string
responses:
200:
description: ok
401:
description: unauthorizer
404:
description: not found
500:
description: internal server error
/frontend: /frontend:
post: post:

View File

@@ -94,6 +94,10 @@ export interface CreateOrganizationOperationRequest {
body?: CreateOrganizationRequest; body?: CreateOrganizationRequest;
} }
export interface DeleteAccountRequest {
body?: Verify200Response;
}
export interface DeleteFrontendRequest { export interface DeleteFrontendRequest {
body?: CreateFrontend201Response; body?: CreateFrontend201Response;
} }
@@ -315,6 +319,36 @@ export class AdminApi extends runtime.BaseAPI {
return await response.value(); return await response.value();
} }
/**
*/
async deleteAccountRaw(requestParameters: DeleteAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/zrok.v1+json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-token"] = await this.configuration.apiKey("x-token"); // key authentication
}
const response = await this.request({
path: `/account`,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
body: Verify200ResponseToJSON(requestParameters['body']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
*/
async deleteAccount(requestParameters: DeleteAccountRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.deleteAccountRaw(requestParameters, initOverrides);
}
/** /**
*/ */
async deleteFrontendRaw(requestParameters: DeleteFrontendRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { async deleteFrontendRaw(requestParameters: DeleteFrontendRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {