Avoid storing project_id on class instances
As of I40d0e8b6a3260ff11c493268c8a0553eba62512b, craton will no longer require users to specify the project id in the headers and request body. Change-Id: Ifb253b5d1f7a5df0e66ec15f5d1b1bf57b8a937b Depends-On: I40d0e8b6a3260ff11c493268c8a0553eba62512b Related-Bug: 1628845
This commit is contained in:
parent
e9e8ac4158
commit
a12e2cc548
@ -58,7 +58,6 @@ class Session(object):
|
||||
cratonclient.__version__)
|
||||
session = ksa_session.Session(auth=self._auth,
|
||||
user_agent=craton_user_agent)
|
||||
self.project_id = project_id
|
||||
self._session = session
|
||||
|
||||
def delete(self, url, **kwargs):
|
||||
|
@ -29,29 +29,6 @@ class RegionManager(crud.CRUDClient):
|
||||
resource_class = Region
|
||||
project_id = 0
|
||||
|
||||
def __init__(self, session, url):
|
||||
"""Initialize our RegionManager with project, session, and url."""
|
||||
super(RegionManager, self).__init__(session, url)
|
||||
self.project_id = session.project_id
|
||||
|
||||
def create(self, **kwargs):
|
||||
"""Create a region.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
>>> from cratonclient.v1 import client
|
||||
>>> from cratonclient import session
|
||||
>>> session = session.Session(
|
||||
... username='demo',
|
||||
... token='password',
|
||||
... project_id=1
|
||||
... )
|
||||
>>> client = client.Client(session, 'http://example.com')
|
||||
>>> client.regions.create(name='region')
|
||||
"""
|
||||
kwargs['project_id'] = self.project_id
|
||||
return super(RegionManager, self).create(**kwargs)
|
||||
|
||||
|
||||
REGION_FIELDS = {
|
||||
'id': 'ID',
|
||||
|
Loading…
x
Reference in New Issue
Block a user