public async virtual Task <Response <ConnectionMonitor> > GetAsync(string connectionMonitorName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ConnectionMonitorCollection.Get"); scope.Start(); try { if (connectionMonitorName == null) { throw new ArgumentNullException(nameof(connectionMonitorName)); } var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, connectionMonitorName, cancellationToken : cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ConnectionMonitor(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task<Response<ConnectionMonitor>> GetAsync(CancellationToken cancellationToken = default) { using var scope = _connectionMonitorClientDiagnostics.CreateScope("ConnectionMonitor.Get"); scope.Start(); try { var response = await _connectionMonitorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); 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 async Task <Response <ConnectionMonitor> > GetAsync(string connectionMonitorName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(connectionMonitorName, nameof(connectionMonitorName)); using var scope = _connectionMonitorClientDiagnostics.CreateScope("ConnectionMonitorCollection.Get"); scope.Start(); try { var response = await _connectionMonitorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionMonitorName, cancellationToken).ConfigureAwait(false); 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; } }