public virtual Response <SqlTrigger> Get(CancellationToken cancellationToken = default) { using var scope = _sqlTriggerSqlResourcesClientDiagnostics.CreateScope("SqlTrigger.Get"); scope.Start(); try { var response = _sqlTriggerSqlResourcesRestClient.GetSqlTrigger(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _sqlTriggerSqlResourcesClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new SqlTrigger(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <SqlTriggerResource> Get(string triggerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(triggerName, nameof(triggerName)); using var scope = _sqlTriggerSqlResourcesClientDiagnostics.CreateScope("SqlTriggerCollection.Get"); scope.Start(); try { var response = _sqlTriggerSqlResourcesRestClient.GetSqlTrigger(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, triggerName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new SqlTriggerResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }