Package org.azd.distributedtask
Class DistributedTaskApi
- All Implemented Interfaces:
DistributedTaskDetails
public class DistributedTaskApi
extends AzDAsyncApi<DistributedTaskApi>
implements DistributedTaskDetails
DistributedTaskApi class to manage Agents, Deployment groups, Environments and Variable groups API
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDeploymentGroup
(String name, String description) Create a deployment group.addDeploymentGroup
(String name, String description, int poolId) Create a deployment group.addEnvironment
(String name, String description) Create an environment.addVariableGroup
(String name, String description, VariableGroupMap variables) Add a variable group.addVariableGroup
(VariableGroupDefinition variableGroupDefinition) Add a variable group.deleteAgent
(int poolId, int agentId) Delete an agent.deleteDeploymentGroup
(int deploymentGroupId) Delete a deployment group.deleteEnvironment
(int environmentId) Delete the specified environment.deleteVariableGroup
(int variableGroupId, String[] projectIds) Delete a variable groupgetAgent
(int poolId, int agentId) Get information about an agent.getAgent
(int poolId, int agentId, boolean includeAssignedRequest, boolean includeCapabilities, boolean includeLastCompletedRequest, String[] propertyFilters) Get information about an agent.getAgents
(int poolId) Get a list of agents.getAgents
(int poolId, String agentName, String[] demands, boolean includeAssignedRequest, boolean includeCapabilities, boolean includeLastCompletedRequest, String[] propertyFilters) Get a list of agents.getDeploymentGroup
(int deploymentGroupId) Get a deployment group by its ID.getDeploymentGroup
(int deploymentGroupId, DeploymentGroupExpands expand, DeploymentGroupActionFilter actionFilter) Get a deployment group by its ID.Get a list of deployment groups by name or IDs.getDeploymentGroups
(int top) Get a list of deployment groups by name or IDs.getDeploymentGroups
(int[] ids) Get a list of deployment groups by name or IDs.getDeploymentGroups
(String name) Get a list of deployment groups by name or IDs.Get a list of deployment groups by name or IDs.getDeploymentGroups
(DeploymentGroupExpands expand, int top, DeploymentGroupActionFilter actionFilter, String continuationToken, int[] ids, String name) Get a list of deployment groups by name or IDs.getEnvironment
(int environmentId) Get an environment by its ID.getEnvironment
(int environmentId, EnvironmentExpands expands) Get an environment by its ID.Get all environments.getEnvironments
(int top) Get all environments.getEnvironments
(int top, String continuationToken, String name) Get all environments.getEnvironments
(String name) Get all environments.getVariableGroup
(int variableGroupId) Get a variable group.Get variable groups.getVariableGroups
(int top) Get variable groups.getVariableGroups
(int top, VariableGroupActionFilter actionFilter, int continuationToken, String groupName, VariableGroupQueryOrder queryOrder) Get variable groups.getVariableGroups
(String groupName) Get variable groups.updateAgent
(int poolId, int agentId, TaskAgent requestBody) Update agent details.updateDeploymentGroup
(int deploymentGroupId, String name, String description) Update a deployment group.updateEnvironment
(int environmentId, String name, String description) Update the specified environment.updateVariableGroup
(int groupId, String name, String description, VariableGroupMap variables) Update a variable group.updateVariableGroup
(int groupId, VariableGroupDefinition variableGroupDefinition) Update a variable group.Methods inherited from class org.azd.utils.AzDAsyncApi
createAsync
-
Constructor Details
-
DistributedTaskApi
Pass the connection object- Parameters:
connection
- Connection object
-
-
Method Details
-
deleteAgent
Delete an agent.- Specified by:
deleteAgent
in interfaceDistributedTaskDetails
- Parameters:
poolId
- The pool ID to remove the agent fromagentId
- The agent ID to remove- Throws:
AzDException
- Default Api Exception handler.
-
getAgent
Get information about an agent.- Specified by:
getAgent
in interfaceDistributedTaskDetails
- Parameters:
poolId
- The agent pool containing the agentagentId
- The agent ID to get information about- Returns:
- A TaskAgent object
TaskAgent
- Throws:
AzDException
- Default Api Exception handler.
-
getAgent
public TaskAgent getAgent(int poolId, int agentId, boolean includeAssignedRequest, boolean includeCapabilities, boolean includeLastCompletedRequest, String[] propertyFilters) throws AzDException Get information about an agent.- Specified by:
getAgent
in interfaceDistributedTaskDetails
- Parameters:
poolId
- The agent pool containing the agentagentId
- The agent ID to get information aboutincludeAssignedRequest
- Whether to include details about the agent's current workincludeCapabilities
- Whether to include the agent's capabilities in the responseincludeLastCompletedRequest
- Whether to include details about the agents' most recent completed workpropertyFilters
- Filter which custom properties will be returned- Returns:
- A TaskAgent object
TaskAgent
- Throws:
AzDException
- Default Api Exception handler.
-
getAgents
Get a list of agents.- Specified by:
getAgents
in interfaceDistributedTaskDetails
- Parameters:
poolId
- The agent pool containing the agents- Returns:
- TaskAgents object
TaskAgents
- Throws:
AzDException
- Default Api Exception handler.
-
getAgents
public TaskAgents getAgents(int poolId, String agentName, String[] demands, boolean includeAssignedRequest, boolean includeCapabilities, boolean includeLastCompletedRequest, String[] propertyFilters) throws AzDException Get a list of agents.- Specified by:
getAgents
in interfaceDistributedTaskDetails
- Parameters:
poolId
- The agent pool containing the agentsagentName
- Filter on agent namedemands
- Filter by demands the agents can satisfyincludeAssignedRequest
- Whether to include details about the agents' current workincludeCapabilities
- Whether to include the agents' capabilities in the responseincludeLastCompletedRequest
- Whether to include details about the agents' most recent completed workpropertyFilters
- Filter which custom properties will be returned- Returns:
- TaskAgents object
TaskAgents
- Throws:
AzDException
- Default Api Exception handler.
-
updateAgent
Update agent details.- Specified by:
updateAgent
in interfaceDistributedTaskDetails
- Parameters:
poolId
- The agent pool to useagentId
- The agent to updaterequestBody
- Map of request body.Visit https://docs.microsoft.com/en-us/rest/api/azure/devops/distributedtask/agents/update?view=azure-devops-rest-7.1#request-body for more details.
- Returns:
- A TaskAgent object
TaskAgent
- Throws:
AzDException
- Default Api Exception handler.
-
addDeploymentGroup
Create a deployment group.- Specified by:
addDeploymentGroup
in interfaceDistributedTaskDetails
- Parameters:
name
- Name of the deployment group.description
- Description of the deployment group.- Returns:
- Deployment group object
DeploymentGroup
- Throws:
AzDException
- Default Api Exception handler.
-
addDeploymentGroup
public DeploymentGroup addDeploymentGroup(String name, String description, int poolId) throws AzDException Create a deployment group.- Specified by:
addDeploymentGroup
in interfaceDistributedTaskDetails
- Parameters:
name
- Name of the deployment group.description
- Description of the deployment group.poolId
- Identifier of the deployment pool in which deployment agents are registered.- Returns:
- Deployment group object
DeploymentGroup
- Throws:
AzDException
- Default Api Exception handler.
-
deleteDeploymentGroup
Delete a deployment group.- Specified by:
deleteDeploymentGroup
in interfaceDistributedTaskDetails
- Parameters:
deploymentGroupId
- ID of the deployment group to be deleted.- Throws:
AzDException
- Default Api Exception handler.
-
getDeploymentGroup
Get a deployment group by its ID.- Specified by:
getDeploymentGroup
in interfaceDistributedTaskDetails
- Parameters:
deploymentGroupId
- ID of the deployment group to be deleted.- Returns:
- Deployment group object
DeploymentGroup
- Throws:
AzDException
- Default Api Exception handler.
-
getDeploymentGroup
public DeploymentGroup getDeploymentGroup(int deploymentGroupId, DeploymentGroupExpands expand, DeploymentGroupActionFilter actionFilter) throws AzDException Get a deployment group by its ID.- Specified by:
getDeploymentGroup
in interfaceDistributedTaskDetails
- Parameters:
deploymentGroupId
- ID of the deployment group to be deleted.expand
- Include these additional details in the returned object.actionFilter
- Get the deployment group only if this action can be performed on it.- Returns:
- Deployment group object
DeploymentGroup
- Throws:
AzDException
- Default Api Exception handler.
-
getDeploymentGroups
Get a list of deployment groups by name or IDs.- Specified by:
getDeploymentGroups
in interfaceDistributedTaskDetails
- Returns:
- Deployment groups object
DeploymentGroups
- Throws:
AzDException
- Default Api Exception handler.
-
getDeploymentGroups
Get a list of deployment groups by name or IDs.- Specified by:
getDeploymentGroups
in interfaceDistributedTaskDetails
- Parameters:
top
- Maximum number of deployment groups to return. Default is 1000.- Returns:
- Deployment groups object
DeploymentGroups
- Throws:
AzDException
- Default Api Exception handler.
-
getDeploymentGroups
Get a list of deployment groups by name or IDs.- Specified by:
getDeploymentGroups
in interfaceDistributedTaskDetails
- Parameters:
ids
- Array of Id of deployment groups.- Returns:
- Deployment groups object
DeploymentGroups
- Throws:
AzDException
- Default Api Exception handler.
-
getDeploymentGroups
Get a list of deployment groups by name or IDs.- Specified by:
getDeploymentGroups
in interfaceDistributedTaskDetails
- Parameters:
name
- Name of the deployment group.- Returns:
- Deployment groups object
DeploymentGroups
- Throws:
AzDException
- Default Api Exception handler.
-
getDeploymentGroups
Get a list of deployment groups by name or IDs.- Specified by:
getDeploymentGroups
in interfaceDistributedTaskDetails
- Parameters:
expand
- Include these additional details in the returned objects.DeploymentGroupExpands
- Returns:
- Deployment groups object
DeploymentGroups
- Throws:
AzDException
- Default Api Exception handler.
-
getDeploymentGroups
public DeploymentGroups getDeploymentGroups(DeploymentGroupExpands expand, int top, DeploymentGroupActionFilter actionFilter, String continuationToken, int[] ids, String name) throws AzDException Get a list of deployment groups by name or IDs.- Specified by:
getDeploymentGroups
in interfaceDistributedTaskDetails
- Parameters:
expand
- Include these additional details in the returned objects.DeploymentGroupExpands
top
- Maximum number of deployment groups to return. Default is 1000.actionFilter
- Get only deployment groups on which this action can be performed.DeploymentGroupActionFilter
continuationToken
- Get deployment groups with names greater than this continuationToken lexicographically.ids
- Comma separated list of IDs of the deployment groups.name
- Name of the deployment group.- Returns:
- Deployment groups object
DeploymentGroups
- Throws:
AzDException
- Default Api Exception handler.
-
updateDeploymentGroup
public DeploymentGroup updateDeploymentGroup(int deploymentGroupId, String name, String description) throws AzDException Update a deployment group.- Specified by:
updateDeploymentGroup
in interfaceDistributedTaskDetails
- Parameters:
deploymentGroupId
- ID of the deployment group.name
- Name of the deployment group.description
- Description of the deployment group.- Returns:
- Deployment group object
DeploymentGroup
- Throws:
AzDException
- Default Api Exception handler.
-
addEnvironment
Create an environment.- Specified by:
addEnvironment
in interfaceDistributedTaskDetails
- Parameters:
name
- Name of the environment.description
- Description of the environment.- Returns:
- Environment instance
EnvironmentInstance
- Throws:
AzDException
- Default Api Exception handler.
-
deleteEnvironment
Delete the specified environment.- Specified by:
deleteEnvironment
in interfaceDistributedTaskDetails
- Parameters:
environmentId
- ID of the environment.- Throws:
AzDException
- Default Api Exception handler.
-
getEnvironment
Get an environment by its ID.- Specified by:
getEnvironment
in interfaceDistributedTaskDetails
- Parameters:
environmentId
- ID of the environment.- Returns:
- Environment instance
EnvironmentInstance
- Throws:
AzDException
- Default Api Exception handler.
-
getEnvironment
public EnvironmentInstance getEnvironment(int environmentId, EnvironmentExpands expands) throws AzDException Get an environment by its ID.- Specified by:
getEnvironment
in interfaceDistributedTaskDetails
- Parameters:
environmentId
- ID of the environment.expands
- Include these additional details in the returned objects.EnvironmentExpands
- Returns:
- Environment instance
EnvironmentInstance
- Throws:
AzDException
- Default Api Exception handler.
-
getEnvironments
Get all environments.- Specified by:
getEnvironments
in interfaceDistributedTaskDetails
- Returns:
- Environment instances array
EnvironmentInstances
- Throws:
AzDException
- Default Api Exception handler.
-
getEnvironments
Get all environments.- Specified by:
getEnvironments
in interfaceDistributedTaskDetails
- Parameters:
top
- Top environments to list- Returns:
- Environment instances array
EnvironmentInstances
- Throws:
AzDException
- Default Api Exception handler.
-
getEnvironments
Get all environments.- Specified by:
getEnvironments
in interfaceDistributedTaskDetails
- Parameters:
name
- Name of the environment.- Returns:
- Environment instances array
EnvironmentInstances
- Throws:
AzDException
- Default Api Exception handler.
-
getEnvironments
public EnvironmentInstances getEnvironments(int top, String continuationToken, String name) throws AzDException Get all environments.- Specified by:
getEnvironments
in interfaceDistributedTaskDetails
- Parameters:
top
- Top environments to list.continuationToken
- Get the list of environments paginated.name
- Name of the environment.- Returns:
- Environment instances array
EnvironmentInstances
- Throws:
AzDException
- Default Api Exception handler.
-
updateEnvironment
public EnvironmentInstance updateEnvironment(int environmentId, String name, String description) throws AzDException Update the specified environment.- Specified by:
updateEnvironment
in interfaceDistributedTaskDetails
- Parameters:
environmentId
- ID of the environment.name
- Name of the environment.description
- Description of the environment.- Returns:
- Environment instance
EnvironmentInstance
- Throws:
AzDException
- Default Api Exception handler.
-
addVariableGroup
public VariableGroup addVariableGroup(VariableGroupDefinition variableGroupDefinition) throws AzDException Add a variable group.- Specified by:
addVariableGroup
in interfaceDistributedTaskDetails
- Parameters:
variableGroupDefinition
- Variable group definitionVariableGroupDefinition
- Returns:
- Variable group
VariableGroup
- Throws:
AzDException
- Default Api Exception handler.
-
addVariableGroup
public VariableGroup addVariableGroup(String name, String description, VariableGroupMap variables) throws AzDException Add a variable group.- Specified by:
addVariableGroup
in interfaceDistributedTaskDetails
- Parameters:
name
- Name of the variable group.description
- Description for the variable group.variables
- Map of variables to add.- Returns:
- Variable group
VariableGroup
- Throws:
AzDException
- Default Api Exception handler.
-
deleteVariableGroup
Delete a variable group- Specified by:
deleteVariableGroup
in interfaceDistributedTaskDetails
- Parameters:
variableGroupId
- Id of the variable group.projectIds
- String array of project ids.- Throws:
AzDException
- Default Api Exception handler.
-
getVariableGroup
Get a variable group.- Specified by:
getVariableGroup
in interfaceDistributedTaskDetails
- Parameters:
variableGroupId
- Id of the variable group.- Returns:
- Variable group
VariableGroup
- Throws:
AzDException
- Default Api Exception handler.
-
getVariableGroups
Get variable groups.- Specified by:
getVariableGroups
in interfaceDistributedTaskDetails
- Returns:
- Variable groups object
VariableGroups
- Throws:
AzDException
- Default Api Exception handler.
-
getVariableGroups
Get variable groups.- Specified by:
getVariableGroups
in interfaceDistributedTaskDetails
- Parameters:
top
- Number of variable groups to get.- Returns:
- Variable groups object
VariableGroups
- Throws:
AzDException
- Default Api Exception handler.
-
getVariableGroups
Get variable groups.- Specified by:
getVariableGroups
in interfaceDistributedTaskDetails
- Parameters:
groupName
- Name of variable group.- Returns:
- Variable groups object
VariableGroups
- Throws:
AzDException
- Default Api Exception handler.
-
getVariableGroups
public VariableGroups getVariableGroups(int top, VariableGroupActionFilter actionFilter, int continuationToken, String groupName, VariableGroupQueryOrder queryOrder) throws AzDException Get variable groups.- Specified by:
getVariableGroups
in interfaceDistributedTaskDetails
- Parameters:
top
- Number of variable groups to get.actionFilter
- Action filter for the variable group. It specifies the action which can be performed on the variable groups.VariableGroupActionFilter
continuationToken
- Gets the variable groups after the continuation token provided.groupName
- Name of variable group.queryOrder
- Gets the results in the defined order. Default is 'IdDescending'.VariableGroupQueryOrder
- Returns:
- Variable groups object
VariableGroups
- Throws:
AzDException
- Default Api Exception handler.
-
updateVariableGroup
public VariableGroup updateVariableGroup(int groupId, String name, String description, VariableGroupMap variables) throws AzDException Update a variable group.- Specified by:
updateVariableGroup
in interfaceDistributedTaskDetails
- Parameters:
groupId
- Id of the variable group to update.name
- Sets name of the variable group.description
- Sets description of the variable group.variables
- Sets variables contained in the variable group.- Returns:
- Variable group
VariableGroup
- Throws:
AzDException
- Default Api Exception handler.
-
updateVariableGroup
public VariableGroup updateVariableGroup(int groupId, VariableGroupDefinition variableGroupDefinition) throws AzDException Update a variable group.- Specified by:
updateVariableGroup
in interfaceDistributedTaskDetails
- Parameters:
groupId
- Id of the variable group to update.variableGroupDefinition
- Variable group definitionVariableGroupDefinition
- Returns:
- Variable group
VariableGroup
- Throws:
AzDException
- Default Api Exception handler.
-