Skip to content

Commit 1d8f682

Browse files
cloudant-sdks-automationricellis
authored andcommitted
feat(generated): update API definition to 1.0.0-dev0.1.27
Generated SDK source code using: - Generator version 3.101.0 - Specification version 1.0.0-dev0.1.27 - Automation (cloudant-sdks) version 0acdffd
1 parent 8661f8b commit 1d8f682

File tree

4 files changed

+553
-2
lines changed

4 files changed

+553
-2
lines changed

ibmcloudant/cloudant_v1.py

+321
Original file line numberDiff line numberDiff line change
@@ -8195,6 +8195,80 @@ def post_activity_tracker_events(
81958195
response = self.send(request, **kwargs)
81968196
return response
81978197

8198+
def get_capacity_databases_information(
8199+
self,
8200+
**kwargs,
8201+
) -> DetailedResponse:
8202+
"""
8203+
Retrieve maximum allowed database count.
8204+
8205+
Retrieves the maximum number of databases currently allowed in the instance.
8206+
8207+
:param dict headers: A `dict` containing the request headers
8208+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
8209+
:rtype: DetailedResponse with `dict` result representing a `CapacityDatabasesInformation` object
8210+
"""
8211+
8212+
headers = {}
8213+
sdk_headers = get_sdk_headers(
8214+
service_name=self.DEFAULT_SERVICE_NAME,
8215+
service_version='V1',
8216+
operation_id='get_capacity_databases_information',
8217+
)
8218+
headers.update(sdk_headers)
8219+
8220+
if 'headers' in kwargs:
8221+
headers.update(kwargs.get('headers'))
8222+
del kwargs['headers']
8223+
headers['Accept'] = 'application/json'
8224+
8225+
url = '/_api/v2/user/capacity/databases'
8226+
request = self.prepare_request(
8227+
method='GET',
8228+
url=url,
8229+
headers=headers,
8230+
)
8231+
8232+
response = self.send(request, **kwargs)
8233+
return response
8234+
8235+
def get_current_databases_information(
8236+
self,
8237+
**kwargs,
8238+
) -> DetailedResponse:
8239+
"""
8240+
Retrieve current database count.
8241+
8242+
Retrieves the current number of databases that exist in the instance.
8243+
8244+
:param dict headers: A `dict` containing the request headers
8245+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
8246+
:rtype: DetailedResponse with `dict` result representing a `CurrentDatabasesInformation` object
8247+
"""
8248+
8249+
headers = {}
8250+
sdk_headers = get_sdk_headers(
8251+
service_name=self.DEFAULT_SERVICE_NAME,
8252+
service_version='V1',
8253+
operation_id='get_current_databases_information',
8254+
)
8255+
headers.update(sdk_headers)
8256+
8257+
if 'headers' in kwargs:
8258+
headers.update(kwargs.get('headers'))
8259+
del kwargs['headers']
8260+
headers['Accept'] = 'application/json'
8261+
8262+
url = '/_api/v2/user/current/databases'
8263+
request = self.prepare_request(
8264+
method='GET',
8265+
url=url,
8266+
headers=headers,
8267+
)
8268+
8269+
response = self.send(request, **kwargs)
8270+
return response
8271+
81988272
def get_current_throughput_information(
81998273
self,
82008274
**kwargs,
@@ -10358,6 +10432,132 @@ def __ne__(self, other: 'BulkGetResultItem') -> bool:
1035810432
return not self == other
1035910433

1036010434

10435+
class CapacityDatabasesInformation:
10436+
"""
10437+
Schema for information about maximum total database count.
10438+
10439+
:param CapacityDatabasesInformationCurrent current: (optional) Schema for
10440+
information about the current database capacity.
10441+
"""
10442+
10443+
def __init__(
10444+
self,
10445+
*,
10446+
current: Optional['CapacityDatabasesInformationCurrent'] = None,
10447+
) -> None:
10448+
"""
10449+
Initialize a CapacityDatabasesInformation object.
10450+
10451+
:param CapacityDatabasesInformationCurrent current: (optional) Schema for
10452+
information about the current database capacity.
10453+
"""
10454+
self.current = current
10455+
10456+
@classmethod
10457+
def from_dict(cls, _dict: Dict) -> 'CapacityDatabasesInformation':
10458+
"""Initialize a CapacityDatabasesInformation object from a json dictionary."""
10459+
args = {}
10460+
if (current := _dict.get('current')) is not None:
10461+
args['current'] = CapacityDatabasesInformationCurrent.from_dict(current)
10462+
return cls(**args)
10463+
10464+
@classmethod
10465+
def _from_dict(cls, _dict):
10466+
"""Initialize a CapacityDatabasesInformation object from a json dictionary."""
10467+
return cls.from_dict(_dict)
10468+
10469+
def to_dict(self) -> Dict:
10470+
"""Return a json dictionary representing this model."""
10471+
_dict = {}
10472+
if hasattr(self, 'current') and self.current is not None:
10473+
if isinstance(self.current, dict):
10474+
_dict['current'] = self.current
10475+
else:
10476+
_dict['current'] = self.current.to_dict()
10477+
return _dict
10478+
10479+
def _to_dict(self):
10480+
"""Return a json dictionary representing this model."""
10481+
return self.to_dict()
10482+
10483+
def __str__(self) -> str:
10484+
"""Return a `str` version of this CapacityDatabasesInformation object."""
10485+
return json.dumps(self.to_dict(), indent=2)
10486+
10487+
def __eq__(self, other: 'CapacityDatabasesInformation') -> bool:
10488+
"""Return `true` when self and other are equal, false otherwise."""
10489+
if not isinstance(other, self.__class__):
10490+
return False
10491+
return self.__dict__ == other.__dict__
10492+
10493+
def __ne__(self, other: 'CapacityDatabasesInformation') -> bool:
10494+
"""Return `true` when self and other are not equal, false otherwise."""
10495+
return not self == other
10496+
10497+
10498+
class CapacityDatabasesInformationCurrent:
10499+
"""
10500+
Schema for information about the current database capacity.
10501+
10502+
:param DatabasesCountInformation databases: (optional) Schema for databases
10503+
count.
10504+
"""
10505+
10506+
def __init__(
10507+
self,
10508+
*,
10509+
databases: Optional['DatabasesCountInformation'] = None,
10510+
) -> None:
10511+
"""
10512+
Initialize a CapacityDatabasesInformationCurrent object.
10513+
10514+
:param DatabasesCountInformation databases: (optional) Schema for databases
10515+
count.
10516+
"""
10517+
self.databases = databases
10518+
10519+
@classmethod
10520+
def from_dict(cls, _dict: Dict) -> 'CapacityDatabasesInformationCurrent':
10521+
"""Initialize a CapacityDatabasesInformationCurrent object from a json dictionary."""
10522+
args = {}
10523+
if (databases := _dict.get('databases')) is not None:
10524+
args['databases'] = DatabasesCountInformation.from_dict(databases)
10525+
return cls(**args)
10526+
10527+
@classmethod
10528+
def _from_dict(cls, _dict):
10529+
"""Initialize a CapacityDatabasesInformationCurrent object from a json dictionary."""
10530+
return cls.from_dict(_dict)
10531+
10532+
def to_dict(self) -> Dict:
10533+
"""Return a json dictionary representing this model."""
10534+
_dict = {}
10535+
if hasattr(self, 'databases') and self.databases is not None:
10536+
if isinstance(self.databases, dict):
10537+
_dict['databases'] = self.databases
10538+
else:
10539+
_dict['databases'] = self.databases.to_dict()
10540+
return _dict
10541+
10542+
def _to_dict(self):
10543+
"""Return a json dictionary representing this model."""
10544+
return self.to_dict()
10545+
10546+
def __str__(self) -> str:
10547+
"""Return a `str` version of this CapacityDatabasesInformationCurrent object."""
10548+
return json.dumps(self.to_dict(), indent=2)
10549+
10550+
def __eq__(self, other: 'CapacityDatabasesInformationCurrent') -> bool:
10551+
"""Return `true` when self and other are equal, false otherwise."""
10552+
if not isinstance(other, self.__class__):
10553+
return False
10554+
return self.__dict__ == other.__dict__
10555+
10556+
def __ne__(self, other: 'CapacityDatabasesInformationCurrent') -> bool:
10557+
"""Return `true` when self and other are not equal, false otherwise."""
10558+
return not self == other
10559+
10560+
1036110561
class CapacityThroughputInformation:
1036210562
"""
1036310563
Schema for information about the currently provisioned and target throughput capacity.
@@ -10984,6 +11184,69 @@ def __ne__(self, other: 'CorsInformation') -> bool:
1098411184
return not self == other
1098511185

1098611186

11187+
class CurrentDatabasesInformation:
11188+
"""
11189+
Schema for information about the current database counts.
11190+
11191+
:param DatabasesCountInformation databases: (optional) Schema for databases
11192+
count.
11193+
"""
11194+
11195+
def __init__(
11196+
self,
11197+
*,
11198+
databases: Optional['DatabasesCountInformation'] = None,
11199+
) -> None:
11200+
"""
11201+
Initialize a CurrentDatabasesInformation object.
11202+
11203+
:param DatabasesCountInformation databases: (optional) Schema for databases
11204+
count.
11205+
"""
11206+
self.databases = databases
11207+
11208+
@classmethod
11209+
def from_dict(cls, _dict: Dict) -> 'CurrentDatabasesInformation':
11210+
"""Initialize a CurrentDatabasesInformation object from a json dictionary."""
11211+
args = {}
11212+
if (databases := _dict.get('databases')) is not None:
11213+
args['databases'] = DatabasesCountInformation.from_dict(databases)
11214+
return cls(**args)
11215+
11216+
@classmethod
11217+
def _from_dict(cls, _dict):
11218+
"""Initialize a CurrentDatabasesInformation object from a json dictionary."""
11219+
return cls.from_dict(_dict)
11220+
11221+
def to_dict(self) -> Dict:
11222+
"""Return a json dictionary representing this model."""
11223+
_dict = {}
11224+
if hasattr(self, 'databases') and self.databases is not None:
11225+
if isinstance(self.databases, dict):
11226+
_dict['databases'] = self.databases
11227+
else:
11228+
_dict['databases'] = self.databases.to_dict()
11229+
return _dict
11230+
11231+
def _to_dict(self):
11232+
"""Return a json dictionary representing this model."""
11233+
return self.to_dict()
11234+
11235+
def __str__(self) -> str:
11236+
"""Return a `str` version of this CurrentDatabasesInformation object."""
11237+
return json.dumps(self.to_dict(), indent=2)
11238+
11239+
def __eq__(self, other: 'CurrentDatabasesInformation') -> bool:
11240+
"""Return `true` when self and other are equal, false otherwise."""
11241+
if not isinstance(other, self.__class__):
11242+
return False
11243+
return self.__dict__ == other.__dict__
11244+
11245+
def __ne__(self, other: 'CurrentDatabasesInformation') -> bool:
11246+
"""Return `true` when self and other are not equal, false otherwise."""
11247+
return not self == other
11248+
11249+
1098711250
class CurrentThroughputInformation:
1098811251
"""
1098911252
Schema for information about current consumption of a provisioned throughput capacity.
@@ -11514,6 +11777,64 @@ def __ne__(self, other: 'DatabaseInformationProps') -> bool:
1151411777
return not self == other
1151511778

1151611779

11780+
class DatabasesCountInformation:
11781+
"""
11782+
Schema for databases count.
11783+
11784+
:param int total: (optional) The total number of databases.
11785+
"""
11786+
11787+
def __init__(
11788+
self,
11789+
*,
11790+
total: Optional[int] = None,
11791+
) -> None:
11792+
"""
11793+
Initialize a DatabasesCountInformation object.
11794+
11795+
:param int total: (optional) The total number of databases.
11796+
"""
11797+
self.total = total
11798+
11799+
@classmethod
11800+
def from_dict(cls, _dict: Dict) -> 'DatabasesCountInformation':
11801+
"""Initialize a DatabasesCountInformation object from a json dictionary."""
11802+
args = {}
11803+
if (total := _dict.get('total')) is not None:
11804+
args['total'] = total
11805+
return cls(**args)
11806+
11807+
@classmethod
11808+
def _from_dict(cls, _dict):
11809+
"""Initialize a DatabasesCountInformation object from a json dictionary."""
11810+
return cls.from_dict(_dict)
11811+
11812+
def to_dict(self) -> Dict:
11813+
"""Return a json dictionary representing this model."""
11814+
_dict = {}
11815+
if hasattr(self, 'total') and self.total is not None:
11816+
_dict['total'] = self.total
11817+
return _dict
11818+
11819+
def _to_dict(self):
11820+
"""Return a json dictionary representing this model."""
11821+
return self.to_dict()
11822+
11823+
def __str__(self) -> str:
11824+
"""Return a `str` version of this DatabasesCountInformation object."""
11825+
return json.dumps(self.to_dict(), indent=2)
11826+
11827+
def __eq__(self, other: 'DatabasesCountInformation') -> bool:
11828+
"""Return `true` when self and other are equal, false otherwise."""
11829+
if not isinstance(other, self.__class__):
11830+
return False
11831+
return self.__dict__ == other.__dict__
11832+
11833+
def __ne__(self, other: 'DatabasesCountInformation') -> bool:
11834+
"""Return `true` when self and other are not equal, false otherwise."""
11835+
return not self == other
11836+
11837+
1151711838
class DbEvent:
1151811839
"""
1151911840
Schema for a database change event.

stubs/gen-its-mappings.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@
445445
"uuid": "a2e4e696-e631-33f8-b168-5015048cdad8"
446446
},
447447
{
448-
"id": "8593b1aa-6297-3120-a04e-c199e2808167",
448+
"id": "8593b1aa-6297-3120-a04e-c199e2808168",
449449
"request": {
450450
"url": "/_api/v2/user/current/databases",
451451
"method": "GET"
@@ -473,7 +473,7 @@
473473
}
474474
}
475475
},
476-
"uuid": "8593b1aa-6297-3120-a04e-c199e2808167"
476+
"uuid": "8593b1aa-6297-3120-a04e-c199e2808168"
477477
},
478478
{
479479
"id": "8c38b725-a6ac-3f63-a723-9f4925ae23fd",

test/integration/test_cloudant_v1.py

+16
Original file line numberDiff line numberDiff line change
@@ -2033,6 +2033,22 @@ def test_post_activity_tracker_events(self):
20332033
ok = response.get_result()
20342034
assert ok is not None
20352035

2036+
@needscredentials
2037+
def test_get_capacity_databases_information(self):
2038+
response = self.cloudant_service.get_capacity_databases_information()
2039+
2040+
assert response.get_status_code() == 200
2041+
capacity_databases_information = response.get_result()
2042+
assert capacity_databases_information is not None
2043+
2044+
@needscredentials
2045+
def test_get_current_databases_information(self):
2046+
response = self.cloudant_service.get_current_databases_information()
2047+
2048+
assert response.get_status_code() == 200
2049+
current_databases_information = response.get_result()
2050+
assert current_databases_information is not None
2051+
20362052
@needscredentials
20372053
def test_get_current_throughput_information(self):
20382054
response = self.cloudant_service.get_current_throughput_information()

0 commit comments

Comments
 (0)