Exemplo n.º 1
0
 public virtual Response <FlowLogResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _flowLogClientDiagnostics.CreateScope("FlowLogResource.Get");
     scope.Start();
     try
     {
         var response = _flowLogRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new FlowLogResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
        public virtual Response <FlowLog> Get(string flowLogName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(flowLogName, nameof(flowLogName));

            using var scope = _flowLogClientDiagnostics.CreateScope("FlowLogCollection.Get");
            scope.Start();
            try
            {
                var response = _flowLogRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, cancellationToken);
                if (response.Value == null)
                {
                    throw _flowLogClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new FlowLog(ArmClient, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemplo n.º 3
0
        public virtual Response <FlowLog> Get(string flowLogName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("FlowLogContainer.Get");
            scope.Start();
            try
            {
                if (flowLogName == null)
                {
                    throw new ArgumentNullException(nameof(flowLogName));
                }

                var response = _restClient.Get(Id.ResourceGroupName, Id.Name, flowLogName, cancellationToken: cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new FlowLog(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }