public virtual Response <CloudServiceRole> Get(string roleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(roleName, nameof(roleName)); using var scope = _cloudServiceRoleClientDiagnostics.CreateScope("CloudServiceRoleCollection.Get"); scope.Start(); try { var response = _cloudServiceRoleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleName, cancellationToken); if (response.Value == null) { throw _cloudServiceRoleClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new CloudServiceRole(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <CloudServiceRole> Get(CancellationToken cancellationToken = default) { using var scope = _cloudServiceRoleClientDiagnostics.CreateScope("CloudServiceRole.Get"); scope.Start(); try { var response = _cloudServiceRoleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _cloudServiceRoleClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new CloudServiceRole(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }