你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Sql Resources - Get Sql Container

获取现有 Azure Cosmos DB 数据库帐户下的 SQL 容器。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}?api-version=2023-11-15

URI 参数

名称 必需 类型 说明
accountName
path True

string

Cosmos DB 数据库帐户名称。

Regex pattern: ^[a-z0-9]+(-[a-z0-9]+)*

containerName
path True

string

Cosmos DB 容器名称。

databaseName
path True

string

Cosmos DB 数据库名称。

resourceGroupName
path True

string

资源组的名称。 此名称不区分大小写。

subscriptionId
path True

string

目标订阅的 ID。

api-version
query True

string

要用于此操作的 API 版本。

响应

名称 类型 说明
200 OK

SqlContainerGetResults

已成功检索 SQL 容器属性。

安全性

azure_auth

Azure Active Directory OAuth2 流

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

CosmosDBSqlContainerGet

Sample Request

GET https://management.azure.com/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/containers/containerName?api-version=2023-11-15

Sample Response

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/containers/containerName",
  "name": "containerName",
  "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers",
  "location": "West US",
  "tags": {},
  "properties": {
    "resource": {
      "id": "containerName",
      "indexingPolicy": {
        "indexingMode": "consistent",
        "automatic": true,
        "includedPaths": [
          {
            "path": "/*",
            "indexes": [
              {
                "kind": "Range",
                "dataType": "String",
                "precision": -1
              },
              {
                "kind": "Range",
                "dataType": "Number",
                "precision": -1
              }
            ]
          }
        ],
        "excludedPaths": []
      },
      "partitionKey": {
        "paths": [
          "/AccountNumber"
        ],
        "kind": "Hash"
      },
      "defaultTtl": 100,
      "uniqueKeyPolicy": {
        "uniqueKeys": [
          {
            "paths": [
              "/testPath"
            ]
          }
        ]
      },
      "conflictResolutionPolicy": {
        "mode": "LastWriterWins",
        "conflictResolutionPath": "/path"
      },
      "clientEncryptionPolicy": {
        "includedPaths": [
          {
            "path": "/path",
            "clientEncryptionKeyId": "keyId",
            "encryptionAlgorithm": "AEAD_AES_256_CBC_HMAC_SHA256",
            "encryptionType": "Deterministic"
          }
        ],
        "policyFormatVersion": 1
      },
      "computedProperties": [
        {
          "name": "cp_lowerName",
          "query": "SELECT VALUE LOWER(c.name) FROM c"
        }
      ],
      "_rid": "PD5DALigDgw=",
      "_ts": 1459200611,
      "_etag": "\"00005900-0000-0000-0000-56f9a2630000\""
    },
    "options": {
      "throughput": 400
    }
  }
}

定义

名称 说明
AutoscaleSettings
ClientEncryptionIncludedPath

.

ClientEncryptionPolicy

Cosmos DB 客户端加密策略。

CompositePath
CompositePathSortOrder

复合路径的排序顺序。

ComputedProperty

计算属性的定义

ConflictResolutionMode

指示冲突解决模式。

ConflictResolutionPolicy

容器的冲突解决策略。

ContainerPartitionKey

用于将数据分区到多个分区的分区键的配置

CreateMode

用于指示帐户创建模式的枚举。

DataType

对其应用索引行为的数据类型。

ExcludedPath
IncludedPath

索引中包含的路径

Indexes

路径的索引。

IndexingMode

指示索引模式。

IndexingPolicy

Cosmos DB 索引策略

IndexKind

指示索引的类型。

Options
PartitionKind

指示用于分区的算法类型。 对于 MultiHash,容器创建支持多个分区键 (最多三个)

Resource
ResourceRestoreParameters

指示有关还原的信息的参数。

SpatialSpec
SpatialType

指示索引的空间类型。

SqlContainerGetResults

一个 Azure Cosmos DB 容器。

UniqueKey

上的唯一键,对 Azure Cosmos DB 服务中的集合中的文档强制实施唯一性约束。

UniqueKeyPolicy

用于指定 Azure Cosmos DB 服务集合中文档的唯一性约束的唯一键策略配置。

AutoscaleSettings

名称 类型 说明
maxThroughput

integer

表示资源可纵向扩展的最大吞吐量。

ClientEncryptionIncludedPath

.

名称 类型 说明
clientEncryptionKeyId

string

用于加密路径的客户端加密密钥的标识符。

encryptionAlgorithm

string

将使用的加密算法。 例如 - AEAD_AES_256_CBC_HMAC_SHA256。

encryptionType

string

要执行的加密类型。 例如 - 确定性、随机化。

path

string

需要加密的路径。

ClientEncryptionPolicy

Cosmos DB 客户端加密策略。

名称 类型 说明
includedPaths

ClientEncryptionIncludedPath[]

需要加密的项的路径以及特定于路径的设置。

policyFormatVersion

integer

客户端加密策略定义的版本。 支持的版本为 1 和 2。 版本 2 支持 ID 和分区密钥路径加密。

CompositePath

名称 类型 说明
order

CompositePathSortOrder

复合路径的排序顺序。

path

string

索引行为应用于的路径。 索引路径通常以 root 开头,以通配符 (/path/*)

CompositePathSortOrder

复合路径的排序顺序。

名称 类型 说明
ascending

string

descending

string

ComputedProperty

计算属性的定义

名称 类型 说明
name

string

计算属性的名称,例如 “cp_lowerName”

query

string

计算属性的值的查询,例如 -“SELECT VALUE LOWER (c.name) FROM c”

ConflictResolutionMode

指示冲突解决模式。

名称 类型 说明
Custom

string

LastWriterWins

string

ConflictResolutionPolicy

容器的冲突解决策略。

名称 类型 默认值 说明
conflictResolutionPath

string

LastWriterWins 模式下的冲突解决路径。

conflictResolutionProcedure

string

在自定义模式下解决冲突的过程。

mode

ConflictResolutionMode

LastWriterWins

指示冲突解决模式。

ContainerPartitionKey

用于将数据分区到多个分区的分区键的配置

名称 类型 默认值 说明
kind

PartitionKind

Hash

指示用于分区的算法类型。 对于 MultiHash,容器创建支持多个分区键 (最多三个)

paths

string[]

使用容器内可分区数据的路径列表

systemKey

boolean

指示容器是否使用系统生成的分区键

version

integer

指示分区键定义的版本

CreateMode

用于指示帐户创建模式的枚举。

名称 类型 说明
Default

string

Restore

string

DataType

对其应用索引行为的数据类型。

名称 类型 说明
LineString

string

MultiPolygon

string

Number

string

Point

string

Polygon

string

String

string

ExcludedPath

名称 类型 说明
path

string

索引行为应用于的路径。 索引路径通常以 root 开头,以通配符 (/path/*)

IncludedPath

索引中包含的路径

名称 类型 说明
indexes

Indexes[]

此路径的索引列表

path

string

索引行为应用于的路径。 索引路径通常以 root 开头,以通配符 (/path/*)

Indexes

路径的索引。

名称 类型 默认值 说明
dataType

DataType

String

对其应用索引行为的数据类型。

kind

IndexKind

Hash

指示索引的类型。

precision

integer

索引的精度。 -1 是最大精度。

IndexingMode

指示索引模式。

名称 类型 说明
consistent

string

lazy

string

none

string

IndexingPolicy

Cosmos DB 索引策略

名称 类型 默认值 说明
automatic

boolean

指示索引策略是否是自动的

compositeIndexes

CompositePath[]

复合路径列表列表

excludedPaths

ExcludedPath[]

要从索引中排除的路径列表

includedPaths

IncludedPath[]

要包含在索引中的路径列表

indexingMode

IndexingMode

consistent

指示索引模式。

spatialIndexes

SpatialSpec[]

空间细节列表

IndexKind

指示索引的类型。

名称 类型 说明
Hash

string

Range

string

Spatial

string

Options

名称 类型 说明
autoscaleSettings

AutoscaleSettings

指定自动缩放设置。

throughput

integer

Cosmos DB 资源吞吐量或自动缩放设置的值。 检索产品/服务详细信息时,请使用 ThroughputSetting 资源。

PartitionKind

指示用于分区的算法类型。 对于 MultiHash,容器创建支持多个分区键 (最多三个)

名称 类型 说明
Hash

string

MultiHash

string

Range

string

Resource

名称 类型 默认值 说明
_etag

string

表示乐观并发控制所需的资源 etag 的系统生成的属性。

_rid

string

系统生成的属性。 唯一标识符。

_ts

number

一个系统生成的属性,表示资源的上次更新时间戳。

analyticalStorageTtl

integer

分析 TTL。

clientEncryptionPolicy

ClientEncryptionPolicy

容器的客户端加密策略。

computedProperties

ComputedProperty[]

计算属性列表

conflictResolutionPolicy

ConflictResolutionPolicy

容器的冲突解决策略。

createMode

CreateMode

Default

用于指示资源创建模式的枚举。

defaultTtl

integer

默认生存时间

id

string

Cosmos DB SQL 容器的名称

indexingPolicy

IndexingPolicy

索引策略的配置。 默认情况下,对容器中的所有文档路径自动编制索引

partitionKey

ContainerPartitionKey

用于将数据分区到多个分区的分区键的配置

restoreParameters

ResourceRestoreParameters

指示有关还原的信息的参数

uniqueKeyPolicy

UniqueKeyPolicy

用于指定 Azure Cosmos DB 服务集合中文档的唯一性约束的唯一键策略配置。

ResourceRestoreParameters

指示有关还原的信息的参数。

名称 类型 说明
restoreSource

string

必须从中启动还原的可还原数据库帐户的 ID。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}

restoreTimestampInUtc

string

帐户必须还原到的时间 (ISO-8601 格式) 。

SpatialSpec

名称 类型 说明
path

string

索引行为应用于的路径。 索引路径通常以 root 开头,以通配符 (/path/*)

types

SpatialType[]

路径的空间类型列表

SpatialType

指示索引的空间类型。

名称 类型 说明
LineString

string

MultiPolygon

string

Point

string

Polygon

string

SqlContainerGetResults

一个 Azure Cosmos DB 容器。

名称 类型 说明
id

string

ARM 资源的唯一资源标识符。

location

string

资源所属的资源组的位置。

name

string

ARM 资源的名称。

properties.options

Options

properties.resource

Resource

tags

object

标记是描述资源的键值对的列表。 在查看此资源和为此资源分组(跨资源组)时,可以使用这些标记。 最多可以为一个资源提供 15 个标记。 每个标记的键不能超过 128 个字符,值不能超过 256 个字符。 例如,模板类型的默认体验设置为“defaultExperience”:“Cassandra”。 当前的“defaultExperience”值还包括“Table”、“Graph”、“DocumentDB”和“MongoDB”。

type

string

Azure 资源的类型。

UniqueKey

上的唯一键,对 Azure Cosmos DB 服务中的集合中的文档强制实施唯一性约束。

名称 类型 说明
paths

string[]

对于 Azure Cosmos DB 服务中的每个文档,路径列表必须是唯一的

UniqueKeyPolicy

用于指定 Azure Cosmos DB 服务集合中文档的唯一性约束的唯一键策略配置。

名称 类型 说明
uniqueKeys

UniqueKey[]

对 Azure Cosmos DB 服务集合中的文档强制实施唯一性约束的唯一键列表。