public virtual Response <RoleInstance> Get(InstanceViewTypes?expand = null, CancellationToken cancellationToken = default) { using var scope = _roleInstanceCloudServiceRoleInstancesClientDiagnostics.CreateScope("RoleInstance.Get"); scope.Start(); try { var response = _roleInstanceCloudServiceRoleInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new RoleInstance(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <RoleInstance> Get(string roleInstanceName, InstanceViewTypes?expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(roleInstanceName, nameof(roleInstanceName)); using var scope = _roleInstanceCloudServiceRoleInstancesClientDiagnostics.CreateScope("RoleInstanceCollection.Get"); scope.Start(); try { var response = _roleInstanceCloudServiceRoleInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleInstanceName, expand, cancellationToken); if (response.Value == null) { throw _roleInstanceCloudServiceRoleInstancesClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new RoleInstance(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }