public virtual Response<PublicIPPrefixResource> Get(string expand = null, CancellationToken cancellationToken = default) { using var scope = _publicIPPrefixClientDiagnostics.CreateScope("PublicIPPrefixResource.Get"); scope.Start(); try { var response = _publicIPPrefixRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new PublicIPPrefixResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <PublicIPPrefix> Get(string publicIpPrefixName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(publicIpPrefixName, nameof(publicIpPrefixName)); using var scope = _publicIPPrefixClientDiagnostics.CreateScope("PublicIPPrefixCollection.Get"); scope.Start(); try { var response = _publicIPPrefixRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publicIpPrefixName, expand, cancellationToken); if (response.Value == null) { throw _publicIPPrefixClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new PublicIPPrefix(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <PublicIPPrefix> Get(string publicIpPrefixName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixContainer.Get"); scope.Start(); try { if (publicIpPrefixName == null) { throw new ArgumentNullException(nameof(publicIpPrefixName)); } var response = _restClient.Get(Id.ResourceGroupName, publicIpPrefixName, expand, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new PublicIPPrefix(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }