Conclui um trabalho on-line de transferência de dados.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/complete?api-version=2024-12-01-preview
Parâmetros do URI
Name |
Em |
Necessário |
Tipo |
Description |
accountName
|
path |
True
|
string
|
Nome da conta do banco de dados do Cosmos DB.
Padrão Regex: ^[a-z0-9]+(-[a-z0-9]+)*
|
jobName
|
path |
True
|
string
|
Nome do trabalho de transferência de dados
|
resourceGroupName
|
path |
True
|
string
|
O nome do grupo de recursos. O nome não diferencia maiúsculas de minúsculas.
|
subscriptionId
|
path |
True
|
string
|
A ID da assinatura de destino.
|
api-version
|
query |
True
|
string
|
A versão da API a ser usada para esta operação.
|
Respostas
Name |
Tipo |
Description |
200 OK
|
DataTransferJobGetResults
|
Resposta bem-sucedida do Trabalho Completo
|
Other Status Codes
|
CloudError
|
Resposta de erro descrevendo por que a operação falhou.
|
Segurança
azure_auth
Azure Ative Directory OAuth2 Flow
Tipo:
oauth2
Fluxo:
implicit
URL de Autorização:
https://login.microsoftonline.com/common/oauth2/authorize
Âmbitos
Name |
Description |
user_impersonation
|
Personificar a sua conta de utilizador
|
Exemplos
CosmosDBDataTransferJobComplete
Pedido de amostra
POST https://management.azure.com/subscriptions/e35cc6eb-c8e3-447b-8de6-b83328cd0098/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/dataTransferJobs/j1/complete?api-version=2024-12-01-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_data_transfer_job_complete.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="e35cc6eb-c8e3-447b-8de6-b83328cd0098",
)
response = client.data_transfer_jobs.complete(
resource_group_name="rg1",
account_name="ddb1",
job_name="j1",
)
print(response)
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobComplete.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/v4"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobComplete.json
func ExampleDataTransferJobsClient_Complete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcosmos.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewDataTransferJobsClient().Complete(ctx, "rg1", "ddb1", "j1", 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.DataTransferJobGetResults = armcosmos.DataTransferJobGetResults{
// Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/dataTransferJobs"),
// ID: to.Ptr("ab1b6f34-b33c-46b1-98c7-3a0a63fd0d16"),
// Properties: &armcosmos.DataTransferJobProperties{
// Destination: &armcosmos.AzureBlobDataTransferDataSourceSink{
// Component: to.Ptr(armcosmos.DataTransferComponentAzureBlobStorage),
// ContainerName: to.Ptr("blob_container"),
// EndpointURL: to.Ptr("https://blob.windows.net"),
// },
// Duration: to.Ptr("00:34:10"),
// JobName: to.Ptr("j1"),
// LastUpdatedUTCTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-12T11:10:55.278Z"); return t}()),
// ProcessedCount: to.Ptr[int64](20),
// Source: &armcosmos.CassandraDataTransferDataSourceSink{
// Component: to.Ptr(armcosmos.DataTransferComponentCosmosDBCassandra),
// KeyspaceName: to.Ptr("keyspace"),
// TableName: to.Ptr("table"),
// },
// Status: to.Ptr("Completed"),
// TotalCount: to.Ptr[int64](100),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Completes a Data Transfer Online Job.
*
* @summary Completes a Data Transfer Online Job.
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobComplete.json
*/
async function cosmosDbDataTransferJobComplete() {
const subscriptionId =
process.env["COSMOSDB_SUBSCRIPTION_ID"] || "e35cc6eb-c8e3-447b-8de6-b83328cd0098";
const resourceGroupName = process.env["COSMOSDB_RESOURCE_GROUP"] || "rg1";
const accountName = "ddb1";
const jobName = "j1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBManagementClient(credential, subscriptionId);
const result = await client.dataTransferJobs.complete(resourceGroupName, accountName, jobName);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.CosmosDB.Models;
using Azure.ResourceManager.CosmosDB;
// Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobComplete.json
// this example is just showing the usage of "DataTransferJobs_Complete" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this DataTransferJobGetResultResource created on azure
// for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource
string subscriptionId = "e35cc6eb-c8e3-447b-8de6-b83328cd0098";
string resourceGroupName = "rg1";
string accountName = "ddb1";
string jobName = "j1";
ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName);
DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId);
// invoke the operation
DataTransferJobGetResultResource result = await dataTransferJobGetResult.CompleteAsync();
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
DataTransferJobGetResultData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta da amostra
{
"id": "ab1b6f34-b33c-46b1-98c7-3a0a63fd0d16",
"type": "Microsoft.DocumentDB/databaseAccounts/dataTransferJobs",
"properties": {
"jobName": "j1",
"source": {
"tableName": "table",
"keyspaceName": "keyspace",
"component": "CosmosDBCassandra"
},
"destination": {
"component": "AzureBlobStorage",
"containerName": "blob_container",
"endpointUrl": "https://blob.windows.net"
},
"status": "Completed",
"processedCount": 20,
"totalCount": 100,
"lastUpdatedUtcTime": "2021-06-12T11:10:55.2780000Z",
"duration": "00:34:10"
}
}
Definições
AzureBlobDataTransferDataSourceSink
Uma fonte/coletor de dados do Armazenamento de Blobs do Azure
Name |
Tipo |
Default value |
Description |
component
|
string:
AzureBlobStorage
|
CosmosDBCassandra
|
|
containerName
|
string
|
|
|
endpointUrl
|
string
|
|
|
CloudError
Uma resposta de erro do serviço.
CosmosMongoVCoreDataTransferDataSourceSink
Uma fonte/coletor de dados da API CosmosDB Mongo vCore
Name |
Tipo |
Default value |
Description |
collectionName
|
string
|
|
|
component
|
string:
CosmosDBMongoVCore
|
CosmosDBCassandra
|
|
connectionStringKeyVaultUri
|
string
|
|
|
databaseName
|
string
|
|
|
hostName
|
string
|
|
|
DataTransferJobGetResults
Um trabalho de transferência de dados do Cosmos DB
Name |
Tipo |
Description |
id
|
string
|
O identificador de recurso exclusivo da conta de banco de dados.
|
name
|
string
|
O nome da conta de banco de dados.
|
properties.destination
|
DataTransferDataSourceSink:
|
Detalhes do DataStore de destino
|
properties.duration
|
string
|
Duração total do trabalho
|
properties.error
|
ErrorResponse
|
Resposta de erro para trabalho com defeito
|
properties.jobName
|
string
|
Nome do trabalho
|
properties.lastUpdatedUtcTime
|
string
|
Última hora de atualização (formato ISO-8601).
|
properties.mode
|
DataTransferJobMode
|
Modo de execução do trabalho
|
properties.processedCount
|
integer
|
Contagem processada.
|
properties.source
|
DataTransferDataSourceSink:
|
Detalhes do Source DataStore
|
properties.status
|
string
|
Situação do Emprego
|
properties.totalCount
|
integer
|
Contagem total.
|
properties.workerCount
|
integer
|
Contagem de trabalhadores
|
type
|
string
|
O tipo de recurso do Azure.
|
DataTransferJobMode
Modo de execução do trabalho
Name |
Tipo |
Description |
Offline
|
string
|
|
Online
|
string
|
|
ErrorResponse
Resposta de erro.
Name |
Tipo |
Description |
code
|
string
|
Código de erro.
|
message
|
string
|
Mensagem de erro indicando por que a operação falhou.
|