public async virtual Task <Response <IpGroup> > GetAsync(string ipGroupsName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("IpGroupContainer.Get"); scope.Start(); try { if (ipGroupsName == null) { throw new ArgumentNullException(nameof(ipGroupsName)); } var response = await _restClient.GetAsync(Id.ResourceGroupName, ipGroupsName, expand, cancellationToken : cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new IpGroup(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <IPGroupResource> > GetAsync(string expand = null, CancellationToken cancellationToken = default) { using var scope = _ipGroupIpGroupsClientDiagnostics.CreateScope("IPGroupResource.Get"); scope.Start(); try { var response = await _ipGroupIpGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new IPGroupResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <IPGroup> > GetAsync(string ipGroupsName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ipGroupsName, nameof(ipGroupsName)); using var scope = _ipGroupIpGroupsClientDiagnostics.CreateScope("IPGroupCollection.Get"); scope.Start(); try { var response = await _ipGroupIpGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ipGroupsName, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _ipGroupIpGroupsClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new IPGroup(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }