diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py index bcd1a6c706ea..2bdf807a0821 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py @@ -29,12 +29,14 @@ class CosmosDBManagementClientConfiguration(AzureConfiguration): """ def __init__( - self, credentials, subscription_id, base_url=None): + self, credentials, subscription_id, subscription_id1, base_url=None): if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + if subscription_id1 is None: + raise ValueError("Parameter 'subscription_id1' must not be None.") if not base_url: base_url = 'https://management.azure.com' @@ -48,3 +50,4 @@ def __init__( self.credentials = credentials self.subscription_id = subscription_id + self.subscription_id1 = subscription_id1 diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py index a54d59f8452d..0639ddc73a6a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_cosmos_db_management_client.py @@ -31,6 +31,7 @@ from .operations import TableResourcesOperations from .operations import CassandraResourcesOperations from .operations import GremlinResourcesOperations +from .operations import NotebookWorkspacesOperations from .operations import PrivateLinkResourcesOperations from .operations import PrivateEndpointConnectionsOperations from . import models @@ -78,6 +79,8 @@ class CosmosDBManagementClient(SDKClient): :vartype cassandra_resources: azure.mgmt.cosmosdb.operations.CassandraResourcesOperations :ivar gremlin_resources: GremlinResources operations :vartype gremlin_resources: azure.mgmt.cosmosdb.operations.GremlinResourcesOperations + :ivar notebook_workspaces: NotebookWorkspaces operations + :vartype notebook_workspaces: azure.mgmt.cosmosdb.operations.NotebookWorkspacesOperations :ivar private_link_resources: PrivateLinkResources operations :vartype private_link_resources: azure.mgmt.cosmosdb.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnections operations @@ -88,13 +91,15 @@ class CosmosDBManagementClient(SDKClient): object` :param subscription_id: Azure subscription ID. :type subscription_id: str + :param subscription_id1: The ID of the target subscription. + :type subscription_id1: str :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): + self, credentials, subscription_id, subscription_id1, base_url=None): - self.config = CosmosDBManagementClientConfiguration(credentials, subscription_id, base_url) + self.config = CosmosDBManagementClientConfiguration(credentials, subscription_id, subscription_id1, base_url) super(CosmosDBManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -137,6 +142,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.gremlin_resources = GremlinResourcesOperations( self._client, self.config, self._serialize, self._deserialize) + self.notebook_workspaces = NotebookWorkspacesOperations( + self._client, self.config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self.config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py index 5200f9fe8ef6..2c058f515587 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py @@ -12,7 +12,6 @@ try: from ._models_py3 import ARMProxyResource from ._models_py3 import ARMResourceProperties - from ._models_py3 import AutopilotSettingsResource from ._models_py3 import AutoUpgradePolicyResource from ._models_py3 import AzureEntityResource from ._models_py3 import Capability @@ -74,6 +73,9 @@ from ._models_py3 import MongoIndex from ._models_py3 import MongoIndexKeys from ._models_py3 import MongoIndexOptions + from ._models_py3 import NotebookWorkspace + from ._models_py3 import NotebookWorkspaceConnectionInfoResult + from ._models_py3 import NotebookWorkspaceCreateUpdateParameters from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import PartitionMetric @@ -84,6 +86,7 @@ from ._models_py3 import PrivateEndpointProperty from ._models_py3 import PrivateLinkResource from ._models_py3 import PrivateLinkServiceConnectionStateProperty + from ._models_py3 import ProvisionedThroughputSettingsResource from ._models_py3 import ProxyResource from ._models_py3 import RegionForOnlineOffline from ._models_py3 import Resource @@ -125,7 +128,6 @@ except (SyntaxError, ImportError): from ._models import ARMProxyResource from ._models import ARMResourceProperties - from ._models import AutopilotSettingsResource from ._models import AutoUpgradePolicyResource from ._models import AzureEntityResource from ._models import Capability @@ -187,6 +189,9 @@ from ._models import MongoIndex from ._models import MongoIndexKeys from ._models import MongoIndexOptions + from ._models import NotebookWorkspace + from ._models import NotebookWorkspaceConnectionInfoResult + from ._models import NotebookWorkspaceCreateUpdateParameters from ._models import Operation from ._models import OperationDisplay from ._models import PartitionMetric @@ -197,6 +202,7 @@ from ._models import PrivateEndpointProperty from ._models import PrivateLinkResource from ._models import PrivateLinkServiceConnectionStateProperty + from ._models import ProvisionedThroughputSettingsResource from ._models import ProxyResource from ._models import RegionForOnlineOffline from ._models import Resource @@ -244,6 +250,7 @@ from ._paged_models import MetricPaged from ._paged_models import MongoDBCollectionGetResultsPaged from ._paged_models import MongoDBDatabaseGetResultsPaged +from ._paged_models import NotebookWorkspacePaged from ._paged_models import OperationPaged from ._paged_models import PartitionMetricPaged from ._paged_models import PartitionUsagePaged @@ -279,7 +286,6 @@ __all__ = [ 'ARMProxyResource', 'ARMResourceProperties', - 'AutopilotSettingsResource', 'AutoUpgradePolicyResource', 'AzureEntityResource', 'Capability', @@ -341,6 +347,9 @@ 'MongoIndex', 'MongoIndexKeys', 'MongoIndexOptions', + 'NotebookWorkspace', + 'NotebookWorkspaceConnectionInfoResult', + 'NotebookWorkspaceCreateUpdateParameters', 'Operation', 'OperationDisplay', 'PartitionMetric', @@ -351,6 +360,7 @@ 'PrivateEndpointProperty', 'PrivateLinkResource', 'PrivateLinkServiceConnectionStateProperty', + 'ProvisionedThroughputSettingsResource', 'ProxyResource', 'RegionForOnlineOffline', 'Resource', @@ -409,6 +419,7 @@ 'CassandraTableGetResultsPaged', 'GremlinDatabaseGetResultsPaged', 'GremlinGraphGetResultsPaged', + 'NotebookWorkspacePaged', 'PrivateLinkResourcePaged', 'PrivateEndpointConnectionPaged', 'DatabaseAccountKind', diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py index 48901a798c8c..a567257806dd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py @@ -89,43 +89,6 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class AutopilotSettingsResource(Model): - """Cosmos DB autopilot settings object. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param max_throughput: Required. Represents max throughput an autopilot - container can operate at. - :type max_throughput: int - :param auto_upgrade_policy: Cosmos DB resource auto-upgrade policy - :type auto_upgrade_policy: - ~azure.mgmt.cosmosdb.models.AutoUpgradePolicyResource - :ivar target_max_throughput: Represents target max throughput an autopilot - container should operate at once offer is no longer in pending state. - :vartype target_max_throughput: int - """ - - _validation = { - 'max_throughput': {'required': True}, - 'target_max_throughput': {'readonly': True}, - } - - _attribute_map = { - 'max_throughput': {'key': 'maxThroughput', 'type': 'int'}, - 'auto_upgrade_policy': {'key': 'autoUpgradePolicy', 'type': 'AutoUpgradePolicyResource'}, - 'target_max_throughput': {'key': 'targetMaxThroughput', 'type': 'int'}, - } - - def __init__(self, **kwargs): - super(AutopilotSettingsResource, self).__init__(**kwargs) - self.max_throughput = kwargs.get('max_throughput', None) - self.auto_upgrade_policy = kwargs.get('auto_upgrade_policy', None) - self.target_max_throughput = None - - class AutoUpgradePolicyResource(Model): """Cosmos DB resource auto-upgrade policy. @@ -2522,6 +2485,106 @@ def __init__(self, **kwargs): self.unique = kwargs.get('unique', None) +class NotebookWorkspace(ARMProxyResource): + """A notebook workspace resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. + :vartype notebook_server_endpoint: str + :ivar status: Status of the notebook workspace. Possible values are: + Creating, Online, Deleting, Failed, Updating. + :vartype status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'notebook_server_endpoint': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'notebook_server_endpoint': {'key': 'properties.notebookServerEndpoint', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NotebookWorkspace, self).__init__(**kwargs) + self.notebook_server_endpoint = None + self.status = None + + +class NotebookWorkspaceConnectionInfoResult(Model): + """The connection info for the given notebook workspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar auth_token: Specifies auth token used for connecting to Notebook + server (uses token-based auth). + :vartype auth_token: str + :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. + :vartype notebook_server_endpoint: str + """ + + _validation = { + 'auth_token': {'readonly': True}, + 'notebook_server_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'auth_token': {'key': 'authToken', 'type': 'str'}, + 'notebook_server_endpoint': {'key': 'notebookServerEndpoint', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NotebookWorkspaceConnectionInfoResult, self).__init__(**kwargs) + self.auth_token = None + self.notebook_server_endpoint = None + + +class NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): + """Parameters to create a notebook workspace resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NotebookWorkspaceCreateUpdateParameters, self).__init__(**kwargs) + + class Operation(Model): """REST API operation. @@ -3015,6 +3078,43 @@ def __init__(self, **kwargs): self.actions_required = None +class ProvisionedThroughputSettingsResource(Model): + """Cosmos DB provisioned throughput settings object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param max_throughput: Required. Represents maximum throughput container + can scale up to. + :type max_throughput: int + :param auto_upgrade_policy: Cosmos DB resource auto-upgrade policy + :type auto_upgrade_policy: + ~azure.mgmt.cosmosdb.models.AutoUpgradePolicyResource + :ivar target_max_throughput: Represents target maximum throughput + container can scale up to once offer is no longer in pending state. + :vartype target_max_throughput: int + """ + + _validation = { + 'max_throughput': {'required': True}, + 'target_max_throughput': {'readonly': True}, + } + + _attribute_map = { + 'max_throughput': {'key': 'maxThroughput', 'type': 'int'}, + 'auto_upgrade_policy': {'key': 'autoUpgradePolicy', 'type': 'AutoUpgradePolicyResource'}, + 'target_max_throughput': {'key': 'targetMaxThroughput', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ProvisionedThroughputSettingsResource, self).__init__(**kwargs) + self.max_throughput = kwargs.get('max_throughput', None) + self.auto_upgrade_policy = kwargs.get('auto_upgrade_policy', None) + self.target_max_throughput = None + + class RegionForOnlineOffline(Model): """Cosmos DB region to online or offline. @@ -4134,13 +4234,14 @@ class ThroughputSettingsGetPropertiesResource(Model): sending a request. :param throughput: Value of the Cosmos DB resource throughput. Either - throughput is required or autopilotSettings is required, but not both. + throughput is required or provisionedThroughputSettings is required, but + not both. :type throughput: int - :param autopilot_settings: Cosmos DB resource for Autopilot settings. - Either throughput is required or autopilotSettings is required, but not - both. - :type autopilot_settings: - ~azure.mgmt.cosmosdb.models.AutopilotSettingsResource + :param provisioned_throughput_settings: Cosmos DB resource for provisioned + throughput settings. Either throughput is required or + provisionedThroughputSettings is required, but not both. + :type provisioned_throughput_settings: + ~azure.mgmt.cosmosdb.models.ProvisionedThroughputSettingsResource :ivar minimum_throughput: The minimum throughput of the resource :vartype minimum_throughput: str :ivar offer_replace_pending: The throughput replace is pending @@ -4165,7 +4266,7 @@ class ThroughputSettingsGetPropertiesResource(Model): _attribute_map = { 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autopilot_settings': {'key': 'autopilotSettings', 'type': 'AutopilotSettingsResource'}, + 'provisioned_throughput_settings': {'key': 'provisionedThroughputSettings', 'type': 'ProvisionedThroughputSettingsResource'}, 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, '_rid': {'key': '_rid', 'type': 'str'}, @@ -4176,7 +4277,7 @@ class ThroughputSettingsGetPropertiesResource(Model): def __init__(self, **kwargs): super(ThroughputSettingsGetPropertiesResource, self).__init__(**kwargs) self.throughput = kwargs.get('throughput', None) - self.autopilot_settings = kwargs.get('autopilot_settings', None) + self.provisioned_throughput_settings = kwargs.get('provisioned_throughput_settings', None) self.minimum_throughput = None self.offer_replace_pending = None self._rid = None @@ -4228,19 +4329,20 @@ def __init__(self, **kwargs): class ThroughputSettingsResource(Model): """Cosmos DB resource throughput object. Either throughput is required or - autopilotSettings is required, but not both. + provisionedThroughputSettings is required, but not both. Variables are only populated by the server, and will be ignored when sending a request. :param throughput: Value of the Cosmos DB resource throughput. Either - throughput is required or autopilotSettings is required, but not both. + throughput is required or provisionedThroughputSettings is required, but + not both. :type throughput: int - :param autopilot_settings: Cosmos DB resource for Autopilot settings. - Either throughput is required or autopilotSettings is required, but not - both. - :type autopilot_settings: - ~azure.mgmt.cosmosdb.models.AutopilotSettingsResource + :param provisioned_throughput_settings: Cosmos DB resource for provisioned + throughput settings. Either throughput is required or + provisionedThroughputSettings is required, but not both. + :type provisioned_throughput_settings: + ~azure.mgmt.cosmosdb.models.ProvisionedThroughputSettingsResource :ivar minimum_throughput: The minimum throughput of the resource :vartype minimum_throughput: str :ivar offer_replace_pending: The throughput replace is pending @@ -4254,7 +4356,7 @@ class ThroughputSettingsResource(Model): _attribute_map = { 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autopilot_settings': {'key': 'autopilotSettings', 'type': 'AutopilotSettingsResource'}, + 'provisioned_throughput_settings': {'key': 'provisionedThroughputSettings', 'type': 'ProvisionedThroughputSettingsResource'}, 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, } @@ -4262,7 +4364,7 @@ class ThroughputSettingsResource(Model): def __init__(self, **kwargs): super(ThroughputSettingsResource, self).__init__(**kwargs) self.throughput = kwargs.get('throughput', None) - self.autopilot_settings = kwargs.get('autopilot_settings', None) + self.provisioned_throughput_settings = kwargs.get('provisioned_throughput_settings', None) self.minimum_throughput = None self.offer_replace_pending = None diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py index 962ba48fb534..aaa8db03f309 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models_py3.py @@ -89,43 +89,6 @@ def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: self.tags = tags -class AutopilotSettingsResource(Model): - """Cosmos DB autopilot settings object. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param max_throughput: Required. Represents max throughput an autopilot - container can operate at. - :type max_throughput: int - :param auto_upgrade_policy: Cosmos DB resource auto-upgrade policy - :type auto_upgrade_policy: - ~azure.mgmt.cosmosdb.models.AutoUpgradePolicyResource - :ivar target_max_throughput: Represents target max throughput an autopilot - container should operate at once offer is no longer in pending state. - :vartype target_max_throughput: int - """ - - _validation = { - 'max_throughput': {'required': True}, - 'target_max_throughput': {'readonly': True}, - } - - _attribute_map = { - 'max_throughput': {'key': 'maxThroughput', 'type': 'int'}, - 'auto_upgrade_policy': {'key': 'autoUpgradePolicy', 'type': 'AutoUpgradePolicyResource'}, - 'target_max_throughput': {'key': 'targetMaxThroughput', 'type': 'int'}, - } - - def __init__(self, *, max_throughput: int, auto_upgrade_policy=None, **kwargs) -> None: - super(AutopilotSettingsResource, self).__init__(**kwargs) - self.max_throughput = max_throughput - self.auto_upgrade_policy = auto_upgrade_policy - self.target_max_throughput = None - - class AutoUpgradePolicyResource(Model): """Cosmos DB resource auto-upgrade policy. @@ -2522,6 +2485,106 @@ def __init__(self, *, expire_after_seconds: int=None, unique: bool=None, **kwarg self.unique = unique +class NotebookWorkspace(ARMProxyResource): + """A notebook workspace resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. + :vartype notebook_server_endpoint: str + :ivar status: Status of the notebook workspace. Possible values are: + Creating, Online, Deleting, Failed, Updating. + :vartype status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'notebook_server_endpoint': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'notebook_server_endpoint': {'key': 'properties.notebookServerEndpoint', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(NotebookWorkspace, self).__init__(**kwargs) + self.notebook_server_endpoint = None + self.status = None + + +class NotebookWorkspaceConnectionInfoResult(Model): + """The connection info for the given notebook workspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar auth_token: Specifies auth token used for connecting to Notebook + server (uses token-based auth). + :vartype auth_token: str + :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. + :vartype notebook_server_endpoint: str + """ + + _validation = { + 'auth_token': {'readonly': True}, + 'notebook_server_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'auth_token': {'key': 'authToken', 'type': 'str'}, + 'notebook_server_endpoint': {'key': 'notebookServerEndpoint', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(NotebookWorkspaceConnectionInfoResult, self).__init__(**kwargs) + self.auth_token = None + self.notebook_server_endpoint = None + + +class NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): + """Parameters to create a notebook workspace resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(NotebookWorkspaceCreateUpdateParameters, self).__init__(**kwargs) + + class Operation(Model): """REST API operation. @@ -3015,6 +3078,43 @@ def __init__(self, *, status: str=None, description: str=None, **kwargs) -> None self.actions_required = None +class ProvisionedThroughputSettingsResource(Model): + """Cosmos DB provisioned throughput settings object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param max_throughput: Required. Represents maximum throughput container + can scale up to. + :type max_throughput: int + :param auto_upgrade_policy: Cosmos DB resource auto-upgrade policy + :type auto_upgrade_policy: + ~azure.mgmt.cosmosdb.models.AutoUpgradePolicyResource + :ivar target_max_throughput: Represents target maximum throughput + container can scale up to once offer is no longer in pending state. + :vartype target_max_throughput: int + """ + + _validation = { + 'max_throughput': {'required': True}, + 'target_max_throughput': {'readonly': True}, + } + + _attribute_map = { + 'max_throughput': {'key': 'maxThroughput', 'type': 'int'}, + 'auto_upgrade_policy': {'key': 'autoUpgradePolicy', 'type': 'AutoUpgradePolicyResource'}, + 'target_max_throughput': {'key': 'targetMaxThroughput', 'type': 'int'}, + } + + def __init__(self, *, max_throughput: int, auto_upgrade_policy=None, **kwargs) -> None: + super(ProvisionedThroughputSettingsResource, self).__init__(**kwargs) + self.max_throughput = max_throughput + self.auto_upgrade_policy = auto_upgrade_policy + self.target_max_throughput = None + + class RegionForOnlineOffline(Model): """Cosmos DB region to online or offline. @@ -4134,13 +4234,14 @@ class ThroughputSettingsGetPropertiesResource(Model): sending a request. :param throughput: Value of the Cosmos DB resource throughput. Either - throughput is required or autopilotSettings is required, but not both. + throughput is required or provisionedThroughputSettings is required, but + not both. :type throughput: int - :param autopilot_settings: Cosmos DB resource for Autopilot settings. - Either throughput is required or autopilotSettings is required, but not - both. - :type autopilot_settings: - ~azure.mgmt.cosmosdb.models.AutopilotSettingsResource + :param provisioned_throughput_settings: Cosmos DB resource for provisioned + throughput settings. Either throughput is required or + provisionedThroughputSettings is required, but not both. + :type provisioned_throughput_settings: + ~azure.mgmt.cosmosdb.models.ProvisionedThroughputSettingsResource :ivar minimum_throughput: The minimum throughput of the resource :vartype minimum_throughput: str :ivar offer_replace_pending: The throughput replace is pending @@ -4165,7 +4266,7 @@ class ThroughputSettingsGetPropertiesResource(Model): _attribute_map = { 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autopilot_settings': {'key': 'autopilotSettings', 'type': 'AutopilotSettingsResource'}, + 'provisioned_throughput_settings': {'key': 'provisionedThroughputSettings', 'type': 'ProvisionedThroughputSettingsResource'}, 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, '_rid': {'key': '_rid', 'type': 'str'}, @@ -4173,10 +4274,10 @@ class ThroughputSettingsGetPropertiesResource(Model): '_etag': {'key': '_etag', 'type': 'str'}, } - def __init__(self, *, throughput: int=None, autopilot_settings=None, **kwargs) -> None: + def __init__(self, *, throughput: int=None, provisioned_throughput_settings=None, **kwargs) -> None: super(ThroughputSettingsGetPropertiesResource, self).__init__(**kwargs) self.throughput = throughput - self.autopilot_settings = autopilot_settings + self.provisioned_throughput_settings = provisioned_throughput_settings self.minimum_throughput = None self.offer_replace_pending = None self._rid = None @@ -4228,19 +4329,20 @@ def __init__(self, *, location: str=None, tags=None, resource=None, **kwargs) -> class ThroughputSettingsResource(Model): """Cosmos DB resource throughput object. Either throughput is required or - autopilotSettings is required, but not both. + provisionedThroughputSettings is required, but not both. Variables are only populated by the server, and will be ignored when sending a request. :param throughput: Value of the Cosmos DB resource throughput. Either - throughput is required or autopilotSettings is required, but not both. + throughput is required or provisionedThroughputSettings is required, but + not both. :type throughput: int - :param autopilot_settings: Cosmos DB resource for Autopilot settings. - Either throughput is required or autopilotSettings is required, but not - both. - :type autopilot_settings: - ~azure.mgmt.cosmosdb.models.AutopilotSettingsResource + :param provisioned_throughput_settings: Cosmos DB resource for provisioned + throughput settings. Either throughput is required or + provisionedThroughputSettings is required, but not both. + :type provisioned_throughput_settings: + ~azure.mgmt.cosmosdb.models.ProvisionedThroughputSettingsResource :ivar minimum_throughput: The minimum throughput of the resource :vartype minimum_throughput: str :ivar offer_replace_pending: The throughput replace is pending @@ -4254,15 +4356,15 @@ class ThroughputSettingsResource(Model): _attribute_map = { 'throughput': {'key': 'throughput', 'type': 'int'}, - 'autopilot_settings': {'key': 'autopilotSettings', 'type': 'AutopilotSettingsResource'}, + 'provisioned_throughput_settings': {'key': 'provisionedThroughputSettings', 'type': 'ProvisionedThroughputSettingsResource'}, 'minimum_throughput': {'key': 'minimumThroughput', 'type': 'str'}, 'offer_replace_pending': {'key': 'offerReplacePending', 'type': 'str'}, } - def __init__(self, *, throughput: int=None, autopilot_settings=None, **kwargs) -> None: + def __init__(self, *, throughput: int=None, provisioned_throughput_settings=None, **kwargs) -> None: super(ThroughputSettingsResource, self).__init__(**kwargs) self.throughput = throughput - self.autopilot_settings = autopilot_settings + self.provisioned_throughput_settings = provisioned_throughput_settings self.minimum_throughput = None self.offer_replace_pending = None diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_paged_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_paged_models.py index b519e101f881..3ea4f5d46a00 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_paged_models.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_paged_models.py @@ -272,6 +272,19 @@ class GremlinGraphGetResultsPaged(Paged): def __init__(self, *args, **kwargs): super(GremlinGraphGetResultsPaged, self).__init__(*args, **kwargs) +class NotebookWorkspacePaged(Paged): + """ + A paging container for iterating over a list of :class:`NotebookWorkspace ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[NotebookWorkspace]'} + } + + def __init__(self, *args, **kwargs): + + super(NotebookWorkspacePaged, self).__init__(*args, **kwargs) class PrivateLinkResourcePaged(Paged): """ A paging container for iterating over a list of :class:`PrivateLinkResource ` object diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py index e95f28e83a62..bf6987802bed 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/__init__.py @@ -27,6 +27,7 @@ from ._table_resources_operations import TableResourcesOperations from ._cassandra_resources_operations import CassandraResourcesOperations from ._gremlin_resources_operations import GremlinResourcesOperations +from ._notebook_workspaces_operations import NotebookWorkspacesOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations @@ -49,6 +50,7 @@ 'TableResourcesOperations', 'CassandraResourcesOperations', 'GremlinResourcesOperations', + 'NotebookWorkspacesOperations', 'PrivateLinkResourcesOperations', 'PrivateEndpointConnectionsOperations', ] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py new file mode 100644 index 000000000000..14466ff12082 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_notebook_workspaces_operations.py @@ -0,0 +1,574 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class NotebookWorkspacesOperations(object): + """NotebookWorkspacesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2019-08-01. Constant value: "2019-08-01". + :ivar notebook_workspace_name: The name of the notebook workspace resource. Constant value: "default". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-08-01" + self.notebook_workspace_name = "default" + + self.config = config + + def list_by_database_account( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Gets the notebook workspace resources of an existing Cosmos DB account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of NotebookWorkspace + :rtype: + ~azure.mgmt.cosmosdb.models.NotebookWorkspacePaged[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_database_account.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.NotebookWorkspacePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_database_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces'} + + def get( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Gets the notebook workspace for a Cosmos DB account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NotebookWorkspace or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("self.notebook_workspace_name", self.notebook_workspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NotebookWorkspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}'} + + + def _create_or_update_initial( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + notebook_create_update_parameters = None + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("self.notebook_workspace_name", self.notebook_workspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(notebook_create_update_parameters, 'NotebookWorkspaceCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NotebookWorkspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, account_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates the notebook workspace for a Cosmos DB account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns NotebookWorkspace or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.NotebookWorkspace]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('NotebookWorkspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}'} + + + def _delete_initial( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("self.notebook_workspace_name", self.notebook_workspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, account_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes the notebook workspace for a Cosmos DB account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}'} + + def list_connection_info( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Retrieves the connection info for the notebook workspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NotebookWorkspaceConnectionInfoResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_connection_info.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("self.notebook_workspace_name", self.notebook_workspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NotebookWorkspaceConnectionInfoResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_connection_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo'} + + + def _regenerate_auth_token_initial( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.regenerate_auth_token.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("self.notebook_workspace_name", self.notebook_workspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def regenerate_auth_token( + self, resource_group_name, account_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Regenerates the auth token for the notebook workspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._regenerate_auth_token_initial( + resource_group_name=resource_group_name, + account_name=account_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + regenerate_auth_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken'} + + + def _start_initial( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.start.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'notebookWorkspaceName': self._serialize.url("self.notebook_workspace_name", self.notebook_workspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def start( + self, resource_group_name, account_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Starts the notebook workspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start'}