list memberships for end users (#537)

This commit is contained in:
Michael Quigley
2024-12-10 13:28:29 -05:00
parent 5582ac0ea5
commit 3aff9950c8
25 changed files with 1636 additions and 0 deletions

View File

@ -49,6 +49,8 @@ from zrok_api.models.inline_response2001 import InlineResponse2001
from zrok_api.models.inline_response2001_members import InlineResponse2001Members
from zrok_api.models.inline_response2002 import InlineResponse2002
from zrok_api.models.inline_response2002_organizations import InlineResponse2002Organizations
from zrok_api.models.inline_response2003 import InlineResponse2003
from zrok_api.models.inline_response2003_memberships import InlineResponse2003Memberships
from zrok_api.models.inline_response201 import InlineResponse201
from zrok_api.models.invite_request import InviteRequest
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest

View File

@ -764,6 +764,91 @@ class MetadataApi(object):
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def list_memberships(self, **kwargs): # noqa: E501
"""list_memberships # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_memberships(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: InlineResponse2003
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_memberships_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.list_memberships_with_http_info(**kwargs) # noqa: E501
return data
def list_memberships_with_http_info(self, **kwargs): # noqa: E501
"""list_memberships # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_memberships_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: InlineResponse2003
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_memberships" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/zrok.v1+json']) # noqa: E501
# Authentication setting
auth_settings = ['key'] # noqa: E501
return self.api_client.call_api(
'/memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2003', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def org_account_overview(self, organization_token, account_email, **kwargs): # noqa: E501
"""org_account_overview # noqa: E501

View File

@ -39,6 +39,8 @@ from zrok_api.models.inline_response2001 import InlineResponse2001
from zrok_api.models.inline_response2001_members import InlineResponse2001Members
from zrok_api.models.inline_response2002 import InlineResponse2002
from zrok_api.models.inline_response2002_organizations import InlineResponse2002Organizations
from zrok_api.models.inline_response2003 import InlineResponse2003
from zrok_api.models.inline_response2003_memberships import InlineResponse2003Memberships
from zrok_api.models.inline_response201 import InlineResponse201
from zrok_api.models.invite_request import InviteRequest
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest

View File

@ -0,0 +1,110 @@
# coding: utf-8
"""
zrok
zrok client access # noqa: E501
OpenAPI spec version: 0.3.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class InlineResponse2003(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'memberships': 'list[InlineResponse2003Memberships]'
}
attribute_map = {
'memberships': 'memberships'
}
def __init__(self, memberships=None): # noqa: E501
"""InlineResponse2003 - a model defined in Swagger""" # noqa: E501
self._memberships = None
self.discriminator = None
if memberships is not None:
self.memberships = memberships
@property
def memberships(self):
"""Gets the memberships of this InlineResponse2003. # noqa: E501
:return: The memberships of this InlineResponse2003. # noqa: E501
:rtype: list[InlineResponse2003Memberships]
"""
return self._memberships
@memberships.setter
def memberships(self, memberships):
"""Sets the memberships of this InlineResponse2003.
:param memberships: The memberships of this InlineResponse2003. # noqa: E501
:type: list[InlineResponse2003Memberships]
"""
self._memberships = memberships
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(InlineResponse2003, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, InlineResponse2003):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@ -0,0 +1,162 @@
# coding: utf-8
"""
zrok
zrok client access # noqa: E501
OpenAPI spec version: 0.3.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class InlineResponse2003Memberships(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'token': 'str',
'description': 'str',
'admin': 'bool'
}
attribute_map = {
'token': 'token',
'description': 'description',
'admin': 'admin'
}
def __init__(self, token=None, description=None, admin=None): # noqa: E501
"""InlineResponse2003Memberships - a model defined in Swagger""" # noqa: E501
self._token = None
self._description = None
self._admin = None
self.discriminator = None
if token is not None:
self.token = token
if description is not None:
self.description = description
if admin is not None:
self.admin = admin
@property
def token(self):
"""Gets the token of this InlineResponse2003Memberships. # noqa: E501
:return: The token of this InlineResponse2003Memberships. # noqa: E501
:rtype: str
"""
return self._token
@token.setter
def token(self, token):
"""Sets the token of this InlineResponse2003Memberships.
:param token: The token of this InlineResponse2003Memberships. # noqa: E501
:type: str
"""
self._token = token
@property
def description(self):
"""Gets the description of this InlineResponse2003Memberships. # noqa: E501
:return: The description of this InlineResponse2003Memberships. # noqa: E501
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this InlineResponse2003Memberships.
:param description: The description of this InlineResponse2003Memberships. # noqa: E501
:type: str
"""
self._description = description
@property
def admin(self):
"""Gets the admin of this InlineResponse2003Memberships. # noqa: E501
:return: The admin of this InlineResponse2003Memberships. # noqa: E501
:rtype: bool
"""
return self._admin
@admin.setter
def admin(self, admin):
"""Sets the admin of this InlineResponse2003Memberships.
:param admin: The admin of this InlineResponse2003Memberships. # noqa: E501
:type: bool
"""
self._admin = admin
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(InlineResponse2003Memberships, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, InlineResponse2003Memberships):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other