Configurations - Update
按其 ID 更新策略配置。
PUT https://dev.azure.com/{organization}/{project}/_apis/policy/configurations/{configurationId}?api-version=7.1
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
configuration
|
path | True |
integer (int32) |
要更新的现有策略配置的 ID。 |
|
organization
|
path | True |
string |
Azure DevOps 组织的名称。 |
|
project
|
path | True |
string |
项目 ID 或项目名称 |
|
api-version
|
query | True |
string |
要使用的 API 版本。 这应设置为“7.1”才能使用此版本的 API。 |
请求正文
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
指向与此对象相关的其他对象的链接。 |
|
| createdBy |
对创建策略的标识的引用。 |
|
| createdDate |
string (date-time) |
创建策略的日期和时间。 |
| id |
integer (int32) |
策略配置 ID。 |
| isBlocking |
boolean |
指示策略是否正在阻止。 |
| isDeleted |
boolean |
指示策略是否已删除(软)。 |
| isEnabled |
boolean |
指示是否启用策略。 |
| isEnterpriseManaged |
boolean |
如果设置,此策略需要“管理企业策略”权限才能创建、编辑或删除。 |
| revision |
integer (int32) |
策略配置修订 ID。 |
| settings |
策略配置设置。 |
|
| type |
策略配置类型。 |
|
| url |
string |
可以检索策略配置的 URL。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
成功作 |
安全性
oauth2
类型:
oauth2
流向:
accessCode
授权 URL:
https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
令牌 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
作用域
| 名称 | 说明 |
|---|---|
| vso.code_write | 授予读取、更新和删除源代码、访问有关提交、更改集、分支和其他版本控制项目的元数据的能力。 此外,还授予创建和管理拉取请求和代码评审以及通过服务挂钩接收有关版本控制事件的通知的能力。 |
示例
示例请求
PUT https://dev.azure.com/fabrikam/fabrikam-fiber-git/_apis/policy/configurations/17?api-version=7.1
{
"isEnabled": true,
"isBlocking": true,
"type": {
"id": "fd2167ab-b0be-447a-8ec8-39368250530e"
},
"settings": {
"requiredReviewerIds": [
"1d1dad71-f27c-4370-810d-838ec41efd41",
"13272ea3-92ef-46d1-b77e-608ebbf3428b"
],
"filenamePatterns": [
"*/API*.cs",
"sql/tables/*"
],
"addedFilesOnly": false,
"scope": [
{
"repositoryId": null,
"refName": "refs/heads/master",
"matchKind": "exact"
},
{
"repositoryId": null,
"refName": "refs/heads/releases/",
"matchKind": "prefix"
},
{
"repositoryId": "49c1d4d0-be28-4f20-9e0a-4ecfafc39257",
"refName": "refs/heads/adventureworks",
"matchKind": "exact"
}
]
}
}
示例响应
{
"createdBy": {
"id": "d6245f20-2af8-44f4-9451-8107cb2767db",
"displayName": "Normal Paulk",
"uniqueName": "fabrikamfiber16@hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
},
"createdDate": "2015-02-23T12:51:06.85754Z",
"isEnabled": true,
"isBlocking": true,
"isDeleted": false,
"settings": {
"requiredReviewerIds": [
"1d1dad71-f27c-4370-810d-838ec41efd41",
"13272ea3-92ef-46d1-b77e-608ebbf3428b"
],
"filenamePatterns": [
"*/API*.cs",
"sql/tables/*"
],
"addedFilesOnly": false,
"message": null,
"scope": [
{
"refName": "refs/heads/master",
"matchKind": "Exact",
"repositoryId": null
},
{
"refName": "refs/heads/releases/",
"matchKind": "Prefix",
"repositoryId": null
},
{
"refName": "refs/heads/adventureworks",
"matchKind": "Exact",
"repositoryId": "49c1d4d0-be28-4f20-9e0a-4ecfafc39257"
}
]
},
"_links": {
"self": {
"href": "https://dev.azure.com/fabrikam/_apis/policy/configurations/17"
},
"type": {
"href": "https://dev.azure.com/fabrikam/1be3fc5b-c58c-4173-8fd7-6647d11eccd1/_apis/policy/types/fd2167ab-b0be-447a-8ec8-39368250530e"
}
},
"revision": 2,
"id": 17,
"url": "https://dev.azure.com/fabrikam/_apis/policy/configurations/17",
"type": {
"id": "fd2167ab-b0be-447a-8ec8-39368250530e",
"url": "https://dev.azure.com/fabrikam/1be3fc5b-c58c-4173-8fd7-6647d11eccd1/_apis/policy/types/fd2167ab-b0be-447a-8ec8-39368250530e",
"displayName": "Required reviewers"
}
}
定义
| 名称 | 说明 |
|---|---|
|
Identity |
|
| JObject |
表示 JSON 对象。 |
|
Policy |
包含设置的完整策略配置。 |
|
Policy |
策略类型引用。 |
|
Reference |
表示 REST 引用链接集合的类。 |
IdentityRef
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
此字段包含有关图形主题的零个或多个有趣的链接。 可以调用这些链接以获取有关此图形主题的其他关系或更详细的信息。 |
|
| descriptor |
string |
描述符是在系统运行时引用图形主题的主要方法。 此字段将唯一标识帐户和组织中的同一图形主题。 |
| directoryAlias |
string |
已弃用 - 可以通过查询 IdentityRef“_links”字典的“self”条目中引用的 Graph 用户来检索 |
| displayName |
string |
这是图形主题的非唯一显示名称。 若要更改此字段,必须在源提供程序中更改其值。 |
| id |
string |
|
| imageUrl |
string |
已弃用 - 在 IdentityRef“_links”字典的“虚拟形象”条目中可用 |
| inactive |
boolean |
已弃用 - 可以通过查询 GraphUser“_links”字典的“membershipState”条目中引用的 Graph 成员身份状态来检索 |
| isAadIdentity |
boolean |
已弃用 - 可以从描述符的主题类型推断(Descriptor.IsAadUserType/Descriptor.IsAadGroupType) |
| isContainer |
boolean |
已弃用 - 可以从描述符的主题类型推断(描述符.IsGroupType) |
| isDeletedInOrigin |
boolean |
|
| profileUrl |
string |
已弃用 - 不在 ToIdentityRef 的大多数预先存在的实现中使用 |
| uniqueName |
string |
已弃用 - 请改用 Domain+PrincipalName |
| url |
string |
此 URL 是指向此图形主题的源资源的完整路由。 |
JObject
表示 JSON 对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| item |
string (JToken) |
|
| type |
string (JTokenType) |
获取此 JToken 的节点类型。 |
PolicyConfiguration
包含设置的完整策略配置。
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
指向与此对象相关的其他对象的链接。 |
|
| createdBy |
对创建策略的标识的引用。 |
|
| createdDate |
string (date-time) |
创建策略的日期和时间。 |
| id |
integer (int32) |
策略配置 ID。 |
| isBlocking |
boolean |
指示策略是否正在阻止。 |
| isDeleted |
boolean |
指示策略是否已删除(软)。 |
| isEnabled |
boolean |
指示是否启用策略。 |
| isEnterpriseManaged |
boolean |
如果设置,此策略需要“管理企业策略”权限才能创建、编辑或删除。 |
| revision |
integer (int32) |
策略配置修订 ID。 |
| settings |
策略配置设置。 |
|
| type |
策略配置类型。 |
|
| url |
string |
可以检索策略配置的 URL。 |
PolicyTypeRef
策略类型引用。
| 名称 | 类型 | 说明 |
|---|---|---|
| displayName |
string |
策略类型的显示名称。 |
| id |
string (uuid) |
策略类型 ID。 |
| url |
string |
可以检索策略类型的 URL。 |
ReferenceLinks
表示 REST 引用链接集合的类。
| 名称 | 类型 | 说明 |
|---|---|---|
| links |
object |
链接的只读视图。 由于引用链接是只读的,因此我们只想将其公开为只读链接。 |