Example #1
0
        public virtual Response <DeploymentOperation> Get(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 = _restClient.GetAtScope(Id.Parent, Id.Name, operationId, cancellationToken: cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new DeploymentOperation(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Example #2
0
        public virtual Response <DeploymentOperation> GetDeploymentOperation(string operationId, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(operationId, nameof(operationId));

            using var scope = _deploymentOperationsClientDiagnostics.CreateScope("Deployment.GetDeploymentOperation");
            scope.Start();
            try
            {
                var response = _deploymentOperationsRestClient.GetAtScope(Id.Parent, Id.Name, operationId, cancellationToken);
                return(response);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 public virtual Response <DeploymentOperation> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("DeploymentOperation.Get");
     scope.Start();
     try
     {
         var response = _restClient.GetAtScope(Id.Parent.Parent, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new DeploymentOperation(this, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }