Targets - List

获取部署组中的部署目标列表。

GET https://dev.azure.com/{organization}/{project}/_apis/distributedtask/deploymentgroups/{deploymentGroupId}/targets?api-version=5.0-preview.1
GET https://dev.azure.com/{organization}/{project}/_apis/distributedtask/deploymentgroups/{deploymentGroupId}/targets?tags={tags}&name={name}&partialNameMatch={partialNameMatch}&$expand={$expand}&agentStatus={agentStatus}&agentJobResult={agentJobResult}&continuationToken={continuationToken}&$top={$top}&enabled={enabled}&api-version=5.0-preview.1

URI 参数

名称 必需 类型 说明
deploymentGroupId
path True

integer

int32

部署组的 ID。

organization
path True

string

Azure DevOps 组织的名称。

project
path True

string

项目 ID 或项目名称

api-version
query True

string

要使用的 API 版本。 应将其设置为“5.0-preview.1”才能使用此版本的 API。

$expand
query

DeploymentTargetExpands

在返回的对象中包含这些附加详细信息。

$top
query

integer

int32

要返回的最大部署目标数。 默认值为 1000

agentJobResult
query

TaskAgentJobResultFilter

仅获取具有此最后一个作业结果的部署目标。

agentStatus
query

TaskAgentStatusFilter

仅获取具有此状态的部署目标。

continuationToken
query

string

按字典顺序获取名称大于此 continuationToken 的部署目标。

enabled
query

boolean

仅获取启用或禁用的部署目标。 默认值为“null”,返回所有目标。

name
query

string

要返回的部署目标的名称模式。

partialNameMatch
query

boolean

设置为 true 时,将 名称 视为模式。 否则将其视为绝对匹配。 默认值为 false

tags
query

string

array (string)

仅获取包含所有这些以逗号分隔的标记列表的部署目标。

响应

名称 类型 说明
200 OK

DeploymentMachine[]

成功的操作

安全性

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

名称 说明
vso.machinegroup_manage 提供管理部署组和代理池的功能

示例

Get deployment targets by partial name match
Get deployment targets filtered by agent status
Get deployment targets having given tags
Get deployment targets in pages
Get deployment targets including their last job requests
List all deployment targets in a deployment group

Get deployment targets by partial name match

Sample Request

GET https://dev.azure.com/fabrikam/{project}/_apis/distributedtask/deploymentgroups/{deploymentGroupId}/targets?api-version=5.0-preview.1

Sample Response

{
  "count": 1,
  "value": [
    {
      "tags": [
        "web"
      ],
      "id": 5,
      "agent": {
        "_links": {
          "self": {
            "href": "https://dev.azure.com/fabrikam/_apis/distributedtask/pools/17/agents/5"
          },
          "web": {
            "href": "https://dev.azure.com/fabrikam/_admin/_AgentPool#_a=agents&poolId=17&agentId=5"
          }
        },
        "maxParallelism": 1,
        "createdOn": "2018-02-19T09:19:41.053Z",
        "id": 5,
        "name": "demoTarget1",
        "version": "2.127.0",
        "osDescription": "Microsoft Windows 10.0.14393 ",
        "enabled": true,
        "status": "online"
      }
    }
  ]
}

Get deployment targets filtered by agent status

Sample Request

GET https://dev.azure.com/fabrikam/{project}/_apis/distributedtask/deploymentgroups/{deploymentGroupId}/targets?api-version=5.0-preview.1

Sample Response

{
  "count": 1,
  "value": [
    {
      "tags": [
        "web"
      ],
      "id": 5,
      "agent": {
        "_links": {
          "self": {
            "href": "https://dev.azure.com/fabrikam/_apis/distributedtask/pools/17/agents/5"
          },
          "web": {
            "href": "https://dev.azure.com/fabrikam/_admin/_AgentPool#_a=agents&poolId=17&agentId=5"
          }
        },
        "maxParallelism": 1,
        "createdOn": "2018-02-19T09:19:41.053Z",
        "id": 5,
        "name": "demoTarget1",
        "version": "2.127.0",
        "osDescription": "Microsoft Windows 10.0.14393 ",
        "enabled": true,
        "status": "online"
      }
    }
  ]
}

Get deployment targets having given tags

Sample Request

GET https://dev.azure.com/fabrikam/{project}/_apis/distributedtask/deploymentgroups/{deploymentGroupId}/targets?api-version=5.0-preview.1

Sample Response

{
  "count": 1,
  "value": [
    {
      "tags": [
        "db",
        "web"
      ],
      "id": 7,
      "agent": {
        "_links": {
          "self": {
            "href": "https://dev.azure.com/fabrikam/_apis/distributedtask/pools/17/agents/7"
          },
          "web": {
            "href": "https://dev.azure.com/fabrikam/_admin/_AgentPool#_a=agents&poolId=17&agentId=7"
          }
        },
        "maxParallelism": 1,
        "createdOn": "2018-02-19T09:26:48.11Z",
        "id": 7,
        "name": "demoTarget11",
        "version": "2.127.0",
        "osDescription": "Microsoft Windows 10.0.14393 ",
        "enabled": true,
        "status": "offline"
      }
    }
  ]
}

Get deployment targets in pages

Sample Request

GET https://dev.azure.com/fabrikam/{project}/_apis/distributedtask/deploymentgroups/{deploymentGroupId}/targets?api-version=5.0-preview.1

Sample Response

x-MS-ContinuationToken: demoTarget2
{
  "count": 2,
  "value": [
    {
      "tags": [
        "web"
      ],
      "id": 5,
      "agent": {
        "_links": {
          "self": {
            "href": "https://dev.azure.com/fabrikam/_apis/distributedtask/pools/17/agents/5"
          },
          "web": {
            "href": "https://dev.azure.com/fabrikam/_admin/_AgentPool#_a=agents&poolId=17&agentId=5"
          }
        },
        "maxParallelism": 1,
        "createdOn": "2018-02-19T09:19:41.053Z",
        "id": 5,
        "name": "demoTarget1",
        "version": "2.127.0",
        "osDescription": "Microsoft Windows 10.0.14393 ",
        "enabled": true,
        "status": "online"
      }
    },
    {
      "tags": [
        "db",
        "web"
      ],
      "id": 7,
      "agent": {
        "_links": {
          "self": {
            "href": "https://dev.azure.com/fabrikam/_apis/distributedtask/pools/17/agents/7"
          },
          "web": {
            "href": "https://dev.azure.com/fabrikam/_admin/_AgentPool#_a=agents&poolId=17&agentId=7"
          }
        },
        "maxParallelism": 1,
        "createdOn": "2018-02-19T09:26:48.11Z",
        "id": 7,
        "name": "demoTarget11",
        "version": "2.127.0",
        "osDescription": "Microsoft Windows 10.0.14393 ",
        "enabled": true,
        "status": "offline"
      }
    }
  ]
}

Get deployment targets including their last job requests

Sample Request

GET https://dev.azure.com/fabrikam/{project}/_apis/distributedtask/deploymentgroups/{deploymentGroupId}/targets?api-version=5.0-preview.1

Sample Response

{
  "count": 1,
  "value": [
    {
      "tags": [
        "web"
      ],
      "id": 5,
      "agent": {
        "_links": {
          "self": {
            "href": "https://dev.azure.com/fabrikam/_apis/distributedtask/pools/17/agents/5"
          },
          "web": {
            "href": "https://dev.azure.com/fabrikam/_admin/_AgentPool#_a=agents&poolId=17&agentId=5"
          }
        },
        "maxParallelism": 1,
        "createdOn": "2018-02-19T09:19:41.053Z",
        "lastCompletedRequest": {
          "requestId": 1,
          "queueTime": "2018-02-19T09:28:48.2633333Z",
          "assignTime": "2018-02-19T09:28:48.2633333Z",
          "receiveTime": "2018-02-19T09:28:52.2811279Z",
          "finishTime": "2018-02-19T09:28:57.7333333Z",
          "result": "succeeded",
          "serviceOwner": "0000000d-0000-8888-8000-000000000000",
          "hostId": "86088ab1-30d8-4526-9663-3406752b8bc6",
          "scopeId": "91879ed9-819b-46f3-9e0b-52ed4b20c04c",
          "planType": "Deployment",
          "planId": "b7245fde-fb04-40f3-b187-78772599f522",
          "jobId": "2fd39b55-daaa-499a-ad70-1896ac468a9f",
          "demands": [
            "DotNetFramework",
            "Agent.Version -gtVersion 1.102"
          ],
          "reservedAgent": {
            "id": 5,
            "name": "demoTarget1",
            "version": "2.127.0",
            "enabled": true,
            "status": "online"
          },
          "definition": {
            "_links": {
              "web": {
                "href": "https://dev.azure.com/fabrikam/91879ed9-819b-46f3-9e0b-52ed4b20c04c/_release?definitionId=1"
              },
              "self": {
                "href": "https://https://vsrm.dev.azure.com/fabrikam/91879ed9-819b-46f3-9e0b-52ed4b20c04c/_apis/Release/definitions/1"
              }
            },
            "id": 1,
            "name": "New Release Definition"
          },
          "owner": {
            "_links": {
              "web": {
                "href": "https://dev.azure.com/fabrikam/91879ed9-819b-46f3-9e0b-52ed4b20c04c/_release?releaseId=1&_a=release-summary"
              },
              "self": {
                "href": "https://https://vsrm.dev.azure.com/fabrikam/91879ed9-819b-46f3-9e0b-52ed4b20c04c/_apis/Release/releases/1"
              }
            },
            "id": 1,
            "name": "Release-1 / Environment 1"
          },
          "data": {},
          "agentDelays": []
        },
        "id": 5,
        "name": "demoTarget1",
        "version": "2.127.0",
        "osDescription": "Microsoft Windows 10.0.14393 ",
        "enabled": true,
        "status": "online"
      }
    }
  ]
}

