public virtual Response <SqlUserDefinedFunction> Get(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("SqlUserDefinedFunction.Get"); scope.Start(); try { var response = _sqlResourcesRestClient.GetSqlUserDefinedFunction(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new SqlUserDefinedFunction(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <SqlUserDefinedFunction> Get(string userDefinedFunctionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(userDefinedFunctionName, nameof(userDefinedFunctionName)); using var scope = _sqlUserDefinedFunctionSqlResourcesClientDiagnostics.CreateScope("SqlUserDefinedFunctionCollection.Get"); scope.Start(); try { var response = _sqlUserDefinedFunctionSqlResourcesRestClient.GetSqlUserDefinedFunction(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userDefinedFunctionName, cancellationToken); if (response.Value == null) { throw _sqlUserDefinedFunctionSqlResourcesClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new SqlUserDefinedFunction(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }