ODATADetailLevel Class

Definition

Controls the amount of detail requested from the Azure Batch service when listing or retrieving resources, using OData query clauses.

public class ODATADetailLevel : Microsoft.Azure.Batch.DetailLevel
type ODATADetailLevel = class
    inherit DetailLevel
Public Class ODATADetailLevel
Inherits DetailLevel
Inheritance
ODATADetailLevel

Examples

This sample shows how to specify an ODataDetailLevel that lists only active CloudPools, and retrieves only the Id, DisplayName and Statistics for each pool (for example, for display in a reporting user interface).

var detailLevel = new ODATADetailLevel(
    filterClause: "state eq 'active'",
    selectClause: "id,displayName,stats",
    expandClause: "stats"
);

var pools = batchClient.PoolOperations.ListPools(detailLevel);

Remarks

Azure Batch supports OData queries, which allow the client to gain finer control over query performance by controlling which resources are returned in List operations (FilterClause), and which properties of each resource are returned in List, Get or Refresh operations (SelectClause and ExpandClause).

By default, if you do not pass a DetailLevel to a List, Get or Refresh operation, the Batch client specifies no filter (all records are returned), no select clause (all simple properties are returned) and no expand clause (associated entities are not returned). Consequently, by default, associated entity properties are null, rather than being populated like other properties. Refer to individual class documentation to find out which properties are considered associated entities and need to be expanded to be populated.

Because the OData queries are passed directly to the REST API, clause strings must use the JSON attribute names from the REST API, which are not always the same as .NET property names. For example, the .NET CloudPool.VirtualMachineSize property corresponds to the vmSize attribute in the REST API; therefore, to filter a pool list operations by VM size, you would need to write vmSize rather than VirtualMachineSize in your filter string. Refer to the REST API documentation to find out the JSON attribute name corresponding to a .NET property.

For additional information about using OData to efficiently query the Azure Batch service, see Efficient List Queries on MSDN.

Constructors

ODATADetailLevel()

Initializes a new instance of the ODATADetailLevel class with empty clauses.

ODATADetailLevel(String, String, String)

Initializes a new instance of the ODATADetailLevel class with the specified clauses.

Properties

ExpandClause

Gets or sets the OData expand clause. Used to retrieve associated entities of the main entity being retrieved.

FilterClause

Gets or sets the OData filter clause. Used to restrict a list operation to items that match specified criteria.

SelectClause

Gets or sets the OData select clause. Used to retrieve only specific properties instead of all object properties.

Applies to