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

Assets - Update

更新资产

PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}?api-version=2024-11-01

URI 参数

名称 必需 类型 说明
assetName
path True

string

minLength: 3
maxLength: 63
pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$

资产名称参数。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 名称不区分大小写。

subscriptionId
path True

string (uuid)

目标订阅的 ID。 该值必须是 UUID。

api-version
query True

string

minLength: 1

用于此操作的 API 版本。

请求正文

名称 类型 说明
properties.attributes

一组键值对,其中包含客户设置的自定义属性。

properties.datasets

Dataset[]

属于资产的数据集数组。 每个数据集描述构成集的数据点。

properties.defaultDatasetsConfiguration

string

包含所有数据集的特定于连接器的默认配置的字符串化 JSON。 每个数据集可以有自己的配置来替代此处的默认设置。

properties.defaultEventsConfiguration

string

包含所有事件特定于连接器的默认配置的字符串化 JSON。 每个事件都可以有自己的配置来替代此处的默认设置。

properties.defaultTopic

TopicUpdate

描述资产的默认主题信息的对象。

properties.description

string

资产的可读说明。

properties.displayName

string

人工可读的显示名称。

properties.documentationUri

string

对文档的引用。

properties.enabled

boolean

资产的启用/禁用状态。

properties.events

Event[]

属于资产的事件数组。 每个事件可以具有每个事件配置。

properties.hardwareRevision

string

硬件的修订号。

properties.manufacturer

string

资产制造商名称。

properties.manufacturerUri

string

资产制造商 URI。

properties.model

string

资产模型名称。

properties.productCode

string

资产错误代码。

properties.serialNumber

string

资产序列号。

properties.softwareRevision

string

软件的修订号。

tags

object

资源标记。

响应

名称 类型 说明
200 OK

Asset

Azure 操作已成功完成。

202 Accepted

接受资源更新请求。

标头

  • Location: string
  • Retry-After: integer
Other Status Codes

ErrorResponse

意外的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

Update_Asset

示例请求

PATCH https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset?api-version=2024-11-01

{
  "properties": {
    "enabled": false,
    "displayName": "NewAssetDisplayName"
  }
}

示例响应

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset",
  "name": "my-asset",
  "type": "Microsoft.DeviceRegistry/assets",
  "location": "West Europe",
  "extendedLocation": {
    "type": "CustomLocation",
    "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"
  },
  "tags": {
    "site": "building-1"
  },
  "systemData": {
    "createdBy": "2ta23112-4596-44ff-b773-19405922bfc1",
    "createdByType": "Application",
    "createdAt": "2022-11-16T00:36:43.2516899Z",
    "lastModifiedBy": "2ta23112-4596-44ff-b773-19405922bfc1",
    "lastModifiedByType": "Application",
    "lastModifiedAt": "2022-11-16T01:37:16.0922793Z"
  },
  "properties": {
    "uuid": "0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d",
    "enabled": true,
    "externalAssetId": "8ZBA6LRHU0A458969",
    "displayName": "NewAssetDisplayName",
    "description": "This is a sample Asset",
    "assetEndpointProfileRef": "myAssetEndpointProfile",
    "version": 73766,
    "manufacturer": "Contoso",
    "manufacturerUri": "https://www.contoso.com/manufacturerUri",
    "model": "ContosoModel",
    "productCode": "SA34VDG",
    "hardwareRevision": "1.0",
    "softwareRevision": "2.0",
    "documentationUri": "https://www.example.com/manual",
    "serialNumber": "64-103816-519918-8",
    "defaultDatasetsConfiguration": "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}",
    "defaultEventsConfiguration": "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}",
    "defaultTopic": {
      "path": "/path/defaultTopic",
      "retain": "Keep"
    },
    "datasets": [
      {
        "name": "dataset1",
        "datasetConfiguration": "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}",
        "topic": {
          "path": "/path/dataset1",
          "retain": "Keep"
        },
        "dataPoints": [
          {
            "name": "dataPoint1",
            "dataSource": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
            "observabilityMode": "Counter",
            "dataPointConfiguration": "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"
          },
          {
            "name": "dataPoint2",
            "dataSource": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
            "observabilityMode": "None",
            "dataPointConfiguration": "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"
          }
        ]
      }
    ],
    "events": [
      {
        "name": "event1",
        "eventNotifier": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
        "observabilityMode": "None",
        "eventConfiguration": "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}",
        "topic": {
          "path": "/path/event1",
          "retain": "Keep"
        }
      },
      {
        "name": "event2",
        "eventNotifier": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
        "observabilityMode": "Log",
        "eventConfiguration": "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"
      }
    ],
    "provisioningState": "Succeeded"
  }
}
Location: https://contoso.com/operationstatus

定义

名称 说明
Asset

资产定义。

AssetStatus

定义资产状态属性。

AssetStatusDataset

