你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Artifact Sources - Create Or Update

创建或替换现有项目源。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}?api-version=2018-09-15

URI 参数

名称 必需 类型 说明
labName
path True

string

实验室的名称。

name
path True

string

项目源的名称。

resourceGroupName
path True

string

资源组的名称。

subscriptionId
path True

string

订阅的 ID。

api-version
query True

string

客户端 API 版本。

请求正文

名称 类型 说明
location

string

资源的位置。

properties.armTemplateFolderPath

string

包含 Azure 资源管理器模板的文件夹。

properties.branchRef

string

项目源的分支引用。

properties.displayName

string

项目源的显示名称。

properties.folderPath

string

包含项目的文件夹。

properties.securityToken

string

要向项目源进行身份验证的安全令牌。

properties.sourceType

SourceControlType

项目源的类型。

properties.status

EnableStatus

指示是否启用项目源 (值:Enabled、Disabled) 。

properties.uri

string

项目源的 URI。

tags

object

资源的标记。

响应

名称 类型 说明
200 OK

ArtifactSource

确定

201 Created

ArtifactSource

创建

Other Status Codes

CloudError

BadRequest

安全性

azure_auth

OAuth2 隐式授权

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名称 说明
user_impersonation 访问 Microsoft Azure

示例

ArtifactSources_CreateOrUpdate

Sample Request

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}?api-version=2018-09-15

{
  "properties": {
    "displayName": "{displayName}",
    "uri": "{artifactSourceUri}",
    "sourceType": "{VsoGit|GitHub|StorageAccount}",
    "folderPath": "{folderPath}",
    "armTemplateFolderPath": "{armTemplateFolderPath}",
    "branchRef": "{branchRef}",
    "securityToken": "{securityToken}",
    "status": "{Enabled|Disabled}"
  },
  "tags": {
    "tagName1": "tagValue1"
  }
}

Sample Response

{
  "properties": {
    "displayName": "{displayName}",
    "uri": "{artifactSourceUri}",
    "sourceType": "{VsoGit|GitHub|StorageAccount}",
    "folderPath": "{folderPath}",
    "armTemplateFolderPath": "{armTemplateFolderPath}",
    "branchRef": "{branchRef}",
    "securityToken": "{securityToken}",
    "status": "{Enabled|Disabled}",
    "createdDate": "2020-12-16T16:53:02.4830866-07:00",
    "provisioningState": "Succeeded",
    "uniqueIdentifier": "{uniqueIdentifier}"
  },
  "id": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}",
  "name": "{artifactSourceName}",
  "type": "Microsoft.DevTestLab/labs/artifactsources",
  "location": "{location}",
  "tags": {
    "tagName1": "tagValue1"
  }
}
{
  "properties": {
    "displayName": "{displayName}",
    "uri": "{artifactSourceUri}",
    "sourceType": "{VsoGit|GitHub|StorageAccount}",
    "folderPath": "{folderPath}",
    "armTemplateFolderPath": "{armTemplateFolderPath}",
    "branchRef": "{branchRef}",
    "securityToken": "{securityToken}",
    "status": "{Enabled|Disabled}",
    "createdDate": "2020-12-16T16:53:02.4830866-07:00",
    "provisioningState": "Created",
    "uniqueIdentifier": "{uniqueIdentifier}"
  },
  "id": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}",
  "name": "{artifactSourceName}",
  "type": "Microsoft.DevTestLab/labs/artifactsources",
  "location": "{location}",
  "tags": {
    "tagName1": "tagValue1"
  }
}

定义

名称 说明
ArtifactSource

项目源的属性。

CloudError

REST 请求出错。

CloudErrorBody

REST 请求的错误正文。

EnableStatus

计划的状态 (,即“已启用”、“已禁用”)

SourceControlType

项目源的类型。

ArtifactSource

项目源的属性。

名称 类型 说明
id

string

资源的标识符。

location

string

资源的位置。

name

string

资源的名称。

properties.armTemplateFolderPath

string

包含 Azure 资源管理器模板的文件夹。

properties.branchRef

string

项目源的分支引用。

properties.createdDate

string

项目源的创建日期。

properties.displayName

string

项目源的显示名称。

properties.folderPath

string

包含项目的文件夹。

properties.provisioningState

string

资源的预配状态。

properties.securityToken

string

要向项目源进行身份验证的安全令牌。

properties.sourceType

SourceControlType

项目源的类型。

properties.status

EnableStatus

指示是否启用项目源 (值:Enabled、Disabled) 。

properties.uniqueIdentifier

string

资源的唯一不可变标识符 (Guid) 。

properties.uri

string

项目源的 URI。

tags

object

资源的标记。

type

string

资源类型。

CloudError

REST 请求出错。

名称 类型 说明
error

CloudErrorBody

发生的云错误

CloudErrorBody

REST 请求的错误正文。

名称 类型 说明
code

string

错误代码。

details

CloudErrorBody[]

内部错误。

message

string

错误消息。

target

string

错误目标。

EnableStatus

计划的状态 (,即“已启用”、“已禁用”)

名称 类型 说明
Disabled

string

Enabled

string

SourceControlType

项目源的类型。

名称 类型 说明
GitHub

string

StorageAccount

string

VsoGit

string