mirror of
https://github.com/openziti/zrok.git
synced 2024-11-24 17:13:51 +01:00
updated api spec to support permission mode and access grans (#432)
This commit is contained in:
parent
1e73f185d8
commit
dce32b58d2
@ -21,6 +21,9 @@ import (
|
||||
// swagger:model shareRequest
|
||||
type ShareRequest struct {
|
||||
|
||||
// access grants
|
||||
AccessGrants []string `json:"accessGrants"`
|
||||
|
||||
// auth scheme
|
||||
AuthScheme string `json:"authScheme,omitempty"`
|
||||
|
||||
@ -50,6 +53,10 @@ type ShareRequest struct {
|
||||
// Enum: [github google]
|
||||
OauthProvider string `json:"oauthProvider,omitempty"`
|
||||
|
||||
// permission mode
|
||||
// Enum: [open closed]
|
||||
PermissionMode string `json:"permissionMode,omitempty"`
|
||||
|
||||
// reserved
|
||||
Reserved bool `json:"reserved,omitempty"`
|
||||
|
||||
@ -77,6 +84,10 @@ func (m *ShareRequest) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validatePermissionMode(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateShareMode(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@ -212,6 +223,48 @@ func (m *ShareRequest) validateOauthProvider(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var shareRequestTypePermissionModePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["open","closed"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
shareRequestTypePermissionModePropEnum = append(shareRequestTypePermissionModePropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// ShareRequestPermissionModeOpen captures enum value "open"
|
||||
ShareRequestPermissionModeOpen string = "open"
|
||||
|
||||
// ShareRequestPermissionModeClosed captures enum value "closed"
|
||||
ShareRequestPermissionModeClosed string = "closed"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *ShareRequest) validatePermissionModeEnum(path, location string, value string) error {
|
||||
if err := validate.EnumCase(path, location, value, shareRequestTypePermissionModePropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ShareRequest) validatePermissionMode(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.PermissionMode) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validatePermissionModeEnum("permissionMode", "body", m.PermissionMode); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var shareRequestTypeShareModePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
|
@ -1562,6 +1562,12 @@ func init() {
|
||||
"shareRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accessGrants": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"authScheme": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -1611,6 +1617,13 @@ func init() {
|
||||
"google"
|
||||
]
|
||||
},
|
||||
"permissionMode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"open",
|
||||
"closed"
|
||||
]
|
||||
},
|
||||
"reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@ -3289,6 +3302,12 @@ func init() {
|
||||
"shareRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accessGrants": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"authScheme": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -3338,6 +3357,13 @@ func init() {
|
||||
"google"
|
||||
]
|
||||
},
|
||||
"permissionMode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"open",
|
||||
"closed"
|
||||
]
|
||||
},
|
||||
"reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
@ -39,6 +39,8 @@ class ShareRequest(object):
|
||||
'oauth_email_domains': 'list[str]',
|
||||
'oauth_authorization_check_interval': 'str',
|
||||
'reserved': 'bool',
|
||||
'permission_mode': 'str',
|
||||
'access_grants': 'list[str]',
|
||||
'unique_name': 'str'
|
||||
}
|
||||
|
||||
@ -54,10 +56,12 @@ class ShareRequest(object):
|
||||
'oauth_email_domains': 'oauthEmailDomains',
|
||||
'oauth_authorization_check_interval': 'oauthAuthorizationCheckInterval',
|
||||
'reserved': 'reserved',
|
||||
'permission_mode': 'permissionMode',
|
||||
'access_grants': 'accessGrants',
|
||||
'unique_name': 'uniqueName'
|
||||
}
|
||||
|
||||
def __init__(self, env_zid=None, share_mode=None, frontend_selection=None, backend_mode=None, backend_proxy_endpoint=None, auth_scheme=None, auth_users=None, oauth_provider=None, oauth_email_domains=None, oauth_authorization_check_interval=None, reserved=None, unique_name=None): # noqa: E501
|
||||
def __init__(self, env_zid=None, share_mode=None, frontend_selection=None, backend_mode=None, backend_proxy_endpoint=None, auth_scheme=None, auth_users=None, oauth_provider=None, oauth_email_domains=None, oauth_authorization_check_interval=None, reserved=None, permission_mode=None, access_grants=None, unique_name=None): # noqa: E501
|
||||
"""ShareRequest - a model defined in Swagger""" # noqa: E501
|
||||
self._env_zid = None
|
||||
self._share_mode = None
|
||||
@ -70,6 +74,8 @@ class ShareRequest(object):
|
||||
self._oauth_email_domains = None
|
||||
self._oauth_authorization_check_interval = None
|
||||
self._reserved = None
|
||||
self._permission_mode = None
|
||||
self._access_grants = None
|
||||
self._unique_name = None
|
||||
self.discriminator = None
|
||||
if env_zid is not None:
|
||||
@ -94,6 +100,10 @@ class ShareRequest(object):
|
||||
self.oauth_authorization_check_interval = oauth_authorization_check_interval
|
||||
if reserved is not None:
|
||||
self.reserved = reserved
|
||||
if permission_mode is not None:
|
||||
self.permission_mode = permission_mode
|
||||
if access_grants is not None:
|
||||
self.access_grants = access_grants
|
||||
if unique_name is not None:
|
||||
self.unique_name = unique_name
|
||||
|
||||
@ -346,6 +356,54 @@ class ShareRequest(object):
|
||||
|
||||
self._reserved = reserved
|
||||
|
||||
@property
|
||||
def permission_mode(self):
|
||||
"""Gets the permission_mode of this ShareRequest. # noqa: E501
|
||||
|
||||
|
||||
:return: The permission_mode of this ShareRequest. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._permission_mode
|
||||
|
||||
@permission_mode.setter
|
||||
def permission_mode(self, permission_mode):
|
||||
"""Sets the permission_mode of this ShareRequest.
|
||||
|
||||
|
||||
:param permission_mode: The permission_mode of this ShareRequest. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
allowed_values = ["open", "closed"] # noqa: E501
|
||||
if permission_mode not in allowed_values:
|
||||
raise ValueError(
|
||||
"Invalid value for `permission_mode` ({0}), must be one of {1}" # noqa: E501
|
||||
.format(permission_mode, allowed_values)
|
||||
)
|
||||
|
||||
self._permission_mode = permission_mode
|
||||
|
||||
@property
|
||||
def access_grants(self):
|
||||
"""Gets the access_grants of this ShareRequest. # noqa: E501
|
||||
|
||||
|
||||
:return: The access_grants of this ShareRequest. # noqa: E501
|
||||
:rtype: list[str]
|
||||
"""
|
||||
return self._access_grants
|
||||
|
||||
@access_grants.setter
|
||||
def access_grants(self, access_grants):
|
||||
"""Sets the access_grants of this ShareRequest.
|
||||
|
||||
|
||||
:param access_grants: The access_grants of this ShareRequest. # noqa: E501
|
||||
:type: list[str]
|
||||
"""
|
||||
|
||||
self._access_grants = access_grants
|
||||
|
||||
@property
|
||||
def unique_name(self):
|
||||
"""Gets the unique_name of this ShareRequest. # noqa: E501
|
||||
|
@ -1057,6 +1057,13 @@ definitions:
|
||||
type: string
|
||||
reserved:
|
||||
type: boolean
|
||||
permissionMode:
|
||||
type: string
|
||||
enum: ["open", "closed"]
|
||||
accessGrants:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
uniqueName:
|
||||
type: string
|
||||
|
||||
|
@ -267,6 +267,8 @@
|
||||
* @property {string[]} oauthEmailDomains
|
||||
* @property {string} oauthAuthorizationCheckInterval
|
||||
* @property {boolean} reserved
|
||||
* @property {string} permissionMode
|
||||
* @property {string[]} accessGrants
|
||||
* @property {string} uniqueName
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user