List all deployment targets in a deployment group

Sample Request

GET https://dev.azure.com/fabrikam/{project}/_apis/distributedtask/deploymentgroups/{deploymentGroupId}/targets?api-version=5.0-preview.1

Sample Response

{
  "count": 3,
  "value": [
    {
      "tags": [
        "web"
      ],
      "id": 5,
      "agent": {
        "_links": {
          "self": {
            "href": "https://dev.azure.com/fabrikam/_apis/distributedtask/pools/17/agents/5"
          },
          "web": {
            "href": "https://dev.azure.com/fabrikam/_admin/_AgentPool#_a=agents&poolId=17&agentId=5"
          }
        },
        "maxParallelism": 1,
        "createdOn": "2018-02-19T09:19:41.053Z",
        "id": 5,
        "name": "demoTarget1",
        "version": "2.127.0",
        "osDescription": "Microsoft Windows 10.0.14393 ",
        "enabled": true,
        "status": "online"
      }
    },
    {
      "tags": [
        "db",
        "web"
      ],
      "id": 7,
      "agent": {
        "_links": {
          "self": {
            "href": "https://dev.azure.com/fabrikam/_apis/distributedtask/pools/17/agents/7"
          },
          "web": {
            "href": "https://dev.azure.com/fabrikam/_admin/_AgentPool#_a=agents&poolId=17&agentId=7"
          }
        },
        "maxParallelism": 1,
        "createdOn": "2018-02-19T09:26:48.11Z",
        "id": 7,
        "name": "demoTarget11",
        "version": "2.127.0",
        "osDescription": "Microsoft Windows 10.0.14393 ",
        "enabled": true,
        "status": "offline"
      }
    },
    {
      "tags": [
        "db"
      ],
      "id": 6,
      "agent": {
        "_links": {
          "self": {
            "href": "https://dev.azure.com/fabrikam/_apis/distributedtask/pools/17/agents/6"
          },
          "web": {
            "href": "https://dev.azure.com/fabrikam/_admin/_AgentPool#_a=agents&poolId=17&agentId=6"
          }
        },
        "maxParallelism": 1,
        "createdOn": "2018-02-19T09:23:58.267Z",
        "id": 6,
        "name": "demoTarget2",
        "version": "2.127.0",
        "osDescription": "Microsoft Windows 10.0.14393 ",
        "enabled": true,
        "status": "offline"
      }
    }
  ]
}

定义

名称 说明
Demand
DeploymentMachine

部署目标。

DeploymentTargetExpands

在返回的对象中包含这些附加详细信息。

IdentityRef
JObject
JToken
PackageVersion
PropertiesCollection

类将属性包表示为键值对的集合。 接受除 之外DBNull的所有基元类型的值 (具有TypeCode != TypeCode.Object) 的任何类型。 Byte[]、Int32、Double、DateType 和 String 类型的值保留其类型,其他基元将重新调整为 String。 Byte[] 应为 base64 编码字符串。

ReferenceLinks

表示 REST 引用链接集合的类。

TaskAgent
TaskAgentAuthorization

提供使用 OAuth 2.0 身份验证流授权代理所需的数据。

TaskAgentCloudRequest
TaskAgentDelaySource
TaskAgentJobRequest
TaskAgentJobResultFilter

仅获取具有此最后一个作业结果的部署目标。

TaskAgentPoolReference
TaskAgentPoolType

获取或设置池的类型

TaskAgentPublicKey

表示 RSA 非对称密钥的公钥部分。

TaskAgentReference
TaskAgentStatus

获取代理的当前连接状态。

TaskAgentStatusFilter

仅获取具有此状态的部署目标。

TaskAgentUpdate
TaskAgentUpdateReason
TaskAgentUpdateReasonType
TaskOrchestrationOwner
TaskResult

Demand

名称 类型 说明
name

string

value

string

DeploymentMachine

部署目标。

名称 类型 说明
agent

TaskAgent

部署代理。

id

integer

部署目标标识符。

tags

string[]

部署目标的标记。

DeploymentTargetExpands

在返回的对象中包含这些附加详细信息。

名称 类型 说明
assignedRequest

string

包括分配给部署代理的作业请求。

capabilities

string

包括部署代理的功能。

lastCompletedRequest

string

包括部署代理的上次完成的作业请求。

none

string

没有其他属性。

IdentityRef

名称 类型 说明
_links

ReferenceLinks

此字段包含零个或多个有关图形主题的有趣链接。 可以调用这些链接来获取有关此图主题的其他关系或更详细的信息。

descriptor

string

描述符是在系统运行时引用图形主题的主要方法。 此字段将唯一标识帐户和组织中的同一图形主题。

directoryAlias

string

displayName

string

这是图形主题的非唯一显示名称。 若要更改此字段,必须在源提供程序中更改其值。

id

string

imageUrl

string

inactive

boolean

isAadIdentity

boolean

isContainer

boolean

isDeletedInOrigin

boolean

profileUrl

string

uniqueName

string

url

string

此 URL 是指向此图主题的源资源的完整路由。

JObject

名称 类型 说明
item

JToken

type

string

JToken

名称 类型 说明
first

JToken

hasValues

boolean

item

JToken

last

JToken

next

JToken

parent

string

path

string

previous

JToken

root

JToken

type

string

PackageVersion

名称 类型 说明
major

integer

minor

integer

patch

integer

PropertiesCollection

类将属性包表示为键值对的集合。 接受除 之外DBNull的所有基元类型的值 (具有TypeCode != TypeCode.Object) 的任何类型。 Byte[]、Int32、Double、DateType 和 String 类型的值保留其类型,其他基元将重新调整为 String。 Byte[] 应为 base64 编码字符串。

名称 类型 说明
count

integer

集合中的属性计数。

item

object

keys

string[]

集合中的键集。

values

string[]

集合中的值集。

表示 REST 引用链接集合的类。

名称 类型 说明
links

object

链接的只读视图。 由于引用链接是只读的,因此我们只想将其公开为只读。

TaskAgent

名称 类型 说明
_links

ReferenceLinks

表示 REST 引用链接集合的类。

accessPoint

string

获取代理的访问点。

assignedAgentCloudRequest

TaskAgentCloudRequest

获取当前与此代理关联的代理云请求

assignedRequest

TaskAgentJobRequest

获取当前分配给此代理的请求。

authorization

TaskAgentAuthorization

获取或设置此代理的授权信息。

createdOn

string

获取创建此代理的日期。

enabled

boolean

获取或设置一个值,该值指示是否应为作业执行启用此代理。

id

integer

获取代理的标识符。

lastCompletedRequest

TaskAgentJobRequest

获取此代理完成的最后一个请求。

maxParallelism

integer

获取或设置此主机上允许的最大作业并行度。

name

string

获取代理的名称。

oSDescription

string

获取代理的 OS。

pendingUpdate

TaskAgentUpdate

获取此代理的挂起更新。

properties

PropertiesCollection

类将属性包表示为键值对的集合。 接受除 之外DBNull的所有基元类型的值 (具有TypeCode != TypeCode.Object) 的任何类型。 Byte[]、Int32、Double、DateType 和 String 类型的值保留其类型,其他基元将重新调整为 String。 Byte[] 应为 base64 编码字符串。

provisioningState

string

获取或设置此代理的当前预配状态

status

TaskAgentStatus

获取代理的当前连接状态。

statusChangedOn

string

获取发生上次连接状态更改的日期。

systemCapabilities

object

userCapabilities

object

version

string

获取代理的版本。

TaskAgentAuthorization

提供使用 OAuth 2.0 身份验证流授权代理所需的数据。

名称 类型 说明
authorizationUrl

string

获取或设置用于从配置的令牌服务获取访问令牌的终结点。

clientId

string

获取或设置此代理的客户端标识符。

publicKey

TaskAgentPublicKey

获取或设置用于验证此代理的标识的公钥。

TaskAgentCloudRequest

名称 类型 说明
agent

TaskAgentReference

agentCloudId

integer

agentConnectedTime

string

agentData

JObject

agentSpecification

JObject

pool

TaskAgentPoolReference

provisionRequestTime

string

provisionedTime

string

releaseRequestTime

string

requestId

string

TaskAgentDelaySource

名称 类型 说明
delays

string[]

taskAgent

TaskAgentReference

TaskAgentJobRequest

名称 类型 说明
agentDelays

TaskAgentDelaySource[]

agentSpecification

JObject

assignTime

string

data

object

definition

TaskOrchestrationOwner

demands

Demand[]

expectedDuration

string

finishTime

string

hostId

string

jobId

string

jobName

string

lockedUntil

string

matchedAgents

TaskAgentReference[]

orchestrationId

string

owner

TaskOrchestrationOwner

planGroup

string

planId

string

planType

string

poolId

integer

queueId

integer

queueTime

string

receiveTime

string

requestId

integer

reservedAgent

TaskAgentReference

result

TaskResult

scopeId

string

serviceOwner

string

TaskAgentJobResultFilter

仅获取具有此最后一个作业结果的部署目标。

名称 类型 说明
all

string

所有部署目标。

failed

string

只有上次作业失败的部署目标 (放弃取消失败跳过) 。

neverDeployed

string

仅那些从未执行过作业的部署目标。

passed

string

仅针对其上一个作业通过 (成功成功且出现问题 的部署目标) 。

TaskAgentPoolReference

名称 类型 说明
id

integer

isHosted

boolean

获取或设置一个值,该值指示此池是否由服务管理。

name

string

poolType

TaskAgentPoolType

获取或设置池的类型

scope

string

size

integer

获取池的当前大小。

TaskAgentPoolType

获取或设置池的类型

名称 类型 说明
automation

string

deployment

string

TaskAgentPublicKey

表示 RSA 非对称密钥的公钥部分。

名称 类型 说明
exponent

string[]

获取或设置公钥的指数。

modulus

string[]

获取或设置公钥的取模。

TaskAgentReference

名称 类型 说明
_links

ReferenceLinks

表示 REST 引用链接集合的类。

accessPoint

string

获取代理的访问点。

enabled

boolean

获取或设置一个值,该值指示是否应为作业执行启用此代理。

id

integer

获取代理的标识符。

name

string

获取代理的名称。

oSDescription

string

获取代理的 OS。

provisioningState

string

获取或设置此代理的当前预配状态

status

TaskAgentStatus

获取代理的当前连接状态。

version

string

获取代理的版本。

TaskAgentStatus

获取代理的当前连接状态。

名称 类型 说明
offline

string

online

string

TaskAgentStatusFilter

仅获取具有此状态的部署目标。

名称 类型 说明
all

string

所有部署目标。

offline

string

仅脱机部署目标。

online

string

仅联机部署目标。

TaskAgentUpdate

名称 类型 说明
currentState

string

此代理更新的当前状态

reason

TaskAgentUpdateReason

此代理更新的原因

requestTime

string

获取请求此代理更新的日期。

requestedBy

IdentityRef

请求代理更新的标识

sourceVersion

PackageVersion

获取或设置代理更新的源代理版本

targetVersion

PackageVersion

获取或设置代理更新的目标代理版本

TaskAgentUpdateReason

名称 类型 说明
code

TaskAgentUpdateReasonType

TaskAgentUpdateReasonType

名称 类型 说明
manual

string

minAgentVersionRequired

string

TaskOrchestrationOwner

名称 类型 说明
_links

ReferenceLinks

表示 REST 引用链接集合的类。

id

integer

name

string

TaskResult

名称 类型 说明
abandoned

string

canceled

string

failed

string

skipped

string

succeeded

string

succeededWithIssues

string