定义资产状态数据集属性。

AssetStatusError

定义资产状态错误属性。

AssetStatusEvent

定义资产状态事件属性。

AssetUpdate

用于资产更新操作的类型。

createdByType

创建资源的标识的类型。

DataPoint

定义数据点属性。

DataPointObservabilityMode

指示如何将数据点映射到 OpenTelemetry。

Dataset

定义数据集属性。

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

Event

定义事件属性。

EventObservabilityMode

指示事件应如何映射到 OpenTelemetry。

ExtendedLocation

扩展位置。

MessageSchemaReference

定义消息架构引用属性。

ProvisioningState

资源的预配状态。

systemData

与创建和上次修改资源相关的元数据。

Topic

描述主题信息的对象。

TopicRetainType

设置为“Keep”时,发布到 MQTT 代理的消息将设置保留标志。 默认值:“永不”。

TopicUpdate

描述主题信息的对象。

Asset

资产定义。

名称 类型 说明
extendedLocation

ExtendedLocation

扩展位置。

id

string (arm-id)

资源的完全限定资源 ID。 例如“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}”

location

string

资源所在的地理位置

name

string

资源的名称

properties.assetEndpointProfileRef

string

对中转站用来连接到提供此资产数据点的终结点的终结点配置文件(连接信息)的引用。 必须提供资产终结点配置文件名称。

properties.attributes

一组键值对,其中包含客户设置的自定义属性。

properties.datasets

Dataset[]

属于资产的数据集数组。 每个数据集描述构成集的数据点。

properties.defaultDatasetsConfiguration

string

包含所有数据集的特定于连接器的默认配置的字符串化 JSON。 每个数据集可以有自己的配置来替代此处的默认设置。

properties.defaultEventsConfiguration

string

包含所有事件特定于连接器的默认配置的字符串化 JSON。 每个事件都可以有自己的配置来替代此处的默认设置。

properties.defaultTopic

Topic

描述资产的默认主题信息的对象。

properties.description

string

资产的可读说明。

properties.discoveredAssetRefs

string[]

对已发现资产列表的引用。 仅当资产是从发现流创建的时才填充的。 必须提供发现的资产名称。

properties.displayName

string

人工可读的显示名称。

properties.documentationUri

string

对文档的引用。

properties.enabled

boolean

资产的启用/禁用状态。

properties.events

Event[]

属于资产的事件数组。 每个事件可以具有每个事件配置。

properties.externalAssetId

string

客户提供的资产 ID。

properties.hardwareRevision

string

硬件的修订号。

properties.manufacturer

string

资产制造商名称。

properties.manufacturerUri

string

资产制造商 URI。

properties.model

string

资产模型名称。

properties.productCode

string

资产错误代码。

properties.provisioningState

ProvisioningState

资源的预配状态。

properties.serialNumber

string

资产序列号。

properties.softwareRevision

string

软件的修订号。

properties.status

AssetStatus

只读对象以反映 Edge 上发生的更改。 类似于自定义资源的 Kubernetes 状态属性。

properties.uuid

string

全局唯一、不可变、不可重用的 ID。

properties.version

integer (int64)

每次修改资源时递增的整数。

systemData

systemData

包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。

tags

object

资源标记。

type

string

资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

AssetStatus

定义资产状态属性。

名称 类型 说明
datasets

AssetStatusDataset[]

描述每个数据集状态的数据集状态数组。

errors

AssetStatusError[]

要传输和保留源自 Edge 的错误的数组对象。

events

AssetStatusEvent[]

描述每个事件状态的事件状态数组。

version

integer (int64)

只读增量计数器,指示从资产的当前实际(Edge)状态的角度修改配置次数。 Edge 将是此值的唯一编写器,并将同步备份到云。 在稳定状态下,这应等于版本。

AssetStatusDataset

定义资产状态数据集属性。

名称 类型 说明
messageSchemaReference

MessageSchemaReference

消息架构引用对象。

name

string

数据集的名称。 在 status.datasets 数组中必须是唯一的。 此名称用于关联规范和状态数据集信息。

AssetStatusError

定义资产状态错误属性。

名称 类型 说明
code

integer (int32)

错误分类的错误代码(例如:400、404、500 等)。

message

string

人为可读有用的错误消息,为错误提供其他上下文(例如:“功能 ID 'foo' 不存在”)。

AssetStatusEvent

定义资产状态事件属性。

名称 类型 说明
messageSchemaReference

MessageSchemaReference

消息架构引用对象。

name

string

事件的名称。 在 status.events 数组中必须是唯一的。 此名称用于关联规范和状态事件信息。

AssetUpdate

用于资产更新操作的类型。

名称 类型 说明
properties.attributes

一组键值对,其中包含客户设置的自定义属性。

properties.datasets

Dataset[]

属于资产的数据集数组。 每个数据集描述构成集的数据点。

