diff --git a/doc/sphinx/ref/azure.cosmos.base.rst b/doc/sphinx/ref/azure.cosmos.base.rst deleted file mode 100644 index c6e3e7ac956d..000000000000 --- a/doc/sphinx/ref/azure.cosmos.base.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.base module -======================== - -.. automodule:: azure.cosmos.base - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.consistent_hash_ring.rst b/doc/sphinx/ref/azure.cosmos.consistent_hash_ring.rst deleted file mode 100644 index e4e19decf6e7..000000000000 --- a/doc/sphinx/ref/azure.cosmos.consistent_hash_ring.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.consistent\_hash\_ring module -========================================== - -.. automodule:: azure.cosmos.consistent_hash_ring - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.constants.rst b/doc/sphinx/ref/azure.cosmos.constants.rst deleted file mode 100644 index c929451faff4..000000000000 --- a/doc/sphinx/ref/azure.cosmos.constants.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.constants module -============================= - -.. automodule:: azure.cosmos.constants - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.cosmos_client_connection.rst b/doc/sphinx/ref/azure.cosmos.cosmos_client_connection.rst deleted file mode 100644 index c93e1acb1514..000000000000 --- a/doc/sphinx/ref/azure.cosmos.cosmos_client_connection.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.cosmos\_client\_connection module -============================================== - -.. automodule:: azure.cosmos.cosmos_client_connection - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.default_retry_policy.rst b/doc/sphinx/ref/azure.cosmos.default_retry_policy.rst deleted file mode 100644 index ba6e2b9e272e..000000000000 --- a/doc/sphinx/ref/azure.cosmos.default_retry_policy.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.default\_retry\_policy module -========================================== - -.. automodule:: azure.cosmos.default_retry_policy - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.endpoint_discovery_retry_policy.rst b/doc/sphinx/ref/azure.cosmos.endpoint_discovery_retry_policy.rst deleted file mode 100644 index 1d8317d5901b..000000000000 --- a/doc/sphinx/ref/azure.cosmos.endpoint_discovery_retry_policy.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.endpoint\_discovery\_retry\_policy module -====================================================== - -.. automodule:: azure.cosmos.endpoint_discovery_retry_policy - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.execution_context.aggregators.rst b/doc/sphinx/ref/azure.cosmos.execution_context.aggregators.rst deleted file mode 100644 index 038b0f2fe6b6..000000000000 --- a/doc/sphinx/ref/azure.cosmos.execution_context.aggregators.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.execution\_context.aggregators module -================================================== - -.. automodule:: azure.cosmos.execution_context.aggregators - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.execution_context.base_execution_context.rst b/doc/sphinx/ref/azure.cosmos.execution_context.base_execution_context.rst deleted file mode 100644 index 2b1b41fa50d3..000000000000 --- a/doc/sphinx/ref/azure.cosmos.execution_context.base_execution_context.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.execution\_context.base\_execution\_context module -=============================================================== - -.. automodule:: azure.cosmos.execution_context.base_execution_context - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.execution_context.document_producer.rst b/doc/sphinx/ref/azure.cosmos.execution_context.document_producer.rst deleted file mode 100644 index 0cbf680d934a..000000000000 --- a/doc/sphinx/ref/azure.cosmos.execution_context.document_producer.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.execution\_context.document\_producer module -========================================================= - -.. automodule:: azure.cosmos.execution_context.document_producer - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.execution_context.endpoint_component.rst b/doc/sphinx/ref/azure.cosmos.execution_context.endpoint_component.rst deleted file mode 100644 index 669d9f0dd0cf..000000000000 --- a/doc/sphinx/ref/azure.cosmos.execution_context.endpoint_component.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.execution\_context.endpoint\_component module -========================================================== - -.. automodule:: azure.cosmos.execution_context.endpoint_component - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.execution_context.execution_dispatcher.rst b/doc/sphinx/ref/azure.cosmos.execution_context.execution_dispatcher.rst deleted file mode 100644 index e98b8b414a00..000000000000 --- a/doc/sphinx/ref/azure.cosmos.execution_context.execution_dispatcher.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.execution\_context.execution\_dispatcher module -============================================================ - -.. automodule:: azure.cosmos.execution_context.execution_dispatcher - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.execution_context.multi_execution_aggregator.rst b/doc/sphinx/ref/azure.cosmos.execution_context.multi_execution_aggregator.rst deleted file mode 100644 index 94c4002103fe..000000000000 --- a/doc/sphinx/ref/azure.cosmos.execution_context.multi_execution_aggregator.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.execution\_context.multi\_execution\_aggregator module -=================================================================== - -.. automodule:: azure.cosmos.execution_context.multi_execution_aggregator - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.execution_context.query_execution_info.rst b/doc/sphinx/ref/azure.cosmos.execution_context.query_execution_info.rst deleted file mode 100644 index c80fc761f649..000000000000 --- a/doc/sphinx/ref/azure.cosmos.execution_context.query_execution_info.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.execution\_context.query\_execution\_info module -============================================================= - -.. automodule:: azure.cosmos.execution_context.query_execution_info - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.execution_context.rst b/doc/sphinx/ref/azure.cosmos.execution_context.rst deleted file mode 100644 index c294de2d2e2d..000000000000 --- a/doc/sphinx/ref/azure.cosmos.execution_context.rst +++ /dev/null @@ -1,23 +0,0 @@ -azure.cosmos.execution\_context package -======================================= - -Submodules ----------- - -.. toctree:: - - azure.cosmos.execution_context.aggregators - azure.cosmos.execution_context.base_execution_context - azure.cosmos.execution_context.document_producer - azure.cosmos.execution_context.endpoint_component - azure.cosmos.execution_context.execution_dispatcher - azure.cosmos.execution_context.multi_execution_aggregator - azure.cosmos.execution_context.query_execution_info - -Module contents ---------------- - -.. automodule:: azure.cosmos.execution_context - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.global_endpoint_manager.rst b/doc/sphinx/ref/azure.cosmos.global_endpoint_manager.rst deleted file mode 100644 index 8c6555c51860..000000000000 --- a/doc/sphinx/ref/azure.cosmos.global_endpoint_manager.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.global\_endpoint\_manager module -============================================= - -.. automodule:: azure.cosmos.global_endpoint_manager - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.hash_partition_resolver.rst b/doc/sphinx/ref/azure.cosmos.hash_partition_resolver.rst deleted file mode 100644 index 8186b372a0b5..000000000000 --- a/doc/sphinx/ref/azure.cosmos.hash_partition_resolver.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.hash\_partition\_resolver module -============================================= - -.. automodule:: azure.cosmos.hash_partition_resolver - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.location_cache.rst b/doc/sphinx/ref/azure.cosmos.location_cache.rst deleted file mode 100644 index 493f97ded96e..000000000000 --- a/doc/sphinx/ref/azure.cosmos.location_cache.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.location\_cache module -=================================== - -.. automodule:: azure.cosmos.location_cache - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.murmur_hash.rst b/doc/sphinx/ref/azure.cosmos.murmur_hash.rst deleted file mode 100644 index b707b587cdd5..000000000000 --- a/doc/sphinx/ref/azure.cosmos.murmur_hash.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.murmur\_hash module -================================ - -.. automodule:: azure.cosmos.murmur_hash - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.partition.rst b/doc/sphinx/ref/azure.cosmos.partition.rst deleted file mode 100644 index 24dc52be7284..000000000000 --- a/doc/sphinx/ref/azure.cosmos.partition.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.partition module -============================= - -.. automodule:: azure.cosmos.partition - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.query_iterable.rst b/doc/sphinx/ref/azure.cosmos.query_iterable.rst deleted file mode 100644 index 201f7eb62de8..000000000000 --- a/doc/sphinx/ref/azure.cosmos.query_iterable.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.query\_iterable module -=================================== - -.. automodule:: azure.cosmos.query_iterable - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.range.rst b/doc/sphinx/ref/azure.cosmos.range.rst deleted file mode 100644 index 1d405b489229..000000000000 --- a/doc/sphinx/ref/azure.cosmos.range.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.range module -========================= - -.. automodule:: azure.cosmos.range - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.range_partition_resolver.rst b/doc/sphinx/ref/azure.cosmos.range_partition_resolver.rst deleted file mode 100644 index 98072b272d88..000000000000 --- a/doc/sphinx/ref/azure.cosmos.range_partition_resolver.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.range\_partition\_resolver module -============================================== - -.. automodule:: azure.cosmos.range_partition_resolver - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.request_object.rst b/doc/sphinx/ref/azure.cosmos.request_object.rst deleted file mode 100644 index 6148122d9d39..000000000000 --- a/doc/sphinx/ref/azure.cosmos.request_object.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.request\_object module -=================================== - -.. automodule:: azure.cosmos.request_object - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.resource_throttle_retry_policy.rst b/doc/sphinx/ref/azure.cosmos.resource_throttle_retry_policy.rst deleted file mode 100644 index e0d232ebb7d8..000000000000 --- a/doc/sphinx/ref/azure.cosmos.resource_throttle_retry_policy.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.resource\_throttle\_retry\_policy module -===================================================== - -.. automodule:: azure.cosmos.resource_throttle_retry_policy - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.retry_options.rst b/doc/sphinx/ref/azure.cosmos.retry_options.rst deleted file mode 100644 index 16b91d2d4ab2..000000000000 --- a/doc/sphinx/ref/azure.cosmos.retry_options.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.retry\_options module -================================== - -.. automodule:: azure.cosmos.retry_options - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.retry_utility.rst b/doc/sphinx/ref/azure.cosmos.retry_utility.rst deleted file mode 100644 index 202552095a77..000000000000 --- a/doc/sphinx/ref/azure.cosmos.retry_utility.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.retry\_utility module -================================== - -.. automodule:: azure.cosmos.retry_utility - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.routing.collection_routing_map.rst b/doc/sphinx/ref/azure.cosmos.routing.collection_routing_map.rst deleted file mode 100644 index ae20b7ca66df..000000000000 --- a/doc/sphinx/ref/azure.cosmos.routing.collection_routing_map.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.routing.collection\_routing\_map module -==================================================== - -.. automodule:: azure.cosmos.routing.collection_routing_map - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.routing.routing_map_provider.rst b/doc/sphinx/ref/azure.cosmos.routing.routing_map_provider.rst deleted file mode 100644 index 6e5f248b7ebd..000000000000 --- a/doc/sphinx/ref/azure.cosmos.routing.routing_map_provider.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.routing.routing\_map\_provider module -================================================== - -.. automodule:: azure.cosmos.routing.routing_map_provider - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.routing.routing_range.rst b/doc/sphinx/ref/azure.cosmos.routing.routing_range.rst deleted file mode 100644 index 21eb737efa58..000000000000 --- a/doc/sphinx/ref/azure.cosmos.routing.routing_range.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.routing.routing\_range module -========================================== - -.. automodule:: azure.cosmos.routing.routing_range - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.routing.rst b/doc/sphinx/ref/azure.cosmos.routing.rst deleted file mode 100644 index 510474cdcc07..000000000000 --- a/doc/sphinx/ref/azure.cosmos.routing.rst +++ /dev/null @@ -1,19 +0,0 @@ -azure.cosmos.routing package -============================ - -Submodules ----------- - -.. toctree:: - - azure.cosmos.routing.collection_routing_map - azure.cosmos.routing.routing_map_provider - azure.cosmos.routing.routing_range - -Module contents ---------------- - -.. automodule:: azure.cosmos.routing - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.rst b/doc/sphinx/ref/azure.cosmos.rst index c6f7eec47cd0..223c5d09b63e 100644 --- a/doc/sphinx/ref/azure.cosmos.rst +++ b/doc/sphinx/ref/azure.cosmos.rst @@ -1,56 +1,24 @@ azure.cosmos package ==================== -Subpackages ------------ - -.. toctree:: - - azure.cosmos.execution_context - azure.cosmos.routing - Submodules ---------- .. toctree:: azure.cosmos.auth - azure.cosmos.base - azure.cosmos.consistent_hash_ring - azure.cosmos.constants azure.cosmos.container azure.cosmos.cosmos_client - azure.cosmos.cosmos_client_connection azure.cosmos.database - azure.cosmos.default_retry_policy azure.cosmos.diagnostics azure.cosmos.documents - azure.cosmos.endpoint_discovery_retry_policy azure.cosmos.errors - azure.cosmos.global_endpoint_manager - azure.cosmos.hash_partition_resolver azure.cosmos.http_constants - azure.cosmos.location_cache - azure.cosmos.murmur_hash azure.cosmos.offer - azure.cosmos.partition azure.cosmos.partition_key azure.cosmos.permission - azure.cosmos.query_iterable - azure.cosmos.range - azure.cosmos.range_partition_resolver - azure.cosmos.request_object - azure.cosmos.resource_throttle_retry_policy - azure.cosmos.retry_options - azure.cosmos.retry_utility - azure.cosmos.runtime_constants azure.cosmos.scripts - azure.cosmos.session - azure.cosmos.session_retry_policy - azure.cosmos.synchronized_request azure.cosmos.user - azure.cosmos.utils - azure.cosmos.vector_session_token Module contents --------------- diff --git a/doc/sphinx/ref/azure.cosmos.runtime_constants.rst b/doc/sphinx/ref/azure.cosmos.runtime_constants.rst deleted file mode 100644 index 9d162692291e..000000000000 --- a/doc/sphinx/ref/azure.cosmos.runtime_constants.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.runtime\_constants module -====================================== - -.. automodule:: azure.cosmos.runtime_constants - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.session.rst b/doc/sphinx/ref/azure.cosmos.session.rst deleted file mode 100644 index 7d1e4cb8d31c..000000000000 --- a/doc/sphinx/ref/azure.cosmos.session.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.session module -=========================== - -.. automodule:: azure.cosmos.session - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.session_retry_policy.rst b/doc/sphinx/ref/azure.cosmos.session_retry_policy.rst deleted file mode 100644 index 976d829c39a7..000000000000 --- a/doc/sphinx/ref/azure.cosmos.session_retry_policy.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.session\_retry\_policy module -========================================== - -.. automodule:: azure.cosmos.session_retry_policy - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.synchronized_request.rst b/doc/sphinx/ref/azure.cosmos.synchronized_request.rst deleted file mode 100644 index 3c871df5b2d1..000000000000 --- a/doc/sphinx/ref/azure.cosmos.synchronized_request.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.synchronized\_request module -========================================= - -.. automodule:: azure.cosmos.synchronized_request - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.utils.rst b/doc/sphinx/ref/azure.cosmos.utils.rst deleted file mode 100644 index 9fd2bbc2c9e9..000000000000 --- a/doc/sphinx/ref/azure.cosmos.utils.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.utils module -========================= - -.. automodule:: azure.cosmos.utils - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/sphinx/ref/azure.cosmos.vector_session_token.rst b/doc/sphinx/ref/azure.cosmos.vector_session_token.rst deleted file mode 100644 index 57e7959f250f..000000000000 --- a/doc/sphinx/ref/azure.cosmos.vector_session_token.rst +++ /dev/null @@ -1,7 +0,0 @@ -azure.cosmos.vector\_session\_token module -========================================== - -.. automodule:: azure.cosmos.vector_session_token - :members: - :undoc-members: - :show-inheritance: diff --git a/sdk/cosmos/azure-cosmos/HISTORY.md b/sdk/cosmos/azure-cosmos/HISTORY.md index 7d0212698a42..46198db224a1 100644 --- a/sdk/cosmos/azure-cosmos/HISTORY.md +++ b/sdk/cosmos/azure-cosmos/HISTORY.md @@ -1,5 +1,20 @@ # Change Log azure-cosmos +## Version 4.0.0b4: + +- Added support for a `timeout` keyword argument to all operations to specify an absolute timeout in seconds + within which the operation must be completed. If the timeout value is exceeded, a `azure.cosmos.errors.CosmosClientTimeoutError` will be raised. +- Added a new `ConnectionRetryPolicy` to manage retry behaviour during HTTP connection errors. +- Added new constructor and per-operation configuration keyword arguments: + -`retry_total` - Maximum retry attempts. + -`retry_backoff_max` - Maximum retry wait time in seconds. + -`retry_fixed_interval` - Fixed retry interval in milliseconds. + -`retry_read` - Maximum number of socket read retry attempts. + -`retry_connect` - Maximum number of connection error retry attempts. + -`retry_status` - Maximum number of retry attempts on error status codes. + -`retry_on_status_codes` - A list of specific status codes to retry on. + -`retry_backoff_factor` - Factor to calculate wait time between retry attempts. + ## Version 4.0.0b3: - Added `create_database_if_not_exists()` and `create_container_if_not_exists` functionalities to CosmosClient and Database respectively. diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/container.py b/sdk/cosmos/azure-cosmos/azure/cosmos/container.py index f2418eb15d76..5e03290cfde3 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/container.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/container.py @@ -176,14 +176,15 @@ def read_item( :raise `CosmosHttpResponseError`: If the given item couldn't be retrieved. :rtype: dict[str, Any] - .. literalinclude:: ../../samples/examples.py - :start-after: [START update_item] - :end-before: [END update_item] - :language: python - :dedent: 0 - :caption: Get an item from the database and update one of its properties: - :name: update_item - + .. admonition:: Example: + + .. literalinclude:: ../../samples/examples.py + :start-after: [START update_item] + :end-before: [END update_item] + :language: python + :dedent: 0 + :caption: Get an item from the database and update one of its properties: + :name: update_item """ doc_link = self._get_document_link(item) request_options = build_options(kwargs) @@ -320,22 +321,23 @@ def query_items( :returns: An Iterable of items (dicts). :rtype: Iterable[dict[str, Any]] - .. literalinclude:: ../../samples/examples.py - :start-after: [START query_items] - :end-before: [END query_items] - :language: python - :dedent: 0 - :caption: Get all products that have not been discontinued: - :name: query_items - - .. literalinclude:: ../../samples/examples.py - :start-after: [START query_items_param] - :end-before: [END query_items_param] - :language: python - :dedent: 0 - :caption: Parameterized query to get all products that have been discontinued: - :name: query_items_param - + .. admonition:: Example: + + .. literalinclude:: ../../samples/examples.py + :start-after: [START query_items] + :end-before: [END query_items] + :language: python + :dedent: 0 + :caption: Get all products that have not been discontinued: + :name: query_items + + .. literalinclude:: ../../samples/examples.py + :start-after: [START query_items_param] + :end-before: [END query_items_param] + :language: python + :dedent: 0 + :caption: Parameterized query to get all products that have been discontinued: + :name: query_items_param """ feed_options = build_options(kwargs) response_hook = kwargs.pop('response_hook', None) diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/cosmos_client.py b/sdk/cosmos/azure-cosmos/azure/cosmos/cosmos_client.py index 28536884dd4b..82ff11459b3c 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/cosmos_client.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/cosmos_client.py @@ -134,38 +134,60 @@ class CosmosClient(object): **Keyword arguments:** + *timeout* - An absolute timeout in seconds, for the combined HTTP request and response processing. + *request_timeout* - The HTTP request timeout in seconds. + *media_request_timeout* - The media request timeout in seconds. + *connection_mode* - The connection mode for the client - currently only supports 'Gateway'. + *media_read_mode* - The mode for use with downloading attachment content - default value is `Buffered`. - *proxy_config* - Instance of ~azure.cosmos.documents.ProxyConfiguration - *ssl_config* - Instance of ~azure.cosmos.documents.SSLConfiguration + + *proxy_config* - Instance of ~azure.cosmos.documents.ProxyConfiguration. + + *ssl_config* - Instance of ~azure.cosmos.documents.SSLConfiguration. + *connection_verify* - Whether to verify the connection, default value is True. + *connection_cert* - An alternative certificate to verify the connection. + *retry_total* - Maximum retry attempts. + *retry_backoff_max* - Maximum retry wait time in seconds. + *retry_fixed_interval* - Fixed retry interval in milliseconds. + *retry_read* - Maximum number of socket read retry attempts. + *retry_connect* - Maximum number of connection error retry attempts. + *retry_status* - Maximum number of retry attempts on error status codes. + *retry_on_status_codes* - A list of specific status codes to retry on. + *retry_backoff_factor* - Factor to calculate wait time between retry attempts. + *enable_endpoint_discovery* - Enable endpoint discovery for geo-replicated database accounts. Default is True. + *preferred_locations* - The preferred locations for geo-replicated database accounts. When `enable_endpoint_discovery` is true and `preferred_locations` is non-empty, the client will use this list to evaluate the final location, taking into consideration the order specified in `preferred_locations` list. The locations in this list are specified as the names of the azure Cosmos locations like, 'West US', 'East US', 'Central India' and so on. + *connection_policy* - An instance of ~azure.cosmos.documents.ConnectionPolicy - .. literalinclude:: ../../samples/examples.py - :start-after: [START create_client] - :end-before: [END create_client] - :language: python - :dedent: 0 - :caption: Create a new instance of the Cosmos DB client: - :name: create_client + .. admonition:: Example: + + .. literalinclude:: ../../samples/examples.py + :start-after: [START create_client] + :end-before: [END create_client] + :language: python + :dedent: 0 + :caption: Create a new instance of the Cosmos DB client: + :name: create_client """ def __init__(self, url, credential, consistency_level="Session", **kwargs): @@ -243,14 +265,15 @@ def create_database( # pylint: disable=redefined-builtin :rtype: ~azure.cosmos.database.DatabaseProxy :raises `CosmosResourceExistsError`: If database with the given ID already exists. - .. literalinclude:: ../../samples/examples.py - :start-after: [START create_database] - :end-before: [END create_database] - :language: python - :dedent: 0 - :caption: Create a database in the Cosmos DB account: - :name: create_database + .. admonition:: Example: + .. literalinclude:: ../../samples/examples.py + :start-after: [START create_database] + :end-before: [END create_database] + :language: python + :dedent: 0 + :caption: Create a database in the Cosmos DB account: + :name: create_database """ request_options = build_options(kwargs) @@ -341,9 +364,9 @@ def list_databases( :param int max_item_count: Max number of items to be returned in the enumeration operation. :param str session_token: Token for use with Session consistency. - :param dict[str, str] initial_headers: Initial headers to be sent as part of the request. + :param dict(str, str) initial_headers: Initial headers to be sent as part of the request. :param bool populate_query_metrics: Enable returning query metrics in response headers. - :param dict[str, str] feed_options: Dictionary of additional properties to be used for the request. + :param dict(str, str) feed_options: Dictionary of additional properties to be used for the request. :param Callable response_hook: a callable invoked with the response metadata :returns: An Iterable of database properties (dicts). :rtype: Iterable[dict[str, str]] diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/database.py b/sdk/cosmos/azure-cosmos/azure/cosmos/database.py index 17331a7b28c7..c7c70945579b 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/database.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/database.py @@ -177,22 +177,23 @@ def create_container( :raise CosmosHttpResponseError: The container creation failed. :rtype: ~azure.cosmos.container.ContainerProxy - .. literalinclude:: ../../samples/examples.py - :start-after: [START create_container] - :end-before: [END create_container] - :language: python - :dedent: 0 - :caption: Create a container with default settings: - :name: create_container - - .. literalinclude:: ../../samples/examples.py - :start-after: [START create_container_with_settings] - :end-before: [END create_container_with_settings] - :language: python - :dedent: 0 - :caption: Create a container with specific settings; in this case, a custom partition key: - :name: create_container_with_settings - + .. admonition:: Example: + + .. literalinclude:: ../../samples/examples.py + :start-after: [START create_container] + :end-before: [END create_container] + :language: python + :dedent: 0 + :caption: Create a container with default settings: + :name: create_container + + .. literalinclude:: ../../samples/examples.py + :start-after: [START create_container_with_settings] + :end-before: [END create_container_with_settings] + :language: python + :dedent: 0 + :caption: Create a container with specific settings; in this case, a custom partition key: + :name: create_container_with_settings """ definition = dict(id=id) # type: Dict[str, Any] if partition_key: @@ -322,14 +323,15 @@ def get_container_client(self, container): or a dict representing the properties of the container to be retrieved. :rtype: ~azure.cosmos.container.ContainerProxy - .. literalinclude:: ../../samples/examples.py - :start-after: [START get_container] - :end-before: [END get_container] - :language: python - :dedent: 0 - :caption: Get an existing container, handling a failure if encountered: - :name: get_container + .. admonition:: Example: + .. literalinclude:: ../../samples/examples.py + :start-after: [START get_container] + :end-before: [END get_container] + :language: python + :dedent: 0 + :caption: Get an existing container, handling a failure if encountered: + :name: get_container """ if isinstance(container, ContainerProxy): id_value = container.id @@ -355,14 +357,15 @@ def list_containers(self, max_item_count=None, populate_query_metrics=None, **kw :returns: An Iterable of container properties (dicts). :rtype: Iterable[dict[str, Any]] - .. literalinclude:: ../../samples/examples.py - :start-after: [START list_containers] - :end-before: [END list_containers] - :language: python - :dedent: 0 - :caption: List all containers in the database: - :name: list_containers + .. admonition:: Example: + .. literalinclude:: ../../samples/examples.py + :start-after: [START list_containers] + :end-before: [END list_containers] + :language: python + :dedent: 0 + :caption: List all containers in the database: + :name: list_containers """ feed_options = build_options(kwargs) response_hook = kwargs.pop('response_hook', None) @@ -453,14 +456,15 @@ def replace_container( :returns: A `ContainerProxy` instance representing the container after replace completed. :rtype: ~azure.cosmos.container.ContainerProxy - .. literalinclude:: ../../samples/examples.py - :start-after: [START reset_container_properties] - :end-before: [END reset_container_properties] - :language: python - :dedent: 0 - :caption: Reset the TTL property on a container, and display the updated properties: - :name: reset_container_properties + .. admonition:: Example: + .. literalinclude:: ../../samples/examples.py + :start-after: [START reset_container_properties] + :end-before: [END reset_container_properties] + :language: python + :dedent: 0 + :caption: Reset the TTL property on a container, and display the updated properties: + :name: reset_container_properties """ request_options = build_options(kwargs) response_hook = kwargs.pop('response_hook', None) @@ -580,14 +584,15 @@ def create_user(self, body, **kwargs): :raise `CosmosHttpResponseError`: If the given user couldn't be created. :rtype: ~azure.cosmos.user.UserProxy - .. literalinclude:: ../../samples/examples.py - :start-after: [START create_user] - :end-before: [END create_user] - :language: python - :dedent: 0 - :caption: Create a database user: - :name: create_user + .. admonition:: Example: + .. literalinclude:: ../../samples/examples.py + :start-after: [START create_user] + :end-before: [END create_user] + :language: python + :dedent: 0 + :caption: Create a database user: + :name: create_user """ request_options = build_options(kwargs) response_hook = kwargs.pop('response_hook', None)