public async Task <ResponseWithHeaders <FullBackupDetailsInternal, ServiceFullBackupHeaders> > FullBackupAsync(string vaultBaseUrl, SASTokenParameter azureStorageBlobContainerUri = null, CancellationToken cancellationToken = default)
        {
            if (vaultBaseUrl == null)
            {
                throw new ArgumentNullException(nameof(vaultBaseUrl));
            }

            using var message = CreateFullBackupRequest(vaultBaseUrl, azureStorageBlobContainerUri);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            var headers = new ServiceFullBackupHeaders(message.Response);

            switch (message.Response.Status)
            {
            case 202:
            {
                FullBackupDetailsInternal value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                if (document.RootElement.ValueKind == JsonValueKind.Null)
                {
                    value = null;
                }
                else
                {
                    value = FullBackupDetailsInternal.DeserializeFullBackupDetailsInternal(document.RootElement);
                }
                return(ResponseWithHeaders.FromValue(value, headers, message.Response));
            }
Ejemplo n.º 2
0
        public ResponseWithHeaders <ServiceFullBackupHeaders> FullBackup(string vaultBaseUrl, SASTokenParameter azureStorageBlobContainerUri = null, CancellationToken cancellationToken = default)
        {
            if (vaultBaseUrl == null)
            {
                throw new ArgumentNullException(nameof(vaultBaseUrl));
            }

            using var message = CreateFullBackupRequest(vaultBaseUrl, azureStorageBlobContainerUri);
            _pipeline.Send(message, cancellationToken);
            var headers = new ServiceFullBackupHeaders(message.Response);

            switch (message.Response.Status)
            {
            case 202:
                return(ResponseWithHeaders.FromValue(headers, message.Response));

            default:
                throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }
 /// <summary>
 /// Extracts the operation JobId from the <see cref="ServiceFullBackupHeaders" /> AzureAsyncOperation.
 /// </summary>
 /// <returns>The operation JobId.</returns>
 public static string JobId(this ServiceFullBackupHeaders header)
 {
     return(GetJobIdFromAzureAsyncOperation(header.AzureAsyncOperation));
 }