Exemplo n.º 1
0
        public async virtual Task <Response <ServerJobAgentJobExecutionStep> > GetAsync(string stepName, CancellationToken cancellationToken = default)
        {
            if (stepName == null)
            {
                throw new ArgumentNullException(nameof(stepName));
            }

            using var scope = _clientDiagnostics.CreateScope("ServerJobAgentJobExecutionStepCollection.Get");
            scope.Start();
            try
            {
                var response = await _jobStepExecutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Guid.Parse(Id.Name), stepName, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new ServerJobAgentJobExecutionStep(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemplo n.º 2
0
        public virtual async Task <Response <ServerJobAgentJobExecutionStepResource> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _serverJobAgentJobExecutionStepJobStepExecutionsClientDiagnostics.CreateScope("ServerJobAgentJobExecutionStepResource.Get");
            scope.Start();
            try
            {
                var response = await _serverJobAgentJobExecutionStepJobStepExecutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Guid.Parse(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new ServerJobAgentJobExecutionStepResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }