Interface IResourcePoolService
Represents the resource pool API service.
Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IResourcePoolService
Examples
IResourcePoolService _resourcePoolService = relativityFacade.Resolve<IResourcePoolService>();
Methods
| Improve this Doc View SourceAddResources(Int32, ResourceType, List<Artifact>)
Adds a resources of a given type to a given ResourcePool.
Declaration
void AddResources(int resourcePoolId, ResourceType resourceType, List<Artifact> resources)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | resourcePoolId | The ArtifactID of the ResourcePool. |
ResourceType | resourceType | A representation of the resource type. |
System.Collections.Generic.List<Artifact> | resources | A list of identifiers for resources to add to the ResourcePool. |
Examples
This example shows how to add all eligible Agent Worker Servers to the Resource Pool.
int existingResourcePoolArtifactID = 10154345;
List<Artifact> agentsToAdd = _resourcePoolService.QueryEligibleToAddResources(existingResourcePoolArtifactID).Cast<Artifact>().ToList();
_resourcePoolService.AddResources(existingResourcePoolArtifactID, ResourceType.AgentWorkerServers, agentsToAdd);
|
Improve this Doc
View Source
Create(ResourcePool)
Creates the specified ResourcePool.
Declaration
ResourcePool Create(ResourcePool entity)
Parameters
Type | Name | Description |
---|---|---|
ResourcePool | entity | The ResourcePool entity to create. |
Returns
Type | Description |
---|---|
ResourcePool | The ResourcePool entity or null. |
Examples
Client client = relativityFacade.Resolve<IClientService>().Get("Some Existing Client Name");
var resourcePoolToCreate = new ResourcePool
{
Name = "Test Resource Pool",
Client = client
};
ResourcePool createdResourcePool = _resourcePoolService.Create(resourcePoolToCreate);
|
Improve this Doc
View Source
Delete(Int32)
Deletes the specified ResourcePool by the ArtifactID.
Declaration
void Delete(int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | entityId | The ArtifactID of the ResourcePool. |
Examples
int existingResourcePoolArtifactID = 10154345;
_resourcePoolService.Delete(existingResourcePoolArtifactID);
|
Improve this Doc
View Source
Get(Int32)
Gets the ResourcePool by the specified ArtifactID.
Declaration
ResourcePool Get(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The ArtifactID of the ResourcePool. |
Returns
Type | Description |
---|---|
ResourcePool | The ResourcePool entity or null. |
Examples
int existingResourcePoolArtifactID = 10154345;
ResourcePool resourcePool = _resourcePoolService.Get(existingResourcePoolArtifactID);
|
Improve this Doc
View Source
Get(String)
Gets the ResourcePool by the specified name.
Declaration
ResourcePool Get(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
Returns
Type | Description |
---|---|
ResourcePool | The ResourcePool entity or null. |
Examples
string existingResourcePoolName = "Test Resource Pool";
ResourcePool resourcePool = _resourcePoolService.Get(existingResourcePoolName);
|
Improve this Doc
View Source
GetAll()
Gets all ResourcePools.
Declaration
ResourcePool[] GetAll()
Returns
Type | Description |
---|---|
ResourcePool[] | The collection of ResourcePool entities. |
Examples
ResourcePool[] resourcePools = _resourcePoolService.GetAll();
|
Improve this Doc
View Source
Query()
Gets a query for all clients that may be set as the client for a ResourcePool.
Declaration
ResourcePoolQuery<Client> Query()
Returns
Type | Description |
---|---|
ResourcePoolQuery<Client> | The ResourcePoolQuery<TObject> object. |
Examples
List<Client> eligibleClients = _resourcePoolService.Query().ToList();
|
Improve this Doc
View Source
QueryEligibleToAddResources(Int32, ResourceType)
Gets a query to enumerate not yet associated resources of a given type that are eligible to be added to a given ResourcePool.
Declaration
ResourcePoolQuery<ResourceServer> QueryEligibleToAddResources(int resourcePoolId, ResourceType resourceType = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | resourcePoolId | The ArtifactID of the ResourcePool. |
ResourceType | resourceType | A representation of the resource type. By default equals 'agent-worker-servers'. |
Returns
Type | Description |
---|---|
ResourcePoolQuery<ResourceServer> | The ResourcePoolQuery<TObject> object. |
Examples
This example shows how to query for all eligible AnalyticsServers resources for given Resource Pool.
int existingResourcePoolArtifactID = 10154345;
ResourcePoolQuery<ResourceServer> eligibleAnalyticsServers = _resourcePoolService.QueryEligibleToAddResources(existingResourcePoolArtifactID, ResourceType.AnalyticsServers);
|
Improve this Doc
View Source
QueryResources(Int32, ResourceType)
Gets a query to enumerate resources of a given type that are associated with the ResourcePool.
Declaration
ResourcePoolQuery<ResourceServer> QueryResources(int resourcePoolId, ResourceType resourceType = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | resourcePoolId | The ArtifactID of the ResourcePool. |
ResourceType | resourceType | A representation of the resource type. By default equals 'agent-worker-servers'. |
Returns
Type | Description |
---|---|
ResourcePoolQuery<ResourceServer> | The ResourcePoolQuery<TObject> object. |
Examples
This example shows how to query AgentWorkerServers resources in order to one with the specified ArtifactID.
int existingResourcePoolArtifactID = 10154345;
int existingAgentArtifactID = 1017895;
ResourceServer agent = _resourcePoolService.QueryResources(existingResourcePoolArtifactID)
.Where(agent => agent.ArtifactID, existingAgentArtifactID)
.FirstOrDefault();
This example shows how to query for all SqlServers resources for given Resource Pool.
int existingResourcePoolArtifactID = 10154345;
ResourcePoolQuery<ResourceServer> sqlServers = _resourcePoolService.QueryResources(existingResourcePoolArtifactID, ResourceType.SqlServers);
|
Improve this Doc
View Source
RemoveResources(Int32, ResourceType, List<Artifact>)
Removes a resources of a given type from a given ResourcePool.
Declaration
void RemoveResources(int resourcePoolId, ResourceType resourceType, List<Artifact> resources)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | resourcePoolId | The ArtifactID of the ResourcePool. |
ResourceType | resourceType | A representation of the resource type. |
System.Collections.Generic.List<Artifact> | resources | A list of identifiers for resources to remove from the ResourcePool. |
Examples
This example shows how to remove all Agent Worker Servers that have 'Test' in their Name from the Resource Pool.
int existingResourcePoolArtifactID = 10154345;
List<Artifact> agentsToRemove = _resourcePoolService.QueryResources(existingResourcePoolArtifactID)
.Where(agent => agent.Name.Contains("Test"))
.Cast<Artifact>().ToList();
_resourcePoolService.RemoveResources(existingResourcePoolArtifactID, ResourceType.AgentWorkerServers, agentsToRemove);
|
Improve this Doc
View Source
Update(ResourcePool)
Updates the specified ResourcePool.
Declaration
void Update(ResourcePool entity)
Parameters
Type | Name | Description |
---|---|---|
ResourcePool | entity | The ResourcePool entity to update. |
Examples
ResourcePool resourcePoolToUpdate = _resourcePoolService.Get("Some Existing Resource Pool");
resourcePoolToUpdate.Name = "Updated Resource Pool Name";
resourcePoolToUpdate.Notes = "Some Note";
_resourcePoolService.Update(resourcePoolToUpdate);