Esempio n. 1
0
        public async virtual Task <Response <DeploymentOperation> > GetAsync(string operationId, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("DeploymentOperationCollection.Get");
            scope.Start();
            try
            {
                if (operationId == null)
                {
                    throw new ArgumentNullException(nameof(operationId));
                }

                var response = await _restClient.GetAtScopeAsync(Id.Parent, Id.Name, operationId, cancellationToken : cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new DeploymentOperation(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Esempio n. 2
0
        public async virtual Task <Response <DeploymentOperation> > GetDeploymentOperationAsync(string operationId, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(operationId, nameof(operationId));

            using var scope = _deploymentOperationsClientDiagnostics.CreateScope("Deployment.GetDeploymentOperation");
            scope.Start();
            try
            {
                var response = await _deploymentOperationsRestClient.GetAtScopeAsync(Id.Parent, Id.Name, operationId, cancellationToken).ConfigureAwait(false);

                return(response);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }