influxdb-client
Advanced tools
@@ -14,3 +14,3 @@ """Authorization is about managing the security of your InfluxDB instance.""" | ||
| def create_authorization(self, org_id=None, permissions: list = None, | ||
| def create_authorization(self, org_id: str = None, permissions: list = None, | ||
| authorization: Authorization = None) -> Authorization: | ||
@@ -27,2 +27,4 @@ """ | ||
| if authorization is not None: | ||
| if not isinstance(authorization, Authorization): | ||
| raise TypeError(f"Attempt to use non-Authorization value for authorization: {authorization}") | ||
| return self._authorizations_service.post_authorizations(authorization_post_request=authorization) | ||
@@ -29,0 +31,0 @@ |
@@ -268,3 +268,3 @@ """InfluxDBClient is client for API defined in https://github.com/influxdata/influxdb/blob/master/http/swagger.yml.""" | ||
| :param point_settings: settings to store default tags | ||
| :key success_callback: The callable ``callback`` to run after successfully writen a batch. | ||
| :key success_callback: The callable ``callback`` to run after having successfully written a batch. | ||
@@ -277,3 +277,3 @@ The callable must accept two arguments: | ||
| :key error_callback: The callable ``callback`` to run after unsuccessfully writen a batch. | ||
| :key error_callback: The callable ``callback`` to run after having unsuccessfully written a batch. | ||
@@ -280,0 +280,0 @@ The callable must accept three arguments: |
@@ -85,4 +85,8 @@ # coding: utf-8 | ||
| if org_id is not None: | ||
| if not isinstance(org_id, str): | ||
| raise TypeError("org_id must be a string.") | ||
| self.org_id = org_id | ||
| if permissions is not None: | ||
| if not isinstance(permissions, list): | ||
| raise TypeError("permissions must be a list.") | ||
| self.permissions = permissions | ||
@@ -89,0 +93,0 @@ if id is not None: |
| """Version of the Client that is used in User-Agent header.""" | ||
| VERSION = '1.48.0' | ||
| VERSION = '1.49.0' |
@@ -48,2 +48,21 @@ import pytest | ||
| def test_AuthorizationTypeAssert(self): | ||
| self.assertRaisesRegex(TypeError, "org_id must be a string.", Authorization, org_id={}) | ||
| self.assertRaisesRegex(TypeError, "permissions must be a list.", Authorization, permissions={}) | ||
| def test_createAuthorizationWrongTypes(self): | ||
| user_resource = PermissionResource(org_id=self.organization.id, type="users") | ||
| read_users = Permission(action="read", resource=user_resource) | ||
| org_resource = PermissionResource(org_id=self.organization.id, type="orgs") | ||
| write_organizations = Permission(action="write", resource=org_resource) | ||
| permissions = [read_users, write_organizations] | ||
| self.assertRaisesRegex(TypeError, "org_id must be a string.", | ||
| self.authorizations_api.create_authorization, permissions) | ||
| self.assertRaisesRegex(TypeError, "permissions must be a list", | ||
| self.authorizations_api.create_authorization, "123456789ABCDEF0", "Foo") | ||
| self.assertRaisesRegex(TypeError, "Attempt to use non-Authorization value for authorization: Foo", | ||
| self.authorizations_api.create_authorization, "123456789ABCDEF0", permissions, "Foo") | ||
| def test_authorizationDescription(self): | ||
@@ -50,0 +69,0 @@ organization = self.my_organization |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
4447117
0.6%88399
0.02%