如何使用 Azure Cosmosdb SDK 创建无服务器 cosmosdb?

How to create a serverless cosmosdb using Azure Cosmosdb SDK?

如何使用 Python mgmt SDK azure.mgmt.cosmosdb 创建无服务器 CosmosDB 帐户?

https://docs.microsoft.com/en-us/python/api/azure-mgmt-cosmosdb/azure.mgmt.cosmosdb.models.databaseaccountcreateupdateparameters?view=azure-python-preview

我在 DatabaseAccountCreateUpdateParameters 中没有看到任何相关内容。我必须指定哪些属性和值?

这还不是普遍可用,创建无服务器类型的唯一方法是通过 Azure 门户在帐户类型中选择 Servlerss 选项

我不知道 python 所以我不能保证这一定有效。我所知道的是,可以通过将“EnableServerless”作为单个项目数组添加到功能中来打开无服务器功能。

查看 python 管理 SDK 的单元测试,我希望启用无服务器看起来像这样使用这个简单的示例,说明在创建新的时将传递给 create_update_parameters 参数的内容帐号。

BODY = {
      "location": AZURE_LOCATION,
      "database_account_offer_type": "Standard",
      "capabilities": [
        {
          "EnableServerless"
        }
      ]
      "locations": [
        {
          "location_name": "westus",
          "failover_priority": "0"
        }
      ]
    }
    result = self.mgmt_client.database_accounts.begin_create_or_update(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, create_update_parameters=BODY)
    result = result.result()