Merge pull request #997 from openziti/frontends_for_account

List Public Frontends for Account (#996)
This commit is contained in:
Michael Quigley 2025-06-27 21:08:40 +00:00 committed by GitHub
commit 917426880b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 2369 additions and 4 deletions

View File

@ -6,6 +6,8 @@ FEATURE: New add and delete API endpoints for frontend grants. New `zrok admin c
FEATURE: New admin endpoint for deleting accounts. New `zrok admin delete account` CLI for invoking the API endpoint from the command line (https://github.com/openziti/zrok/issues/993)
FEATURE: New API endpoint (`/overview/public-frontends`) that returns the public frontends available to authenticated account. The public frontends include those marked with the `open` permission mode, and those marked `closed` where the user has a frontend grant allowing them to access the frontend. New CLI command `zrok overview public-frontends` to allow end users to list the public frontends their account can use (https://github.com/openziti/zrok/issues/996)
## v1.0.6
CHANGE: The `/overview` endpoint has been adjusted to include a new `remoteAgent` `boolean` on the `environment` instances, indicating whether or not the environment has an enrolled remote agent (https://github.com/openziti/zrok/issues/977)

View File

@ -2,12 +2,13 @@ package main
import (
"fmt"
"os"
httptransport "github.com/go-openapi/runtime/client"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/openziti/zrok/environment"
"github.com/openziti/zrok/tui"
"github.com/spf13/cobra"
"os"
)
func init() {
@ -45,7 +46,7 @@ func (c *orgMembershipsCommand) run(_ *cobra.Command, _ []string) {
zrok, err := root.Client()
if err != nil {
if !panicInstead {
tui.Error("error loading zrokdir", err)
tui.Error("error getting zrok client", err)
}
panic(err)
}

View File

@ -2,14 +2,18 @@ package main
import (
"fmt"
"github.com/openziti/zrok/environment"
"github.com/openziti/zrok/sdk/golang/sdk"
"github.com/openziti/zrok/tui"
"github.com/spf13/cobra"
)
var overviewCmd *cobra.Command
func init() {
rootCmd.AddCommand(newOverviewCommand().cmd)
overviewCmd = newOverviewCommand().cmd
rootCmd.AddCommand(overviewCmd)
}
type overviewCommand struct {

View File

@ -0,0 +1,78 @@
package main
import (
"fmt"
"os"
httptransport "github.com/go-openapi/runtime/client"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/openziti/zrok/environment"
"github.com/openziti/zrok/tui"
"github.com/spf13/cobra"
)
func init() {
overviewCmd.AddCommand(newOverviewFrontendsCommand().cmd)
}
type overviewPublicFrontendsCommand struct {
cmd *cobra.Command
}
func newOverviewFrontendsCommand() *overviewPublicFrontendsCommand {
cmd := &cobra.Command{
Use: "public-frontends",
Short: "Show the available public frontends",
Aliases: []string{"pf"},
Args: cobra.NoArgs,
}
command := &overviewPublicFrontendsCommand{cmd: cmd}
cmd.Run = command.run
return command
}
func (cmd *overviewPublicFrontendsCommand) run(_ *cobra.Command, _ []string) {
root, err := environment.LoadRoot()
if err != nil {
if !panicInstead {
tui.Error("error loading zrokdir", err)
}
panic(err)
}
if !root.IsEnabled() {
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
}
zrok, err := root.Client()
if err != nil {
if !panicInstead {
tui.Error("error getting zrok client", err)
}
panic(err)
}
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
resp, err := zrok.Metadata.ListPublicFrontendsForAccount(nil, auth)
if err != nil {
if !panicInstead {
tui.Error("error listing public frontends", err)
}
panic(err)
}
if len(resp.Payload.PublicFrontends) > 0 {
fmt.Println()
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
t.SetStyle(table.StyleColoredDark)
t.AppendHeader(table.Row{"Frontend Name", "URL Template"})
for _, i := range resp.Payload.PublicFrontends {
t.AppendRow(table.Row{i.PublicName, i.URLTemplate})
}
t.Render()
fmt.Println()
} else {
fmt.Println("no public frontends found")
}
}

View File

@ -95,6 +95,7 @@ func Run(inCfg *config.Config) error {
api.MetadataGetShareDetailHandler = newShareDetailHandler()
api.MetadataListMembershipsHandler = newListMembershipsHandler()
api.MetadataListOrgMembersHandler = newListOrgMembersHandler()
api.MetadataListPublicFrontendsForAccountHandler = newListPublicFrontendsForAccountHandler()
api.MetadataOrgAccountOverviewHandler = newOrgAccountOverviewHandler()
api.MetadataOverviewHandler = newOverviewHandler()
api.MetadataVersionHandler = metadata.VersionHandlerFunc(versionHandler)

View File

@ -16,7 +16,7 @@ func newListMembershipsHandler() *listMembershipsHandler {
func (h *listMembershipsHandler) Handle(_ metadata.ListMembershipsParams, principal *rest_model_zrok.Principal) middleware.Responder {
trx, err := str.Begin()
if err != nil {
logrus.Errorf("error startin transaction: %v", err)
logrus.Errorf("error starting transaction: %v", err)
return metadata.NewListMembershipsInternalServerError()
}
defer func() { _ = trx.Rollback() }()

View File

@ -0,0 +1,52 @@
package controller
import (
"github.com/go-openapi/runtime/middleware"
"github.com/openziti/zrok/rest_model_zrok"
"github.com/openziti/zrok/rest_server_zrok/operations/metadata"
"github.com/sirupsen/logrus"
)
type listPublicFrontendsForAccountHandler struct{}
func newListPublicFrontendsForAccountHandler() *listPublicFrontendsForAccountHandler {
return &listPublicFrontendsForAccountHandler{}
}
func (h *listPublicFrontendsForAccountHandler) Handle(_ metadata.ListPublicFrontendsForAccountParams, principal *rest_model_zrok.Principal) middleware.Responder {
trx, err := str.Begin()
if err != nil {
logrus.Errorf("error starting transaction: %v", err)
return metadata.NewListPublicFrontendsForAccountInternalServerError()
}
defer trx.Rollback()
var publicFrontends []*metadata.ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0
openFes, err := str.FindOpenPublicFrontends(trx)
if err != nil {
logrus.Errorf("error finding open public frontends: %v", err)
return metadata.NewListPublicFrontendsForAccountInternalServerError()
}
for _, openFe := range openFes {
publicFrontends = append(publicFrontends, &metadata.ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0{
PublicName: *openFe.PublicName,
URLTemplate: *openFe.UrlTemplate,
})
}
closedFes, err := str.FindClosedPublicFrontendsGrantedToAccount(int(principal.ID), trx)
if err != nil {
logrus.Errorf("error finding closed public frontends: %v", err)
return metadata.NewListPublicFrontendsForAccountInternalServerError()
}
for _, closedFe := range closedFes {
publicFrontends = append(publicFrontends, &metadata.ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0{
PublicName: *closedFe.PublicName,
URLTemplate: *closedFe.UrlTemplate,
})
}
payload := &metadata.ListPublicFrontendsForAccountOKBody{PublicFrontends: publicFrontends}
return metadata.NewListPublicFrontendsForAccountOK().WithPayload(payload)
}

View File

@ -107,6 +107,46 @@ func (str *Store) FindPublicFrontends(tx *sqlx.Tx) ([]*Frontend, error) {
return frontends, nil
}
func (str *Store) FindOpenPublicFrontends(tx *sqlx.Tx) ([]*Frontend, error) {
rows, err := tx.Queryx("select frontends.* from frontends where environment_id is null and permission_mode = 'open' and reserved = true and not deleted")
if err != nil {
return nil, errors.Wrap(err, "error selecting open public frontends")
}
var frontends []*Frontend
for rows.Next() {
frontend := &Frontend{}
if err := rows.StructScan(frontend); err != nil {
return nil, errors.Wrap(err, "error scanning frontend")
}
frontends = append(frontends, frontend)
}
return frontends, nil
}
func (str *Store) FindClosedPublicFrontendsGrantedToAccount(accountId int, tx *sqlx.Tx) ([]*Frontend, error) {
rows, err := tx.Queryx(`
select frontends.* from frontends
inner join frontend_grants on frontends.id = frontend_grants.frontend_id
where frontend_grants.account_id = $1
and frontends.environment_id is null
and frontends.permission_mode = 'closed'
and frontends.reserved = true
and not frontends.deleted
and not frontend_grants.deleted`, accountId)
if err != nil {
return nil, errors.Wrap(err, "error selecting closed public frontends granted to account")
}
var frontends []*Frontend
for rows.Next() {
frontend := &Frontend{}
if err := rows.StructScan(frontend); err != nil {
return nil, errors.Wrap(err, "error scanning frontend")
}
frontends = append(frontends, frontend)
}
return frontends, nil
}
func (str *Store) FindFrontendsForPrivateShare(shrId int, tx *sqlx.Tx) ([]*Frontend, error) {
rows, err := tx.Queryx("select frontends.* from frontends where private_share_id = $1 and not deleted", shrId)
if err != nil {

View File

@ -0,0 +1,128 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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"
)
// NewListPublicFrontendsForAccountParams creates a new ListPublicFrontendsForAccountParams 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 NewListPublicFrontendsForAccountParams() *ListPublicFrontendsForAccountParams {
return &ListPublicFrontendsForAccountParams{
timeout: cr.DefaultTimeout,
}
}
// NewListPublicFrontendsForAccountParamsWithTimeout creates a new ListPublicFrontendsForAccountParams object
// with the ability to set a timeout on a request.
func NewListPublicFrontendsForAccountParamsWithTimeout(timeout time.Duration) *ListPublicFrontendsForAccountParams {
return &ListPublicFrontendsForAccountParams{
timeout: timeout,
}
}
// NewListPublicFrontendsForAccountParamsWithContext creates a new ListPublicFrontendsForAccountParams object
// with the ability to set a context for a request.
func NewListPublicFrontendsForAccountParamsWithContext(ctx context.Context) *ListPublicFrontendsForAccountParams {
return &ListPublicFrontendsForAccountParams{
Context: ctx,
}
}
// NewListPublicFrontendsForAccountParamsWithHTTPClient creates a new ListPublicFrontendsForAccountParams object
// with the ability to set a custom HTTPClient for a request.
func NewListPublicFrontendsForAccountParamsWithHTTPClient(client *http.Client) *ListPublicFrontendsForAccountParams {
return &ListPublicFrontendsForAccountParams{
HTTPClient: client,
}
}
/*
ListPublicFrontendsForAccountParams contains all the parameters to send to the API endpoint
for the list public frontends for account operation.
Typically these are written to a http.Request.
*/
type ListPublicFrontendsForAccountParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list public frontends for account params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListPublicFrontendsForAccountParams) WithDefaults() *ListPublicFrontendsForAccountParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list public frontends for account params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListPublicFrontendsForAccountParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list public frontends for account params
func (o *ListPublicFrontendsForAccountParams) WithTimeout(timeout time.Duration) *ListPublicFrontendsForAccountParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list public frontends for account params
func (o *ListPublicFrontendsForAccountParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list public frontends for account params
func (o *ListPublicFrontendsForAccountParams) WithContext(ctx context.Context) *ListPublicFrontendsForAccountParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list public frontends for account params
func (o *ListPublicFrontendsForAccountParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list public frontends for account params
func (o *ListPublicFrontendsForAccountParams) WithHTTPClient(client *http.Client) *ListPublicFrontendsForAccountParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list public frontends for account params
func (o *ListPublicFrontendsForAccountParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *ListPublicFrontendsForAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,377 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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"
"io"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// ListPublicFrontendsForAccountReader is a Reader for the ListPublicFrontendsForAccount structure.
type ListPublicFrontendsForAccountReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListPublicFrontendsForAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListPublicFrontendsForAccountOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewListPublicFrontendsForAccountUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewListPublicFrontendsForAccountInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /overview/public-frontends] listPublicFrontendsForAccount", response, response.Code())
}
}
// NewListPublicFrontendsForAccountOK creates a ListPublicFrontendsForAccountOK with default headers values
func NewListPublicFrontendsForAccountOK() *ListPublicFrontendsForAccountOK {
return &ListPublicFrontendsForAccountOK{}
}
/*
ListPublicFrontendsForAccountOK describes a response with status code 200, with default header values.
public frontends list returned
*/
type ListPublicFrontendsForAccountOK struct {
Payload *ListPublicFrontendsForAccountOKBody
}
// IsSuccess returns true when this list public frontends for account o k response has a 2xx status code
func (o *ListPublicFrontendsForAccountOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this list public frontends for account o k response has a 3xx status code
func (o *ListPublicFrontendsForAccountOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this list public frontends for account o k response has a 4xx status code
func (o *ListPublicFrontendsForAccountOK) IsClientError() bool {
return false
}
// IsServerError returns true when this list public frontends for account o k response has a 5xx status code
func (o *ListPublicFrontendsForAccountOK) IsServerError() bool {
return false
}
// IsCode returns true when this list public frontends for account o k response a status code equal to that given
func (o *ListPublicFrontendsForAccountOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the list public frontends for account o k response
func (o *ListPublicFrontendsForAccountOK) Code() int {
return 200
}
func (o *ListPublicFrontendsForAccountOK) Error() string {
return fmt.Sprintf("[GET /overview/public-frontends][%d] listPublicFrontendsForAccountOK %+v", 200, o.Payload)
}
func (o *ListPublicFrontendsForAccountOK) String() string {
return fmt.Sprintf("[GET /overview/public-frontends][%d] listPublicFrontendsForAccountOK %+v", 200, o.Payload)
}
func (o *ListPublicFrontendsForAccountOK) GetPayload() *ListPublicFrontendsForAccountOKBody {
return o.Payload
}
func (o *ListPublicFrontendsForAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(ListPublicFrontendsForAccountOKBody)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewListPublicFrontendsForAccountUnauthorized creates a ListPublicFrontendsForAccountUnauthorized with default headers values
func NewListPublicFrontendsForAccountUnauthorized() *ListPublicFrontendsForAccountUnauthorized {
return &ListPublicFrontendsForAccountUnauthorized{}
}
/*
ListPublicFrontendsForAccountUnauthorized describes a response with status code 401, with default header values.
unauthorized
*/
type ListPublicFrontendsForAccountUnauthorized struct {
}
// IsSuccess returns true when this list public frontends for account unauthorized response has a 2xx status code
func (o *ListPublicFrontendsForAccountUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list public frontends for account unauthorized response has a 3xx status code
func (o *ListPublicFrontendsForAccountUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this list public frontends for account unauthorized response has a 4xx status code
func (o *ListPublicFrontendsForAccountUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this list public frontends for account unauthorized response has a 5xx status code
func (o *ListPublicFrontendsForAccountUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this list public frontends for account unauthorized response a status code equal to that given
func (o *ListPublicFrontendsForAccountUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the list public frontends for account unauthorized response
func (o *ListPublicFrontendsForAccountUnauthorized) Code() int {
return 401
}
func (o *ListPublicFrontendsForAccountUnauthorized) Error() string {
return fmt.Sprintf("[GET /overview/public-frontends][%d] listPublicFrontendsForAccountUnauthorized ", 401)
}
func (o *ListPublicFrontendsForAccountUnauthorized) String() string {
return fmt.Sprintf("[GET /overview/public-frontends][%d] listPublicFrontendsForAccountUnauthorized ", 401)
}
func (o *ListPublicFrontendsForAccountUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewListPublicFrontendsForAccountInternalServerError creates a ListPublicFrontendsForAccountInternalServerError with default headers values
func NewListPublicFrontendsForAccountInternalServerError() *ListPublicFrontendsForAccountInternalServerError {
return &ListPublicFrontendsForAccountInternalServerError{}
}
/*
ListPublicFrontendsForAccountInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type ListPublicFrontendsForAccountInternalServerError struct {
}
// IsSuccess returns true when this list public frontends for account internal server error response has a 2xx status code
func (o *ListPublicFrontendsForAccountInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list public frontends for account internal server error response has a 3xx status code
func (o *ListPublicFrontendsForAccountInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this list public frontends for account internal server error response has a 4xx status code
func (o *ListPublicFrontendsForAccountInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this list public frontends for account internal server error response has a 5xx status code
func (o *ListPublicFrontendsForAccountInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this list public frontends for account internal server error response a status code equal to that given
func (o *ListPublicFrontendsForAccountInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the list public frontends for account internal server error response
func (o *ListPublicFrontendsForAccountInternalServerError) Code() int {
return 500
}
func (o *ListPublicFrontendsForAccountInternalServerError) Error() string {
return fmt.Sprintf("[GET /overview/public-frontends][%d] listPublicFrontendsForAccountInternalServerError ", 500)
}
func (o *ListPublicFrontendsForAccountInternalServerError) String() string {
return fmt.Sprintf("[GET /overview/public-frontends][%d] listPublicFrontendsForAccountInternalServerError ", 500)
}
func (o *ListPublicFrontendsForAccountInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
/*
ListPublicFrontendsForAccountOKBody list public frontends for account o k body
swagger:model ListPublicFrontendsForAccountOKBody
*/
type ListPublicFrontendsForAccountOKBody struct {
// public frontends
PublicFrontends []*ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0 `json:"publicFrontends"`
}
// Validate validates this list public frontends for account o k body
func (o *ListPublicFrontendsForAccountOKBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validatePublicFrontends(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ListPublicFrontendsForAccountOKBody) validatePublicFrontends(formats strfmt.Registry) error {
if swag.IsZero(o.PublicFrontends) { // not required
return nil
}
for i := 0; i < len(o.PublicFrontends); i++ {
if swag.IsZero(o.PublicFrontends[i]) { // not required
continue
}
if o.PublicFrontends[i] != nil {
if err := o.PublicFrontends[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("listPublicFrontendsForAccountOK" + "." + "publicFrontends" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("listPublicFrontendsForAccountOK" + "." + "publicFrontends" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this list public frontends for account o k body based on the context it is used
func (o *ListPublicFrontendsForAccountOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidatePublicFrontends(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ListPublicFrontendsForAccountOKBody) contextValidatePublicFrontends(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(o.PublicFrontends); i++ {
if o.PublicFrontends[i] != nil {
if swag.IsZero(o.PublicFrontends[i]) { // not required
return nil
}
if err := o.PublicFrontends[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("listPublicFrontendsForAccountOK" + "." + "publicFrontends" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("listPublicFrontendsForAccountOK" + "." + "publicFrontends" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ListPublicFrontendsForAccountOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ListPublicFrontendsForAccountOKBody) UnmarshalBinary(b []byte) error {
var res ListPublicFrontendsForAccountOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0 list public frontends for account o k body public frontends items0
swagger:model ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0
*/
type ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0 struct {
// public name
PublicName string `json:"publicName,omitempty"`
// url template
URLTemplate string `json:"urlTemplate,omitempty"`
}
// Validate validates this list public frontends for account o k body public frontends items0
func (o *ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this list public frontends for account o k body public frontends items0 based on context it is used
func (o *ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0) UnmarshalBinary(b []byte) error {
var res ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -54,6 +54,8 @@ type ClientService interface {
ListOrgMembers(params *ListOrgMembersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgMembersOK, error)
ListPublicFrontendsForAccount(params *ListPublicFrontendsForAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPublicFrontendsForAccountOK, error)
OrgAccountOverview(params *OrgAccountOverviewParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrgAccountOverviewOK, error)
Overview(params *OverviewParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OverviewOK, error)
@ -531,6 +533,45 @@ func (a *Client) ListOrgMembers(params *ListOrgMembersParams, authInfo runtime.C
panic(msg)
}
/*
ListPublicFrontendsForAccount list public frontends for account API
*/
func (a *Client) ListPublicFrontendsForAccount(params *ListPublicFrontendsForAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPublicFrontendsForAccountOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListPublicFrontendsForAccountParams()
}
op := &runtime.ClientOperation{
ID: "listPublicFrontendsForAccount",
Method: "GET",
PathPattern: "/overview/public-frontends",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &ListPublicFrontendsForAccountReader{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.(*ListPublicFrontendsForAccountOK)
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 listPublicFrontendsForAccount: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
OrgAccountOverview org account overview API
*/

View File

@ -2067,6 +2067,48 @@ func init() {
}
}
},
"/overview/public-frontends": {
"get": {
"security": [
{
"key": []
}
],
"tags": [
"metadata"
],
"operationId": "listPublicFrontendsForAccount",
"responses": {
"200": {
"description": "public frontends list returned",
"schema": {
"properties": {
"publicFrontends": {
"type": "array",
"items": {
"type": "object",
"properties": {
"publicName": {
"type": "string"
},
"urlTemplate": {
"type": "string"
}
}
}
}
}
}
},
"401": {
"description": "unauthorized"
},
"500": {
"description": "internal server error"
}
}
}
},
"/overview/{organizationToken}/{accountEmail}": {
"get": {
"security": [
@ -4927,6 +4969,40 @@ func init() {
}
}
},
"/overview/public-frontends": {
"get": {
"security": [
{
"key": []
}
],
"tags": [
"metadata"
],
"operationId": "listPublicFrontendsForAccount",
"responses": {
"200": {
"description": "public frontends list returned",
"schema": {
"properties": {
"publicFrontends": {
"type": "array",
"items": {
"$ref": "#/definitions/PublicFrontendsItems0"
}
}
}
}
},
"401": {
"description": "unauthorized"
},
"500": {
"description": "internal server error"
}
}
}
},
"/overview/{organizationToken}/{accountEmail}": {
"get": {
"security": [
@ -5544,6 +5620,17 @@ func init() {
}
}
},
"PublicFrontendsItems0": {
"type": "object",
"properties": {
"publicName": {
"type": "string"
},
"urlTemplate": {
"type": "string"
}
}
},
"SharesItems0": {
"type": "object",
"properties": {

View File

@ -0,0 +1,222 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/openziti/zrok/rest_model_zrok"
)
// ListPublicFrontendsForAccountHandlerFunc turns a function with the right signature into a list public frontends for account handler
type ListPublicFrontendsForAccountHandlerFunc func(ListPublicFrontendsForAccountParams, *rest_model_zrok.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn ListPublicFrontendsForAccountHandlerFunc) Handle(params ListPublicFrontendsForAccountParams, principal *rest_model_zrok.Principal) middleware.Responder {
return fn(params, principal)
}
// ListPublicFrontendsForAccountHandler interface for that can handle valid list public frontends for account params
type ListPublicFrontendsForAccountHandler interface {
Handle(ListPublicFrontendsForAccountParams, *rest_model_zrok.Principal) middleware.Responder
}
// NewListPublicFrontendsForAccount creates a new http.Handler for the list public frontends for account operation
func NewListPublicFrontendsForAccount(ctx *middleware.Context, handler ListPublicFrontendsForAccountHandler) *ListPublicFrontendsForAccount {
return &ListPublicFrontendsForAccount{Context: ctx, Handler: handler}
}
/*
ListPublicFrontendsForAccount swagger:route GET /overview/public-frontends metadata listPublicFrontendsForAccount
ListPublicFrontendsForAccount list public frontends for account API
*/
type ListPublicFrontendsForAccount struct {
Context *middleware.Context
Handler ListPublicFrontendsForAccountHandler
}
func (o *ListPublicFrontendsForAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewListPublicFrontendsForAccountParams()
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)
}
// ListPublicFrontendsForAccountOKBody list public frontends for account o k body
//
// swagger:model ListPublicFrontendsForAccountOKBody
type ListPublicFrontendsForAccountOKBody struct {
// public frontends
PublicFrontends []*ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0 `json:"publicFrontends"`
}
// Validate validates this list public frontends for account o k body
func (o *ListPublicFrontendsForAccountOKBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validatePublicFrontends(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ListPublicFrontendsForAccountOKBody) validatePublicFrontends(formats strfmt.Registry) error {
if swag.IsZero(o.PublicFrontends) { // not required
return nil
}
for i := 0; i < len(o.PublicFrontends); i++ {
if swag.IsZero(o.PublicFrontends[i]) { // not required
continue
}
if o.PublicFrontends[i] != nil {
if err := o.PublicFrontends[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("listPublicFrontendsForAccountOK" + "." + "publicFrontends" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("listPublicFrontendsForAccountOK" + "." + "publicFrontends" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this list public frontends for account o k body based on the context it is used
func (o *ListPublicFrontendsForAccountOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidatePublicFrontends(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *ListPublicFrontendsForAccountOKBody) contextValidatePublicFrontends(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(o.PublicFrontends); i++ {
if o.PublicFrontends[i] != nil {
if swag.IsZero(o.PublicFrontends[i]) { // not required
return nil
}
if err := o.PublicFrontends[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("listPublicFrontendsForAccountOK" + "." + "publicFrontends" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("listPublicFrontendsForAccountOK" + "." + "publicFrontends" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (o *ListPublicFrontendsForAccountOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ListPublicFrontendsForAccountOKBody) UnmarshalBinary(b []byte) error {
var res ListPublicFrontendsForAccountOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
// ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0 list public frontends for account o k body public frontends items0
//
// swagger:model ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0
type ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0 struct {
// public name
PublicName string `json:"publicName,omitempty"`
// url template
URLTemplate string `json:"urlTemplate,omitempty"`
}
// Validate validates this list public frontends for account o k body public frontends items0
func (o *ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this list public frontends for account o k body public frontends items0 based on context it is used
func (o *ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0) UnmarshalBinary(b []byte) error {
var res ListPublicFrontendsForAccountOKBodyPublicFrontendsItems0
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -0,0 +1,46 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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/middleware"
)
// NewListPublicFrontendsForAccountParams creates a new ListPublicFrontendsForAccountParams object
//
// There are no default values defined in the spec.
func NewListPublicFrontendsForAccountParams() ListPublicFrontendsForAccountParams {
return ListPublicFrontendsForAccountParams{}
}
// ListPublicFrontendsForAccountParams contains all the bound params for the list public frontends for account operation
// typically these are obtained from a http.Request
//
// swagger:parameters listPublicFrontendsForAccount
type ListPublicFrontendsForAccountParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
}
// 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 NewListPublicFrontendsForAccountParams() beforehand.
func (o *ListPublicFrontendsForAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
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 metadata
// 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"
)
// ListPublicFrontendsForAccountOKCode is the HTTP code returned for type ListPublicFrontendsForAccountOK
const ListPublicFrontendsForAccountOKCode int = 200
/*
ListPublicFrontendsForAccountOK public frontends list returned
swagger:response listPublicFrontendsForAccountOK
*/
type ListPublicFrontendsForAccountOK struct {
/*
In: Body
*/
Payload *ListPublicFrontendsForAccountOKBody `json:"body,omitempty"`
}
// NewListPublicFrontendsForAccountOK creates ListPublicFrontendsForAccountOK with default headers values
func NewListPublicFrontendsForAccountOK() *ListPublicFrontendsForAccountOK {
return &ListPublicFrontendsForAccountOK{}
}
// WithPayload adds the payload to the list public frontends for account o k response
func (o *ListPublicFrontendsForAccountOK) WithPayload(payload *ListPublicFrontendsForAccountOKBody) *ListPublicFrontendsForAccountOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the list public frontends for account o k response
func (o *ListPublicFrontendsForAccountOK) SetPayload(payload *ListPublicFrontendsForAccountOKBody) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ListPublicFrontendsForAccountOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// ListPublicFrontendsForAccountUnauthorizedCode is the HTTP code returned for type ListPublicFrontendsForAccountUnauthorized
const ListPublicFrontendsForAccountUnauthorizedCode int = 401
/*
ListPublicFrontendsForAccountUnauthorized unauthorized
swagger:response listPublicFrontendsForAccountUnauthorized
*/
type ListPublicFrontendsForAccountUnauthorized struct {
}
// NewListPublicFrontendsForAccountUnauthorized creates ListPublicFrontendsForAccountUnauthorized with default headers values
func NewListPublicFrontendsForAccountUnauthorized() *ListPublicFrontendsForAccountUnauthorized {
return &ListPublicFrontendsForAccountUnauthorized{}
}
// WriteResponse to the client
func (o *ListPublicFrontendsForAccountUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(401)
}
// ListPublicFrontendsForAccountInternalServerErrorCode is the HTTP code returned for type ListPublicFrontendsForAccountInternalServerError
const ListPublicFrontendsForAccountInternalServerErrorCode int = 500
/*
ListPublicFrontendsForAccountInternalServerError internal server error
swagger:response listPublicFrontendsForAccountInternalServerError
*/
type ListPublicFrontendsForAccountInternalServerError struct {
}
// NewListPublicFrontendsForAccountInternalServerError creates ListPublicFrontendsForAccountInternalServerError with default headers values
func NewListPublicFrontendsForAccountInternalServerError() *ListPublicFrontendsForAccountInternalServerError {
return &ListPublicFrontendsForAccountInternalServerError{}
}
// WriteResponse to the client
func (o *ListPublicFrontendsForAccountInternalServerError) 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 metadata
// 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"
)
// ListPublicFrontendsForAccountURL generates an URL for the list public frontends for account operation
type ListPublicFrontendsForAccountURL 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 *ListPublicFrontendsForAccountURL) WithBasePath(bp string) *ListPublicFrontendsForAccountURL {
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 *ListPublicFrontendsForAccountURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *ListPublicFrontendsForAccountURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/overview/public-frontends"
_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 *ListPublicFrontendsForAccountURL) 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 *ListPublicFrontendsForAccountURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *ListPublicFrontendsForAccountURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on ListPublicFrontendsForAccountURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on ListPublicFrontendsForAccountURL")
}
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 *ListPublicFrontendsForAccountURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@ -149,6 +149,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
AdminListOrganizationsHandler: admin.ListOrganizationsHandlerFunc(func(params admin.ListOrganizationsParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation admin.ListOrganizations has not yet been implemented")
}),
MetadataListPublicFrontendsForAccountHandler: metadata.ListPublicFrontendsForAccountHandlerFunc(func(params metadata.ListPublicFrontendsForAccountParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation metadata.ListPublicFrontendsForAccount has not yet been implemented")
}),
AccountLoginHandler: account.LoginHandlerFunc(func(params account.LoginParams) middleware.Responder {
return middleware.NotImplemented("operation account.Login has not yet been implemented")
}),
@ -337,6 +340,8 @@ type ZrokAPI struct {
AdminListOrganizationMembersHandler admin.ListOrganizationMembersHandler
// AdminListOrganizationsHandler sets the operation handler for the list organizations operation
AdminListOrganizationsHandler admin.ListOrganizationsHandler
// MetadataListPublicFrontendsForAccountHandler sets the operation handler for the list public frontends for account operation
MetadataListPublicFrontendsForAccountHandler metadata.ListPublicFrontendsForAccountHandler
// AccountLoginHandler sets the operation handler for the login operation
AccountLoginHandler account.LoginHandler
// MetadataOrgAccountOverviewHandler sets the operation handler for the org account overview operation
@ -565,6 +570,9 @@ func (o *ZrokAPI) Validate() error {
if o.AdminListOrganizationsHandler == nil {
unregistered = append(unregistered, "admin.ListOrganizationsHandler")
}
if o.MetadataListPublicFrontendsForAccountHandler == nil {
unregistered = append(unregistered, "metadata.ListPublicFrontendsForAccountHandler")
}
if o.AccountLoginHandler == nil {
unregistered = append(unregistered, "account.LoginHandler")
}
@ -868,6 +876,10 @@ func (o *ZrokAPI) initHandlerCache() {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/organizations"] = admin.NewListOrganizations(o.context, o.AdminListOrganizationsHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/overview/public-frontends"] = metadata.NewListPublicFrontendsForAccount(o.context, o.MetadataListPublicFrontendsForAccountHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}

View File

@ -38,6 +38,8 @@ models/ListOrganizationMembers200Response.ts
models/ListOrganizationMembers200ResponseMembersInner.ts
models/ListOrganizations200Response.ts
models/ListOrganizations200ResponseOrganizationsInner.ts
models/ListPublicFrontendsForAccount200Response.ts
models/ListPublicFrontendsForAccount200ResponsePublicFrontendsInner.ts
models/LoginRequest.ts
models/Metrics.ts
models/MetricsSample.ts

View File

@ -23,6 +23,7 @@ import type {
GetSparklinesRequest,
ListMemberships200Response,
ListOrganizationMembers200Response,
ListPublicFrontendsForAccount200Response,
Metrics,
ModelConfiguration,
Overview,
@ -46,6 +47,8 @@ import {
ListMemberships200ResponseToJSON,
ListOrganizationMembers200ResponseFromJSON,
ListOrganizationMembers200ResponseToJSON,
ListPublicFrontendsForAccount200ResponseFromJSON,
ListPublicFrontendsForAccount200ResponseToJSON,
MetricsFromJSON,
MetricsToJSON,
ModelConfigurationFromJSON,
@ -493,6 +496,34 @@ export class MetadataApi extends runtime.BaseAPI {
return await response.value();
}
/**
*/
async listPublicFrontendsForAccountRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListPublicFrontendsForAccount200Response>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-token"] = await this.configuration.apiKey("x-token"); // key authentication
}
const response = await this.request({
path: `/overview/public-frontends`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ListPublicFrontendsForAccount200ResponseFromJSON(jsonValue));
}
/**
*/
async listPublicFrontendsForAccount(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListPublicFrontendsForAccount200Response> {
const response = await this.listPublicFrontendsForAccountRaw(initOverrides);
return await response.value();
}
/**
*/
async orgAccountOverviewRaw(requestParameters: OrgAccountOverviewRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Overview>> {

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { ListPublicFrontendsForAccount200ResponsePublicFrontendsInner } from './ListPublicFrontendsForAccount200ResponsePublicFrontendsInner';
import {
ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSON,
ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSONTyped,
ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSON,
ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSONTyped,
} from './ListPublicFrontendsForAccount200ResponsePublicFrontendsInner';
/**
*
* @export
* @interface ListPublicFrontendsForAccount200Response
*/
export interface ListPublicFrontendsForAccount200Response {
/**
*
* @type {Array<ListPublicFrontendsForAccount200ResponsePublicFrontendsInner>}
* @memberof ListPublicFrontendsForAccount200Response
*/
publicFrontends?: Array<ListPublicFrontendsForAccount200ResponsePublicFrontendsInner>;
}
/**
* Check if a given object implements the ListPublicFrontendsForAccount200Response interface.
*/
export function instanceOfListPublicFrontendsForAccount200Response(value: object): value is ListPublicFrontendsForAccount200Response {
return true;
}
export function ListPublicFrontendsForAccount200ResponseFromJSON(json: any): ListPublicFrontendsForAccount200Response {
return ListPublicFrontendsForAccount200ResponseFromJSONTyped(json, false);
}
export function ListPublicFrontendsForAccount200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ListPublicFrontendsForAccount200Response {
if (json == null) {
return json;
}
return {
'publicFrontends': json['publicFrontends'] == null ? undefined : ((json['publicFrontends'] as Array<any>).map(ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSON)),
};
}
export function ListPublicFrontendsForAccount200ResponseToJSON(json: any): ListPublicFrontendsForAccount200Response {
return ListPublicFrontendsForAccount200ResponseToJSONTyped(json, false);
}
export function ListPublicFrontendsForAccount200ResponseToJSONTyped(value?: ListPublicFrontendsForAccount200Response | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'publicFrontends': value['publicFrontends'] == null ? undefined : ((value['publicFrontends'] as Array<any>).map(ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSON)),
};
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
*/
export interface ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
/**
*
* @type {string}
* @memberof ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
*/
publicName?: string;
/**
*
* @type {string}
* @memberof ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
*/
urlTemplate?: string;
}
/**
* Check if a given object implements the ListPublicFrontendsForAccount200ResponsePublicFrontendsInner interface.
*/
export function instanceOfListPublicFrontendsForAccount200ResponsePublicFrontendsInner(value: object): value is ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
return true;
}
export function ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSON(json: any): ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
return ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSONTyped(json, false);
}
export function ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
if (json == null) {
return json;
}
return {
'publicName': json['publicName'] == null ? undefined : json['publicName'],
'urlTemplate': json['urlTemplate'] == null ? undefined : json['urlTemplate'],
};
}
export function ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSON(json: any): ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
return ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSONTyped(json, false);
}
export function ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSONTyped(value?: ListPublicFrontendsForAccount200ResponsePublicFrontendsInner | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'publicName': value['publicName'],
'urlTemplate': value['urlTemplate'],
};
}

View File

@ -31,6 +31,8 @@ export * from './ListOrganizationMembers200Response';
export * from './ListOrganizationMembers200ResponseMembersInner';
export * from './ListOrganizations200Response';
export * from './ListOrganizations200ResponseOrganizationsInner';
export * from './ListPublicFrontendsForAccount200Response';
export * from './ListPublicFrontendsForAccount200ResponsePublicFrontendsInner';
export * from './LoginRequest';
export * from './Metrics';
export * from './MetricsSample';

View File

@ -36,6 +36,8 @@ docs/ListOrganizationMembers200Response.md
docs/ListOrganizationMembers200ResponseMembersInner.md
docs/ListOrganizations200Response.md
docs/ListOrganizations200ResponseOrganizationsInner.md
docs/ListPublicFrontendsForAccount200Response.md
docs/ListPublicFrontendsForAccount200ResponsePublicFrontendsInner.md
docs/LoginRequest.md
docs/MetadataApi.md
docs/Metrics.md
@ -108,6 +110,8 @@ test/test_list_organization_members200_response.py
test/test_list_organization_members200_response_members_inner.py
test/test_list_organizations200_response.py
test/test_list_organizations200_response_organizations_inner.py
test/test_list_public_frontends_for_account200_response.py
test/test_list_public_frontends_for_account200_response_public_frontends_inner.py
test/test_login_request.py
test/test_metadata_api.py
test/test_metrics.py
@ -186,6 +190,8 @@ zrok_api/models/list_organization_members200_response.py
zrok_api/models/list_organization_members200_response_members_inner.py
zrok_api/models/list_organizations200_response.py
zrok_api/models/list_organizations200_response_organizations_inner.py
zrok_api/models/list_public_frontends_for_account200_response.py
zrok_api/models/list_public_frontends_for_account200_response_public_frontends_inner.py
zrok_api/models/login_request.py
zrok_api/models/metrics.py
zrok_api/models/metrics_sample.py

View File

@ -139,6 +139,7 @@ Class | Method | HTTP request | Description
*MetadataApi* | [**get_sparklines**](docs/MetadataApi.md#get_sparklines) | **POST** /sparklines |
*MetadataApi* | [**list_memberships**](docs/MetadataApi.md#list_memberships) | **GET** /memberships |
*MetadataApi* | [**list_org_members**](docs/MetadataApi.md#list_org_members) | **GET** /members/{organizationToken} |
*MetadataApi* | [**list_public_frontends_for_account**](docs/MetadataApi.md#list_public_frontends_for_account) | **GET** /overview/public-frontends |
*MetadataApi* | [**org_account_overview**](docs/MetadataApi.md#org_account_overview) | **GET** /overview/{organizationToken}/{accountEmail} |
*MetadataApi* | [**overview**](docs/MetadataApi.md#overview) | **GET** /overview |
*MetadataApi* | [**version**](docs/MetadataApi.md#version) | **GET** /version |
@ -185,6 +186,8 @@ Class | Method | HTTP request | Description
- [ListOrganizationMembers200ResponseMembersInner](docs/ListOrganizationMembers200ResponseMembersInner.md)
- [ListOrganizations200Response](docs/ListOrganizations200Response.md)
- [ListOrganizations200ResponseOrganizationsInner](docs/ListOrganizations200ResponseOrganizationsInner.md)
- [ListPublicFrontendsForAccount200Response](docs/ListPublicFrontendsForAccount200Response.md)
- [ListPublicFrontendsForAccount200ResponsePublicFrontendsInner](docs/ListPublicFrontendsForAccount200ResponsePublicFrontendsInner.md)
- [LoginRequest](docs/LoginRequest.md)
- [Metrics](docs/Metrics.md)
- [MetricsSample](docs/MetricsSample.md)

View File

@ -0,0 +1,29 @@
# ListPublicFrontendsForAccount200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**public_frontends** | [**List[ListPublicFrontendsForAccount200ResponsePublicFrontendsInner]**](ListPublicFrontendsForAccount200ResponsePublicFrontendsInner.md) | | [optional]
## Example
```python
from zrok_api.models.list_public_frontends_for_account200_response import ListPublicFrontendsForAccount200Response
# TODO update the JSON string below
json = "{}"
# create an instance of ListPublicFrontendsForAccount200Response from a JSON string
list_public_frontends_for_account200_response_instance = ListPublicFrontendsForAccount200Response.from_json(json)
# print the JSON string representation of the object
print(ListPublicFrontendsForAccount200Response.to_json())
# convert the object into a dict
list_public_frontends_for_account200_response_dict = list_public_frontends_for_account200_response_instance.to_dict()
# create an instance of ListPublicFrontendsForAccount200Response from a dict
list_public_frontends_for_account200_response_from_dict = ListPublicFrontendsForAccount200Response.from_dict(list_public_frontends_for_account200_response_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,30 @@
# ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**public_name** | **str** | | [optional]
**url_template** | **str** | | [optional]
## Example
```python
from zrok_api.models.list_public_frontends_for_account200_response_public_frontends_inner import ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
# TODO update the JSON string below
json = "{}"
# create an instance of ListPublicFrontendsForAccount200ResponsePublicFrontendsInner from a JSON string
list_public_frontends_for_account200_response_public_frontends_inner_instance = ListPublicFrontendsForAccount200ResponsePublicFrontendsInner.from_json(json)
# print the JSON string representation of the object
print(ListPublicFrontendsForAccount200ResponsePublicFrontendsInner.to_json())
# convert the object into a dict
list_public_frontends_for_account200_response_public_frontends_inner_dict = list_public_frontends_for_account200_response_public_frontends_inner_instance.to_dict()
# create an instance of ListPublicFrontendsForAccount200ResponsePublicFrontendsInner from a dict
list_public_frontends_for_account200_response_public_frontends_inner_from_dict = ListPublicFrontendsForAccount200ResponsePublicFrontendsInner.from_dict(list_public_frontends_for_account200_response_public_frontends_inner_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -16,6 +16,7 @@ Method | HTTP request | Description
[**get_sparklines**](MetadataApi.md#get_sparklines) | **POST** /sparklines |
[**list_memberships**](MetadataApi.md#list_memberships) | **GET** /memberships |
[**list_org_members**](MetadataApi.md#list_org_members) | **GET** /members/{organizationToken} |
[**list_public_frontends_for_account**](MetadataApi.md#list_public_frontends_for_account) | **GET** /overview/public-frontends |
[**org_account_overview**](MetadataApi.md#org_account_overview) | **GET** /overview/{organizationToken}/{accountEmail} |
[**overview**](MetadataApi.md#overview) | **GET** /overview |
[**version**](MetadataApi.md#version) | **GET** /version |
@ -903,6 +904,78 @@ 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)
# **list_public_frontends_for_account**
> ListPublicFrontendsForAccount200Response list_public_frontends_for_account()
### Example
* Api Key Authentication (key):
```python
import zrok_api
from zrok_api.models.list_public_frontends_for_account200_response import ListPublicFrontendsForAccount200Response
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.MetadataApi(api_client)
try:
api_response = api_instance.list_public_frontends_for_account()
print("The response of MetadataApi->list_public_frontends_for_account:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling MetadataApi->list_public_frontends_for_account: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**ListPublicFrontendsForAccount200Response**](ListPublicFrontendsForAccount200Response.md)
### Authorization
[key](../README.md#key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/zrok.v1+json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | public frontends list returned | - |
**401** | unauthorized | - |
**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)
# **org_account_overview**
> Overview org_account_overview(organization_token, account_email)

View File

@ -0,0 +1,55 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from zrok_api.models.list_public_frontends_for_account200_response import ListPublicFrontendsForAccount200Response
class TestListPublicFrontendsForAccount200Response(unittest.TestCase):
"""ListPublicFrontendsForAccount200Response unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> ListPublicFrontendsForAccount200Response:
"""Test ListPublicFrontendsForAccount200Response
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `ListPublicFrontendsForAccount200Response`
"""
model = ListPublicFrontendsForAccount200Response()
if include_optional:
return ListPublicFrontendsForAccount200Response(
public_frontends = [
zrok_api.models.list_public_frontends_for_account_200_response_public_frontends_inner.listPublicFrontendsForAccount_200_response_publicFrontends_inner(
public_name = '',
url_template = '', )
]
)
else:
return ListPublicFrontendsForAccount200Response(
)
"""
def testListPublicFrontendsForAccount200Response(self):
"""Test ListPublicFrontendsForAccount200Response"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,52 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from zrok_api.models.list_public_frontends_for_account200_response_public_frontends_inner import ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
class TestListPublicFrontendsForAccount200ResponsePublicFrontendsInner(unittest.TestCase):
"""ListPublicFrontendsForAccount200ResponsePublicFrontendsInner unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> ListPublicFrontendsForAccount200ResponsePublicFrontendsInner:
"""Test ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `ListPublicFrontendsForAccount200ResponsePublicFrontendsInner`
"""
model = ListPublicFrontendsForAccount200ResponsePublicFrontendsInner()
if include_optional:
return ListPublicFrontendsForAccount200ResponsePublicFrontendsInner(
public_name = '',
url_template = ''
)
else:
return ListPublicFrontendsForAccount200ResponsePublicFrontendsInner(
)
"""
def testListPublicFrontendsForAccount200ResponsePublicFrontendsInner(self):
"""Test ListPublicFrontendsForAccount200ResponsePublicFrontendsInner"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@ -98,6 +98,12 @@ class TestMetadataApi(unittest.TestCase):
"""
pass
def test_list_public_frontends_for_account(self) -> None:
"""Test case for list_public_frontends_for_account
"""
pass
def test_org_account_overview(self) -> None:
"""Test case for org_account_overview

View File

@ -68,6 +68,8 @@ from zrok_api.models.list_organization_members200_response import ListOrganizati
from zrok_api.models.list_organization_members200_response_members_inner import ListOrganizationMembers200ResponseMembersInner
from zrok_api.models.list_organizations200_response import ListOrganizations200Response
from zrok_api.models.list_organizations200_response_organizations_inner import ListOrganizations200ResponseOrganizationsInner
from zrok_api.models.list_public_frontends_for_account200_response import ListPublicFrontendsForAccount200Response
from zrok_api.models.list_public_frontends_for_account200_response_public_frontends_inner import ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
from zrok_api.models.login_request import LoginRequest
from zrok_api.models.metrics import Metrics
from zrok_api.models.metrics_sample import MetricsSample

View File

@ -27,6 +27,7 @@ from zrok_api.models.get_sparklines200_response import GetSparklines200Response
from zrok_api.models.get_sparklines_request import GetSparklinesRequest
from zrok_api.models.list_memberships200_response import ListMemberships200Response
from zrok_api.models.list_organization_members200_response import ListOrganizationMembers200Response
from zrok_api.models.list_public_frontends_for_account200_response import ListPublicFrontendsForAccount200Response
from zrok_api.models.metrics import Metrics
from zrok_api.models.overview import Overview
from zrok_api.models.share import Share
@ -3233,6 +3234,255 @@ class MetadataApi:
@validate_call
def list_public_frontends_for_account(
self,
_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,
) -> ListPublicFrontendsForAccount200Response:
"""list_public_frontends_for_account
: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._list_public_frontends_for_account_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "ListPublicFrontendsForAccount200Response",
'401': 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 list_public_frontends_for_account_with_http_info(
self,
_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[ListPublicFrontendsForAccount200Response]:
"""list_public_frontends_for_account
: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._list_public_frontends_for_account_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "ListPublicFrontendsForAccount200Response",
'401': 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 list_public_frontends_for_account_without_preload_content(
self,
_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:
"""list_public_frontends_for_account
: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._list_public_frontends_for_account_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "ListPublicFrontendsForAccount200Response",
'401': None,
'500': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _list_public_frontends_for_account_serialize(
self,
_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
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/zrok.v1+json'
]
)
# authentication setting
_auth_settings: List[str] = [
'key'
]
return self.api_client.param_serialize(
method='GET',
resource_path='/overview/public-frontends',
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
def org_account_overview(
self,

View File

@ -46,6 +46,8 @@ from zrok_api.models.list_organization_members200_response import ListOrganizati
from zrok_api.models.list_organization_members200_response_members_inner import ListOrganizationMembers200ResponseMembersInner
from zrok_api.models.list_organizations200_response import ListOrganizations200Response
from zrok_api.models.list_organizations200_response_organizations_inner import ListOrganizations200ResponseOrganizationsInner
from zrok_api.models.list_public_frontends_for_account200_response import ListPublicFrontendsForAccount200Response
from zrok_api.models.list_public_frontends_for_account200_response_public_frontends_inner import ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
from zrok_api.models.login_request import LoginRequest
from zrok_api.models.metrics import Metrics
from zrok_api.models.metrics_sample import MetricsSample

View File

@ -0,0 +1,95 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field
from typing import Any, ClassVar, Dict, List, Optional
from zrok_api.models.list_public_frontends_for_account200_response_public_frontends_inner import ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
from typing import Optional, Set
from typing_extensions import Self
class ListPublicFrontendsForAccount200Response(BaseModel):
"""
ListPublicFrontendsForAccount200Response
""" # noqa: E501
public_frontends: Optional[List[ListPublicFrontendsForAccount200ResponsePublicFrontendsInner]] = Field(default=None, alias="publicFrontends")
__properties: ClassVar[List[str]] = ["publicFrontends"]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of ListPublicFrontendsForAccount200Response from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in public_frontends (list)
_items = []
if self.public_frontends:
for _item_public_frontends in self.public_frontends:
if _item_public_frontends:
_items.append(_item_public_frontends.to_dict())
_dict['publicFrontends'] = _items
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of ListPublicFrontendsForAccount200Response from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"publicFrontends": [ListPublicFrontendsForAccount200ResponsePublicFrontendsInner.from_dict(_item) for _item in obj["publicFrontends"]] if obj.get("publicFrontends") is not None else None
})
return _obj

View File

@ -0,0 +1,89 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class ListPublicFrontendsForAccount200ResponsePublicFrontendsInner(BaseModel):
"""
ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
""" # noqa: E501
public_name: Optional[StrictStr] = Field(default=None, alias="publicName")
url_template: Optional[StrictStr] = Field(default=None, alias="urlTemplate")
__properties: ClassVar[List[str]] = ["publicName", "urlTemplate"]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of ListPublicFrontendsForAccount200ResponsePublicFrontendsInner from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of ListPublicFrontendsForAccount200ResponsePublicFrontendsInner from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"publicName": obj.get("publicName"),
"urlTemplate": obj.get("urlTemplate")
})
return _obj

View File

@ -1254,6 +1254,32 @@ paths:
schema:
$ref: "#/definitions/errorMessage"
/overview/public-frontends:
get:
tags:
- metadata
security:
- key: []
operationId: listPublicFrontendsForAccount
responses:
200:
description: public frontends list returned
schema:
properties:
publicFrontends:
type: array
items:
type: object
properties:
publicName:
type: string
urlTemplate:
type: string
401:
description: unauthorized
500:
description: internal server error
/overview/{organizationToken}/{accountEmail}:
get:
tags:

View File

@ -38,6 +38,8 @@ models/ListOrganizationMembers200Response.ts
models/ListOrganizationMembers200ResponseMembersInner.ts
models/ListOrganizations200Response.ts
models/ListOrganizations200ResponseOrganizationsInner.ts
models/ListPublicFrontendsForAccount200Response.ts
models/ListPublicFrontendsForAccount200ResponsePublicFrontendsInner.ts
models/LoginRequest.ts
models/Metrics.ts
models/MetricsSample.ts

View File

@ -23,6 +23,7 @@ import type {
GetSparklinesRequest,
ListMemberships200Response,
ListOrganizationMembers200Response,
ListPublicFrontendsForAccount200Response,
Metrics,
ModelConfiguration,
Overview,
@ -46,6 +47,8 @@ import {
ListMemberships200ResponseToJSON,
ListOrganizationMembers200ResponseFromJSON,
ListOrganizationMembers200ResponseToJSON,
ListPublicFrontendsForAccount200ResponseFromJSON,
ListPublicFrontendsForAccount200ResponseToJSON,
MetricsFromJSON,
MetricsToJSON,
ModelConfigurationFromJSON,
@ -493,6 +496,34 @@ export class MetadataApi extends runtime.BaseAPI {
return await response.value();
}
/**
*/
async listPublicFrontendsForAccountRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListPublicFrontendsForAccount200Response>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-token"] = await this.configuration.apiKey("x-token"); // key authentication
}
const response = await this.request({
path: `/overview/public-frontends`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ListPublicFrontendsForAccount200ResponseFromJSON(jsonValue));
}
/**
*/
async listPublicFrontendsForAccount(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListPublicFrontendsForAccount200Response> {
const response = await this.listPublicFrontendsForAccountRaw(initOverrides);
return await response.value();
}
/**
*/
async orgAccountOverviewRaw(requestParameters: OrgAccountOverviewRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Overview>> {

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { ListPublicFrontendsForAccount200ResponsePublicFrontendsInner } from './ListPublicFrontendsForAccount200ResponsePublicFrontendsInner';
import {
ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSON,
ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSONTyped,
ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSON,
ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSONTyped,
} from './ListPublicFrontendsForAccount200ResponsePublicFrontendsInner';
/**
*
* @export
* @interface ListPublicFrontendsForAccount200Response
*/
export interface ListPublicFrontendsForAccount200Response {
/**
*
* @type {Array<ListPublicFrontendsForAccount200ResponsePublicFrontendsInner>}
* @memberof ListPublicFrontendsForAccount200Response
*/
publicFrontends?: Array<ListPublicFrontendsForAccount200ResponsePublicFrontendsInner>;
}
/**
* Check if a given object implements the ListPublicFrontendsForAccount200Response interface.
*/
export function instanceOfListPublicFrontendsForAccount200Response(value: object): value is ListPublicFrontendsForAccount200Response {
return true;
}
export function ListPublicFrontendsForAccount200ResponseFromJSON(json: any): ListPublicFrontendsForAccount200Response {
return ListPublicFrontendsForAccount200ResponseFromJSONTyped(json, false);
}
export function ListPublicFrontendsForAccount200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ListPublicFrontendsForAccount200Response {
if (json == null) {
return json;
}
return {
'publicFrontends': json['publicFrontends'] == null ? undefined : ((json['publicFrontends'] as Array<any>).map(ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSON)),
};
}
export function ListPublicFrontendsForAccount200ResponseToJSON(json: any): ListPublicFrontendsForAccount200Response {
return ListPublicFrontendsForAccount200ResponseToJSONTyped(json, false);
}
export function ListPublicFrontendsForAccount200ResponseToJSONTyped(value?: ListPublicFrontendsForAccount200Response | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'publicFrontends': value['publicFrontends'] == null ? undefined : ((value['publicFrontends'] as Array<any>).map(ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSON)),
};
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
*/
export interface ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
/**
*
* @type {string}
* @memberof ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
*/
publicName?: string;
/**
*
* @type {string}
* @memberof ListPublicFrontendsForAccount200ResponsePublicFrontendsInner
*/
urlTemplate?: string;
}
/**
* Check if a given object implements the ListPublicFrontendsForAccount200ResponsePublicFrontendsInner interface.
*/
export function instanceOfListPublicFrontendsForAccount200ResponsePublicFrontendsInner(value: object): value is ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
return true;
}
export function ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSON(json: any): ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
return ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSONTyped(json, false);
}
export function ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
if (json == null) {
return json;
}
return {
'publicName': json['publicName'] == null ? undefined : json['publicName'],
'urlTemplate': json['urlTemplate'] == null ? undefined : json['urlTemplate'],
};
}
export function ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSON(json: any): ListPublicFrontendsForAccount200ResponsePublicFrontendsInner {
return ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSONTyped(json, false);
}
export function ListPublicFrontendsForAccount200ResponsePublicFrontendsInnerToJSONTyped(value?: ListPublicFrontendsForAccount200ResponsePublicFrontendsInner | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'publicName': value['publicName'],
'urlTemplate': value['urlTemplate'],
};
}

View File

@ -31,6 +31,8 @@ export * from './ListOrganizationMembers200Response';
export * from './ListOrganizationMembers200ResponseMembersInner';
export * from './ListOrganizations200Response';
export * from './ListOrganizations200ResponseOrganizationsInner';
export * from './ListPublicFrontendsForAccount200Response';
export * from './ListPublicFrontendsForAccount200ResponsePublicFrontendsInner';
export * from './LoginRequest';
export * from './Metrics';
export * from './MetricsSample';