예제 #1
0
 public virtual Response<ConnectionMonitor> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _connectionMonitorClientDiagnostics.CreateScope("ConnectionMonitor.Get");
     scope.Start();
     try
     {
         var response = _connectionMonitorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
             throw new RequestFailedException(response.GetRawResponse());
         return Response.FromValue(new ConnectionMonitor(Client, response.Value), response.GetRawResponse());
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
        public virtual Response <ConnectionMonitor> Get(string connectionMonitorName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(connectionMonitorName, nameof(connectionMonitorName));

            using var scope = _connectionMonitorClientDiagnostics.CreateScope("ConnectionMonitorCollection.Get");
            scope.Start();
            try
            {
                var response = _connectionMonitorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionMonitorName, cancellationToken);
                if (response.Value == null)
                {
                    throw _connectionMonitorClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new ConnectionMonitor(ArmClient, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
예제 #3
0
        public virtual Response <ConnectionMonitor> Get(string connectionMonitorName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("ConnectionMonitorContainer.Get");
            scope.Start();
            try
            {
                if (connectionMonitorName == null)
                {
                    throw new ArgumentNullException(nameof(connectionMonitorName));
                }

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