Sql Resources

您所在的位置:网站首页 restfulclient Sql Resources

Sql Resources

2023-04-09 06:30| 来源: 网络整理| 查看: 265

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

Sql Resources - Get Client Encryption Key 参考 Service: Cosmos DB Resource Provider API Version: 2022-11-15-preview

获取现有 Azure Cosmos DB SQL 数据库下的 ClientEncryptionKey。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}?api-version=2022-11-15-preview URI 参数 名称 在 必需 类型 说明 accountName path True

string

Cosmos DB 数据库帐户名称。

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

clientEncryptionKeyName path True

string

Cosmos DB ClientEncryptionKey 名称。

databaseName path True

string

Cosmos DB 数据库名称。

resourceGroupName path True

string

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

subscriptionId path True

string

目标订阅的 ID。

api-version query True

string

要用于此操作的 API 版本。

响应 名称 类型 说明 200 OK

ClientEncryptionKeyGetResults

已成功检索 ClientEncryptionKey。

安全性 azure_auth

Azure Active Directory OAuth2 流

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

Scopes 名称 说明 user_impersonation 模拟用户帐户 示例 CosmosDBClientEncryptionKeyGet Sample Request HTTP Python Go JavaScript GET https://management.azure.com/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/sqlDatabases/databaseName/clientEncryptionKeys/cekName?api-version=2022-11-15-preview from azure.identity import DefaultAzureCredential from azure.mgmt.cosmosdb import CosmosDBManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-cosmosdb # USAGE python cosmos_db_sql_client_encryption_key_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), subscription_id="subId", ) response = client.sql_resources.get_client_encryption_key( resource_group_name="rgName", account_name="accountName", database_name="databaseName", client_encryption_key_name="cekName", ) print(response) # x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-11-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json if __name__ == "__main__": main()

To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue

package armcosmos_test import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-11-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json func ExampleSQLResourcesClient_GetClientEncryptionKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armcosmos.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewSQLResourcesClient().GetClientEncryptionKey(ctx, "rgName", "accountName", "databaseName", "cekName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.ClientEncryptionKeyGetResults = armcosmos.ClientEncryptionKeyGetResults{ // Name: to.Ptr("cekName"), // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/clientEncryptionKey"), // ID: to.Ptr("/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/sqlDatabases/databaseName/clientEncryptionKeys/cekName"), // Properties: &armcosmos.ClientEncryptionKeyGetProperties{ // Resource: &armcosmos.ClientEncryptionKeyGetPropertiesResource{ // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), // ID: to.Ptr("cekName"), // KeyWrapMetadata: &armcosmos.KeyWrapMetadata{ // Name: to.Ptr("customerManagedKey"), // Type: to.Ptr("AzureKeyVault"), // Algorithm: to.Ptr("RSA-OAEP"), // Value: to.Ptr("AzureKeyVault Key URL"), // }, // WrappedDataEncryptionKey: []byte("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), // Etag: to.Ptr("00000000-0000-0000-7a1f-bc0828e801d7"), // Rid: to.Ptr("tNc4AAAAAAAQkjzWAgAAAA=="), // Ts: to.Ptr[float32](1626425552), // }, // }, // } }

To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue

const { CosmosDBManagementClient } = require("@azure/arm-cosmosdb"); const { DefaultAzureCredential } = require("@azure/identity"); /** * This sample demonstrates how to Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. * * @summary Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-11-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json */ async function cosmosDbClientEncryptionKeyGet() { const subscriptionId = process.env["COSMOSDB_SUBSCRIPTION_ID"] || "subId"; const resourceGroupName = process.env["COSMOSDB_RESOURCE_GROUP"] || "rgName"; const accountName = "accountName"; const databaseName = "databaseName"; const clientEncryptionKeyName = "cekName"; const credential = new DefaultAzureCredential(); const client = new CosmosDBManagementClient(credential, subscriptionId); const result = await client.sqlResources.getClientEncryptionKey( resourceGroupName, accountName, databaseName, clientEncryptionKeyName ); console.log(result); }

To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue

Sample Response Status code: 200 { "id": "/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/sqlDatabases/databaseName/clientEncryptionKeys/cekName", "name": "cekName", "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/clientEncryptionKey", "properties": { "resource": { "id": "cekName", "encryptionAlgorithm": "AEAD_AES_256_CBC_HMAC_SHA256", "wrappedDataEncryptionKey": "VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU=", "keyWrapMetadata": { "name": "customerManagedKey", "type": "AzureKeyVault", "value": "AzureKeyVault Key URL", "algorithm": "RSA-OAEP" }, "_rid": "tNc4AAAAAAAQkjzWAgAAAA==", "_ts": 1626425552, "_etag": "00000000-0000-0000-7a1f-bc0828e801d7" } } } 定义 名称 说明 ClientEncryptionKeyGetResults

客户端加密密钥。

KeyWrapMetadata

表示密钥包装提供程序可用于包装/解包客户端加密密钥的密钥包装元数据。

Resource ClientEncryptionKeyGetResults

客户端加密密钥。

名称 类型 说明 id

string

数据库帐户的唯一资源标识符。

name

string

数据库帐户的名称。

properties.resource

Resource

type

string

Azure 资源的类型。

KeyWrapMetadata

表示密钥包装提供程序可用于包装/解包客户端加密密钥的密钥包装元数据。

名称 类型 说明 algorithm

string

用于包装和解包数据加密密钥的算法。

name

string

关联的 KeyEncryptionKey (又名 CustomerManagedKey) 。

type

string

KeyStoreProvider 的 ProviderName。

value

string

KeyEncryptionKey 的引用/链接。

Resource 名称 类型 说明 _etag

string

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

_rid

string

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

_ts

number

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

encryptionAlgorithm

string

将与此客户端加密密钥一起用于加密/解密数据的加密算法。

id

string

ClientEncryptionKey 的名称

keyWrapMetadata

KeyWrapMetadata

包装提供程序的元数据,可用于解包已包装的客户端加密密钥。

wrappedDataEncryptionKey

string

包装 (表示为字节数组的密钥的加密) 形式。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3