public virtual Response <IpAllocation> Get(string expand = null, CancellationToken cancellationToken = default) { using var scope = _ipAllocationClientDiagnostics.CreateScope("IpAllocation.Get"); scope.Start(); try { var response = _ipAllocationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken); if (response.Value == null) { throw _ipAllocationClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new IpAllocation(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <IPAllocation> Get(string ipAllocationName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ipAllocationName, nameof(ipAllocationName)); using var scope = _ipAllocationIpAllocationsClientDiagnostics.CreateScope("IPAllocationCollection.Get"); scope.Start(); try { var response = _ipAllocationIpAllocationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ipAllocationName, expand, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new IPAllocation(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <IpAllocation> Get(string ipAllocationName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("IpAllocationContainer.Get"); scope.Start(); try { if (ipAllocationName == null) { throw new ArgumentNullException(nameof(ipAllocationName)); } var response = _restClient.Get(Id.ResourceGroupName, ipAllocationName, expand, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new IpAllocation(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }