共用方式為


Configurations - Update

依識別碼更新原則組態。

PUT https://dev.azure.com/{organization}/{project}/_apis/policy/configurations/{configurationId}?api-version=7.1-preview.1

URI 參數

名稱 位於 必要 類型 Description
configurationId
path True

integer

int32

要更新之現有原則組態的識別碼。

organization
path True

string

Azure DevOps 組織的名稱。

project
path True

string

專案識別碼或專案名稱

api-version
query True

string

要使用的 API 版本。 這應該設定為 '7.1-preview.1' 以使用此版本的 API。

要求本文

名稱 類型 Description
_links

ReferenceLinks

與這個物件相關的其他物件連結。

createdBy

IdentityRef

建立原則之身分識別的參考。

createdDate

string

建立原則的日期和時間。

id

integer

原則設定識別碼。

isBlocking

boolean

指出原則是否封鎖。

isDeleted

boolean

指出原則是否已 (虛刪除) 。

isEnabled

boolean

指出是否啟用原則。

isEnterpriseManaged

boolean

如果設定,此原則需要「管理企業原則」許可權,才能建立、編輯或刪除。

revision

integer

原則設定修訂識別碼。

settings

JObject

原則組態設定。

type

PolicyTypeRef

原則組態類型。

url

string

可擷取原則設定的 URL。

回應

名稱 類型 Description
200 OK

PolicyConfiguration

成功的作業

安全性

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

名稱 Description
vso.code_write 授與讀取、更新和刪除原始程式碼、存取認可、變更集、分支和其他版本控制成品的中繼資料的能力。 也授與建立和管理提取要求和程式碼檢閱的能力,以及透過服務勾點接收有關版本控制事件的通知。

範例

Sample Request

PUT https://dev.azure.com/fabrikam/fabrikam-fiber-git/_apis/policy/configurations/17?api-version=7.1-preview.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"
      }
    ]
  }
}

Sample Response

{
  "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"
  }
}

定義

名稱 Description
IdentityRef
JObject

表示 JSON 物件。

PolicyConfiguration

具有設定的完整原則組態。

PolicyTypeRef

原則類型參考。

ReferenceLinks

表示 REST 參考連結集合的類別。

IdentityRef

名稱 類型 Description
_links

ReferenceLinks

此欄位包含有關圖表主旨的零個或多個有趣連結。 您可以叫用這些連結來取得其他關聯性,或取得此圖表主體的詳細資訊。

descriptor

string

描述項是在系統執行時參考圖形主旨的主要方式。 此欄位可唯一識別帳戶和組織之間的相同圖表主旨。

directoryAlias

string

已淘汰 - 藉由查詢 IdentityRef 「_links」 字典之 「self」 專案中參考的 Graph 使用者,即可擷取

displayName

string

這是圖表主旨的非唯一顯示名稱。 若要變更此欄位,您必須在來源提供者中變更其值。

id

string

imageUrl

string

已淘汰 - 可在 IdentityRef 「_links」 字典的 「avatar」 專案中使用

inactive

boolean

已淘汰 - 您可以查詢 GraphUser 「_links」 字典的 「membershipState」 專案中參考的 Graph 成員資格狀態來擷取

isAadIdentity

boolean

已被取代 - 可以從描述元的主旨類型推斷 (Descriptor.IsAadUserType/Descriptor.IsAadGroupType)

isContainer

boolean

已被取代 - 可以從描述元的主旨類型推斷 (Descriptor.IsGroupType)

isDeletedInOrigin

boolean

profileUrl

string

已淘汰 - 不在 ToIdentityRef 的大多數既有實作中使用

uniqueName

string

已淘汰 - 請改用 Domain+PrincipalName

url

string

此 URL 是此圖表主體來源資源的完整路由。

JObject

表示 JSON 物件。

名稱 類型 Description
item

string

type

string

取得這個 JToken 的節點類型。

PolicyConfiguration

具有設定的完整原則組態。

名稱 類型 Description
_links

ReferenceLinks

與這個物件相關的其他物件連結。

createdBy

IdentityRef

建立原則之身分識別的參考。

createdDate

string

建立原則的日期和時間。

id

integer

原則設定識別碼。

isBlocking

boolean

指出原則是否封鎖。

isDeleted

boolean

指出原則是否已 (虛刪除) 。

isEnabled

boolean

指出是否啟用原則。

isEnterpriseManaged

boolean

如果設定,此原則需要「管理企業原則」許可權,才能建立、編輯或刪除。

revision

integer

原則設定修訂識別碼。

settings

JObject

原則組態設定。

type

PolicyTypeRef

原則組態類型。

url

string

可擷取原則設定的 URL。

PolicyTypeRef

原則類型參考。

名稱 類型 Description
displayName

string

原則類型的顯示名稱。

id

string

原則類型識別碼。

url

string

可擷取原則類型的 URL。

表示 REST 參考連結集合的類別。

名稱 類型 Description
links

object

連結的唯讀檢視。 因為參考連結是唯讀的,所以我們只想要將它們公開為唯讀。