public virtual Response <InventoryItemResource> Get(string inventoryItemName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(inventoryItemName, nameof(inventoryItemName)); using var scope = _inventoryItemClientDiagnostics.CreateScope("InventoryItemCollection.Get"); scope.Start(); try { var response = _inventoryItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inventoryItemName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new InventoryItemResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <InventoryItem> Get(CancellationToken cancellationToken = default) { using var scope = _inventoryItemClientDiagnostics.CreateScope("InventoryItem.Get"); scope.Start(); try { var response = _inventoryItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _inventoryItemClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new InventoryItem(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }