mirror of
https://github.com/openziti/zrok.git
synced 2025-03-27 14:46:03 +01:00
frontend bind address data wiring (#834)
This commit is contained in:
parent
e95e5c3fe8
commit
e7f126bd45
@ -16,15 +16,16 @@ type Frontend struct {
|
||||
Reserved bool
|
||||
PermissionMode PermissionMode
|
||||
Description *string
|
||||
BindAddress *string
|
||||
}
|
||||
|
||||
func (str *Store) CreateFrontend(envId int, f *Frontend, tx *sqlx.Tx) (int, error) {
|
||||
stmt, err := tx.Prepare("insert into frontends (environment_id, private_share_id, token, z_id, public_name, url_template, reserved, permission_mode, description) values ($1, $2, $3, $4, $5, $6, $7, $8, $9) returning id")
|
||||
stmt, err := tx.Prepare("insert into frontends (environment_id, private_share_id, token, z_id, public_name, url_template, reserved, permission_mode, description, bind_address) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) returning id")
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "error preparing frontends insert statement")
|
||||
}
|
||||
var id int
|
||||
if err := stmt.QueryRow(envId, f.PrivateShareId, f.Token, f.ZId, f.PublicName, f.UrlTemplate, f.Reserved, f.PermissionMode, f.Description).Scan(&id); err != nil {
|
||||
if err := stmt.QueryRow(envId, f.PrivateShareId, f.Token, f.ZId, f.PublicName, f.UrlTemplate, f.Reserved, f.PermissionMode, f.Description, f.BindAddress).Scan(&id); err != nil {
|
||||
return 0, errors.Wrap(err, "error executing frontends insert statement")
|
||||
}
|
||||
return id, nil
|
||||
@ -123,12 +124,12 @@ func (str *Store) FindFrontendsForPrivateShare(shrId int, tx *sqlx.Tx) ([]*Front
|
||||
}
|
||||
|
||||
func (str *Store) UpdateFrontend(fe *Frontend, tx *sqlx.Tx) error {
|
||||
sql := "update frontends set environment_id = $1, private_share_id = $2, token = $3, z_id = $4, public_name = $5, url_template = $6, reserved = $7, permission_mode = $8, description = $9, updated_at = current_timestamp where id = $10"
|
||||
sql := "update frontends set environment_id = $1, private_share_id = $2, token = $3, z_id = $4, public_name = $5, url_template = $6, reserved = $7, permission_mode = $8, description = $9, bind_address = $10, updated_at = current_timestamp where id = $11"
|
||||
stmt, err := tx.Prepare(sql)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error preparing frontends update statement")
|
||||
}
|
||||
_, err = stmt.Exec(fe.EnvironmentId, fe.PrivateShareId, fe.Token, fe.ZId, fe.PublicName, fe.UrlTemplate, fe.Reserved, fe.PermissionMode, fe.Description, fe.Id)
|
||||
_, err = stmt.Exec(fe.EnvironmentId, fe.PrivateShareId, fe.Token, fe.ZId, fe.PublicName, fe.UrlTemplate, fe.Reserved, fe.PermissionMode, fe.Description, fe.BindAddress, fe.Id)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error executing frontends update statement")
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
-- +migrate Up
|
||||
|
||||
alter table frontends add column bind_address varchar(128);
|
@ -0,0 +1,3 @@
|
||||
-- +migrate Up
|
||||
|
||||
alter table frontends add column bind_address varchar(128);
|
@ -294,6 +294,9 @@ swagger:model AccessBody
|
||||
*/
|
||||
type AccessBody struct {
|
||||
|
||||
// bind address
|
||||
BindAddress string `json:"bindAddress,omitempty"`
|
||||
|
||||
// description
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
|
@ -281,6 +281,9 @@ swagger:model UpdateAccessBody
|
||||
*/
|
||||
type UpdateAccessBody struct {
|
||||
|
||||
// bind address
|
||||
BindAddress string `json:"bindAddress,omitempty"`
|
||||
|
||||
// description
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
|
@ -17,6 +17,12 @@ import (
|
||||
// swagger:model frontend
|
||||
type Frontend struct {
|
||||
|
||||
// backend mode
|
||||
BackendMode string `json:"backendMode,omitempty"`
|
||||
|
||||
// bind address
|
||||
BindAddress string `json:"bindAddress,omitempty"`
|
||||
|
||||
// created at
|
||||
CreatedAt int64 `json:"createdAt,omitempty"`
|
||||
|
||||
|
@ -52,6 +52,9 @@ func init() {
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"bindAddress": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -106,6 +109,9 @@ func init() {
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"bindAddress": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -1993,6 +1999,12 @@ func init() {
|
||||
"frontend": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"bindAddress": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "integer"
|
||||
},
|
||||
@ -2296,6 +2308,9 @@ func init() {
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"bindAddress": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -2350,6 +2365,9 @@ func init() {
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"bindAddress": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -4242,6 +4260,12 @@ func init() {
|
||||
"frontend": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"bindAddress": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "integer"
|
||||
},
|
||||
|
@ -78,6 +78,9 @@ func (o *Access) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
// swagger:model AccessBody
|
||||
type AccessBody struct {
|
||||
|
||||
// bind address
|
||||
BindAddress string `json:"bindAddress,omitempty"`
|
||||
|
||||
// description
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
|
@ -78,6 +78,9 @@ func (o *UpdateAccess) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
// swagger:model UpdateAccessBody
|
||||
type UpdateAccessBody struct {
|
||||
|
||||
// bind address
|
||||
BindAddress string `json:"bindAddress,omitempty"`
|
||||
|
||||
// description
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
|
@ -15,6 +15,7 @@ import { RequestFile } from './models';
|
||||
export class AccessRequest {
|
||||
'envZId'?: string;
|
||||
'shareToken'?: string;
|
||||
'bindAddress'?: string;
|
||||
'description'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
@ -30,6 +31,11 @@ export class AccessRequest {
|
||||
"baseName": "shareToken",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "bindAddress",
|
||||
"baseName": "bindAddress",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"baseName": "description",
|
||||
|
@ -16,6 +16,8 @@ export class Frontend {
|
||||
'id'?: number;
|
||||
'frontendToken'?: string;
|
||||
'shareToken'?: string;
|
||||
'backendMode'?: string;
|
||||
'bindAddress'?: string;
|
||||
'description'?: string;
|
||||
'zId'?: string;
|
||||
'createdAt'?: number;
|
||||
@ -39,6 +41,16 @@ export class Frontend {
|
||||
"baseName": "shareToken",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "backendMode",
|
||||
"baseName": "backendMode",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "bindAddress",
|
||||
"baseName": "bindAddress",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"baseName": "description",
|
||||
|
@ -14,6 +14,7 @@ import { RequestFile } from './models';
|
||||
|
||||
export class UpdateAccessRequest {
|
||||
'frontendToken'?: string;
|
||||
'bindAddress'?: string;
|
||||
'description'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
@ -24,6 +25,11 @@ export class UpdateAccessRequest {
|
||||
"baseName": "frontendToken",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "bindAddress",
|
||||
"baseName": "bindAddress",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"baseName": "description",
|
||||
|
@ -5,6 +5,7 @@ Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**env_zid** | **str** | | [optional]
|
||||
**share_token** | **str** | | [optional]
|
||||
**bind_address** | **str** | | [optional]
|
||||
**description** | **str** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
@ -4,6 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**frontend_token** | **str** | | [optional]
|
||||
**bind_address** | **str** | | [optional]
|
||||
**description** | **str** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
@ -6,6 +6,8 @@ Name | Type | Description | Notes
|
||||
**id** | **int** | | [optional]
|
||||
**frontend_token** | **str** | | [optional]
|
||||
**share_token** | **str** | | [optional]
|
||||
**backend_mode** | **str** | | [optional]
|
||||
**bind_address** | **str** | | [optional]
|
||||
**description** | **str** | | [optional]
|
||||
**z_id** | **str** | | [optional]
|
||||
**created_at** | **int** | | [optional]
|
||||
|
@ -30,25 +30,30 @@ class AccessBody(object):
|
||||
swagger_types = {
|
||||
'env_zid': 'str',
|
||||
'share_token': 'str',
|
||||
'bind_address': 'str',
|
||||
'description': 'str'
|
||||
}
|
||||
|
||||
attribute_map = {
|
||||
'env_zid': 'envZId',
|
||||
'share_token': 'shareToken',
|
||||
'bind_address': 'bindAddress',
|
||||
'description': 'description'
|
||||
}
|
||||
|
||||
def __init__(self, env_zid=None, share_token=None, description=None): # noqa: E501
|
||||
def __init__(self, env_zid=None, share_token=None, bind_address=None, description=None): # noqa: E501
|
||||
"""AccessBody - a model defined in Swagger""" # noqa: E501
|
||||
self._env_zid = None
|
||||
self._share_token = None
|
||||
self._bind_address = None
|
||||
self._description = None
|
||||
self.discriminator = None
|
||||
if env_zid is not None:
|
||||
self.env_zid = env_zid
|
||||
if share_token is not None:
|
||||
self.share_token = share_token
|
||||
if bind_address is not None:
|
||||
self.bind_address = bind_address
|
||||
if description is not None:
|
||||
self.description = description
|
||||
|
||||
@ -94,6 +99,27 @@ class AccessBody(object):
|
||||
|
||||
self._share_token = share_token
|
||||
|
||||
@property
|
||||
def bind_address(self):
|
||||
"""Gets the bind_address of this AccessBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The bind_address of this AccessBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._bind_address
|
||||
|
||||
@bind_address.setter
|
||||
def bind_address(self, bind_address):
|
||||
"""Sets the bind_address of this AccessBody.
|
||||
|
||||
|
||||
:param bind_address: The bind_address of this AccessBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._bind_address = bind_address
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
"""Gets the description of this AccessBody. # noqa: E501
|
||||
|
@ -29,21 +29,26 @@ class AccessBody1(object):
|
||||
"""
|
||||
swagger_types = {
|
||||
'frontend_token': 'str',
|
||||
'bind_address': 'str',
|
||||
'description': 'str'
|
||||
}
|
||||
|
||||
attribute_map = {
|
||||
'frontend_token': 'frontendToken',
|
||||
'bind_address': 'bindAddress',
|
||||
'description': 'description'
|
||||
}
|
||||
|
||||
def __init__(self, frontend_token=None, description=None): # noqa: E501
|
||||
def __init__(self, frontend_token=None, bind_address=None, description=None): # noqa: E501
|
||||
"""AccessBody1 - a model defined in Swagger""" # noqa: E501
|
||||
self._frontend_token = None
|
||||
self._bind_address = None
|
||||
self._description = None
|
||||
self.discriminator = None
|
||||
if frontend_token is not None:
|
||||
self.frontend_token = frontend_token
|
||||
if bind_address is not None:
|
||||
self.bind_address = bind_address
|
||||
if description is not None:
|
||||
self.description = description
|
||||
|
||||
@ -68,6 +73,27 @@ class AccessBody1(object):
|
||||
|
||||
self._frontend_token = frontend_token
|
||||
|
||||
@property
|
||||
def bind_address(self):
|
||||
"""Gets the bind_address of this AccessBody1. # noqa: E501
|
||||
|
||||
|
||||
:return: The bind_address of this AccessBody1. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._bind_address
|
||||
|
||||
@bind_address.setter
|
||||
def bind_address(self, bind_address):
|
||||
"""Sets the bind_address of this AccessBody1.
|
||||
|
||||
|
||||
:param bind_address: The bind_address of this AccessBody1. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._bind_address = bind_address
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
"""Gets the description of this AccessBody1. # noqa: E501
|
||||
|
@ -31,6 +31,8 @@ class Frontend(object):
|
||||
'id': 'int',
|
||||
'frontend_token': 'str',
|
||||
'share_token': 'str',
|
||||
'backend_mode': 'str',
|
||||
'bind_address': 'str',
|
||||
'description': 'str',
|
||||
'z_id': 'str',
|
||||
'created_at': 'int',
|
||||
@ -41,17 +43,21 @@ class Frontend(object):
|
||||
'id': 'id',
|
||||
'frontend_token': 'frontendToken',
|
||||
'share_token': 'shareToken',
|
||||
'backend_mode': 'backendMode',
|
||||
'bind_address': 'bindAddress',
|
||||
'description': 'description',
|
||||
'z_id': 'zId',
|
||||
'created_at': 'createdAt',
|
||||
'updated_at': 'updatedAt'
|
||||
}
|
||||
|
||||
def __init__(self, id=None, frontend_token=None, share_token=None, description=None, z_id=None, created_at=None, updated_at=None): # noqa: E501
|
||||
def __init__(self, id=None, frontend_token=None, share_token=None, backend_mode=None, bind_address=None, description=None, z_id=None, created_at=None, updated_at=None): # noqa: E501
|
||||
"""Frontend - a model defined in Swagger""" # noqa: E501
|
||||
self._id = None
|
||||
self._frontend_token = None
|
||||
self._share_token = None
|
||||
self._backend_mode = None
|
||||
self._bind_address = None
|
||||
self._description = None
|
||||
self._z_id = None
|
||||
self._created_at = None
|
||||
@ -63,6 +69,10 @@ class Frontend(object):
|
||||
self.frontend_token = frontend_token
|
||||
if share_token is not None:
|
||||
self.share_token = share_token
|
||||
if backend_mode is not None:
|
||||
self.backend_mode = backend_mode
|
||||
if bind_address is not None:
|
||||
self.bind_address = bind_address
|
||||
if description is not None:
|
||||
self.description = description
|
||||
if z_id is not None:
|
||||
@ -135,6 +145,48 @@ class Frontend(object):
|
||||
|
||||
self._share_token = share_token
|
||||
|
||||
@property
|
||||
def backend_mode(self):
|
||||
"""Gets the backend_mode of this Frontend. # noqa: E501
|
||||
|
||||
|
||||
:return: The backend_mode of this Frontend. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._backend_mode
|
||||
|
||||
@backend_mode.setter
|
||||
def backend_mode(self, backend_mode):
|
||||
"""Sets the backend_mode of this Frontend.
|
||||
|
||||
|
||||
:param backend_mode: The backend_mode of this Frontend. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._backend_mode = backend_mode
|
||||
|
||||
@property
|
||||
def bind_address(self):
|
||||
"""Gets the bind_address of this Frontend. # noqa: E501
|
||||
|
||||
|
||||
:return: The bind_address of this Frontend. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._bind_address
|
||||
|
||||
@bind_address.setter
|
||||
def bind_address(self, bind_address):
|
||||
"""Sets the bind_address of this Frontend.
|
||||
|
||||
|
||||
:param bind_address: The bind_address of this Frontend. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._bind_address = bind_address
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
"""Gets the description of this Frontend. # noqa: E501
|
||||
|
@ -1011,6 +1011,8 @@ paths:
|
||||
type: string
|
||||
shareToken:
|
||||
type: string
|
||||
bindAddress:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
responses:
|
||||
@ -1041,6 +1043,8 @@ paths:
|
||||
properties:
|
||||
frontendToken:
|
||||
type: string
|
||||
bindAddress:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
responses:
|
||||
@ -1245,6 +1249,10 @@ definitions:
|
||||
type: string
|
||||
shareToken:
|
||||
type: string
|
||||
backendMode:
|
||||
type: string
|
||||
bindAddress:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
zId:
|
||||
|
@ -31,6 +31,12 @@ export interface AccessRequest {
|
||||
* @memberof AccessRequest
|
||||
*/
|
||||
shareToken?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof AccessRequest
|
||||
*/
|
||||
bindAddress?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -58,6 +64,7 @@ export function AccessRequestFromJSONTyped(json: any, ignoreDiscriminator: boole
|
||||
|
||||
'envZId': json['envZId'] == null ? undefined : json['envZId'],
|
||||
'shareToken': json['shareToken'] == null ? undefined : json['shareToken'],
|
||||
'bindAddress': json['bindAddress'] == null ? undefined : json['bindAddress'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
};
|
||||
}
|
||||
@ -70,6 +77,7 @@ export function AccessRequestToJSON(value?: AccessRequest | null): any {
|
||||
|
||||
'envZId': value['envZId'],
|
||||
'shareToken': value['shareToken'],
|
||||
'bindAddress': value['bindAddress'],
|
||||
'description': value['description'],
|
||||
};
|
||||
}
|
||||
|
@ -37,6 +37,18 @@ export interface Frontend {
|
||||
* @memberof Frontend
|
||||
*/
|
||||
shareToken?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Frontend
|
||||
*/
|
||||
backendMode?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Frontend
|
||||
*/
|
||||
bindAddress?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -83,6 +95,8 @@ export function FrontendFromJSONTyped(json: any, ignoreDiscriminator: boolean):
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'frontendToken': json['frontendToken'] == null ? undefined : json['frontendToken'],
|
||||
'shareToken': json['shareToken'] == null ? undefined : json['shareToken'],
|
||||
'backendMode': json['backendMode'] == null ? undefined : json['backendMode'],
|
||||
'bindAddress': json['bindAddress'] == null ? undefined : json['bindAddress'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'zId': json['zId'] == null ? undefined : json['zId'],
|
||||
'createdAt': json['createdAt'] == null ? undefined : json['createdAt'],
|
||||
@ -99,6 +113,8 @@ export function FrontendToJSON(value?: Frontend | null): any {
|
||||
'id': value['id'],
|
||||
'frontendToken': value['frontendToken'],
|
||||
'shareToken': value['shareToken'],
|
||||
'backendMode': value['backendMode'],
|
||||
'bindAddress': value['bindAddress'],
|
||||
'description': value['description'],
|
||||
'zId': value['zId'],
|
||||
'createdAt': value['createdAt'],
|
||||
|
@ -25,6 +25,12 @@ export interface UpdateAccessRequest {
|
||||
* @memberof UpdateAccessRequest
|
||||
*/
|
||||
frontendToken?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof UpdateAccessRequest
|
||||
*/
|
||||
bindAddress?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -51,6 +57,7 @@ export function UpdateAccessRequestFromJSONTyped(json: any, ignoreDiscriminator:
|
||||
return {
|
||||
|
||||
'frontendToken': json['frontendToken'] == null ? undefined : json['frontendToken'],
|
||||
'bindAddress': json['bindAddress'] == null ? undefined : json['bindAddress'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
};
|
||||
}
|
||||
@ -62,6 +69,7 @@ export function UpdateAccessRequestToJSON(value?: UpdateAccessRequest | null): a
|
||||
return {
|
||||
|
||||
'frontendToken': value['frontendToken'],
|
||||
'bindAddress': value['bindAddress'],
|
||||
'description': value['description'],
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user