properties.defaultDatasetsConfiguration

string

包含所有数据集的特定于连接器的默认配置的字符串化 JSON。 每个数据集可以有自己的配置来替代此处的默认设置。

properties.defaultEventsConfiguration

string

包含所有事件特定于连接器的默认配置的字符串化 JSON。 每个事件都可以有自己的配置来替代此处的默认设置。

properties.defaultTopic

TopicUpdate

描述资产的默认主题信息的对象。

properties.description

string

资产的可读说明。

properties.displayName

string

人工可读的显示名称。

properties.documentationUri

string

对文档的引用。

properties.enabled

boolean

资产的启用/禁用状态。

properties.events

Event[]

属于资产的事件数组。 每个事件可以具有每个事件配置。

properties.hardwareRevision

string

硬件的修订号。

properties.manufacturer

string

资产制造商名称。

properties.manufacturerUri

string

资产制造商 URI。

properties.model

string

资产模型名称。

properties.productCode

string

资产错误代码。

properties.serialNumber

string

资产序列号。

properties.softwareRevision

string

软件的修订号。

tags

object

资源标记。

createdByType

创建资源的标识的类型。

说明
Application
Key
ManagedIdentity
User

DataPoint

定义数据点属性。

名称 类型 默认值 说明
dataPointConfiguration

string

包含数据点特定连接器配置的字符串化 JSON。 对于 OPC UA,这可能包括配置,例如 publishingInterval、samplingInterval 和 queueSize。

dataSource

string

资产(例如 URL)中数据源的地址,以便客户端可以访问资产上的数据源。

name

string

数据点的名称。

observabilityMode

DataPointObservabilityMode

None

指示如何将数据点映射到 OpenTelemetry。

DataPointObservabilityMode

指示如何将数据点映射到 OpenTelemetry。

说明
Counter

映射到 OpenTelemetry 的计数器。

Gauge

将仪表映射到 OpenTelemetry。

Histogram

将直方图映射到 OpenTelemetry。

Log

以日志的形式映射到 OpenTelemetry。

None

不映射到 OpenTelemetry。

Dataset

定义数据集属性。

名称 类型 说明
dataPoints

DataPoint[]

属于数据集的数据点数组。 每个数据点可以具有每个数据点配置。

datasetConfiguration

string

字符串化 JSON,其中包含特定于连接器的 JSON 字符串,用于描述特定数据集的配置。

name

string

数据集的名称。

topic

Topic

描述特定数据集的主题信息的对象。

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

Event

定义事件属性。

名称 类型 默认值 说明
eventConfiguration

string

包含事件特定于连接器配置的字符串化 JSON。 对于 OPC UA,这可能包括配置,例如 publishingInterval、samplingInterval 和 queueSize。

eventNotifier

string

资产中事件通知器的地址(例如 URL),以便客户端可以访问资产上的事件。

name

string

事件的名称。

observabilityMode

EventObservabilityMode

None

指示事件应如何映射到 OpenTelemetry。

topic

Topic

描述特定事件的主题信息的对象。

EventObservabilityMode

指示事件应如何映射到 OpenTelemetry。

说明
Log

以日志的形式映射到 OpenTelemetry。

None

不映射到 OpenTelemetry。

ExtendedLocation

扩展位置。

名称 类型 说明
name

string

扩展位置名称。

type

string

扩展位置类型。

MessageSchemaReference

定义消息架构引用属性。

名称 类型 说明
schemaName

string

消息架构名称。

schemaRegistryNamespace

string

消息架构注册表命名空间。

schemaVersion

string

消息架构版本。

ProvisioningState

资源的预配状态。

说明
Accepted

服务器已接受资源。

Canceled

资源创建已取消。

Deleting

正在删除资源。

Failed

资源创建失败。

Succeeded

已创建资源。

systemData

与创建和上次修改资源相关的元数据。

名称 类型 说明
createdAt

string (date-time)

资源创建时间戳(UTC)。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识的类型。

lastModifiedAt

string (date-time)

上次修改的资源时间戳(UTC)

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识的类型。

Topic

描述主题信息的对象。

名称 类型 默认值 说明
path

string

发布到 MQTT 代理的消息的主题路径。

retain

TopicRetainType

Never

设置为“Keep”时,发布到 MQTT 代理的消息将设置保留标志。 默认值:“永不”。

TopicRetainType

设置为“Keep”时,发布到 MQTT 代理的消息将设置保留标志。 默认值:“永不”。

说明
Keep

保留消息。

Never

永远不要保留消息。

TopicUpdate

描述主题信息的对象。

名称 类型 默认值 说明
path

string

发布到 MQTT 代理的消息的主题路径。

retain

TopicRetainType

Never

设置为“Keep”时,发布到 MQTT 代理的消息将设置保留标志。 默认值:“永不”。