Clients - Create Or Update
使用指定的参数创建或更新客户端。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName}?api-version=2025-02-15
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
client
|
path | True |
string minLength: 1maxLength: 128 pattern: ^[-a-zA-Z0-9:\._]*$ |
客户端名称。 |
namespace
|
path | True |
string minLength: 3maxLength: 50 pattern: ^[a-zA-Z0-9-]*$ |
命名空间的名称。 |
resource
|
path | True |
string |
用户订阅中的资源组的名称。 |
subscription
|
path | True |
string |
唯一标识Microsoft Azure 订阅的订阅凭据。 订阅 ID 构成了每个服务调用的 URI 的一部分。 |
api-version
|
query | True |
string |
要用于客户端请求的 API 的版本。 |
请求正文
名称 | 类型 | 说明 |
---|---|---|
properties.attributes |
客户端的属性。 支持的值为 int、bool、string、string[]。 示例:“attributes”: { “room”: “345”, “floor”: 12, “deviceTypes”: [“Fan”, “Light”] } |
|
properties.authenticationName |
string |
客户端提供用于身份验证的名称。 默认值为资源的名称。 |
properties.clientCertificateAuthentication |
客户端证书身份验证信息。 |
|
properties.description |
string |
客户端资源的说明。 |
properties.state |
指示客户端是否处于启用状态。 默认值为“已启用”。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
创建或更新请求成功。 |
|
201 Created |
创建 |
|
Other Status Codes |
如果请求失败,则返回错误响应。 |
示例
Clients_CreateOrUpdate
示例请求
PUT https://management.azure.com/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/clients/exampleClientName1?api-version=2025-02-15
{
"properties": {
"state": "Enabled",
"clientCertificateAuthentication": {
"validationScheme": "SubjectMatchesAuthenticationName"
},
"attributes": {
"room": "345",
"floor": 3,
"deviceTypes": [
"Fan",
"Light",
"AC"
]
},
"description": "This is a test client"
}
}
示例响应
{
"properties": {
"clientCertificateAuthentication": {
"validationScheme": "SubjectMatchesAuthenticationName"
},
"state": "Enabled",
"attributes": {
"room": "345a",
"floor": 3,
"deviceTypes": [
"Light",
"1"
]
},
"provisioningState": "Succeeded",
"description": "This is a test client"
},
"id": "/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/clients/exampleClientName1",
"name": "exampleClientName1",
"type": "Microsoft.EventGrid/namespaces/clients"
}
{
"properties": {
"clientCertificateAuthentication": {
"validationScheme": "SubjectMatchesAuthenticationName"
},
"state": "Enabled",
"attributes": {
"room": "345a",
"floor": 3,
"deviceTypes": [
"Light",
"1"
]
},
"provisioningState": "Succeeded",
"description": "This is a test client"
},
"id": "/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/clients/exampleClientName1",
"name": "exampleClientName1",
"type": "Microsoft.EventGrid/namespaces/clients"
}
定义
名称 | 说明 |
---|---|
Client |
客户端资源。 |
Client |
客户端的证书身份验证属性。 |
Client |
用于对客户端进行身份验证的验证方案。 默认值为 SubjectMatchesAuthenticationName。 |
Client |
客户端资源的预配状态。 |
Client |
指示客户端是否处于启用状态。 默认值为“已启用”。 |
created |
创建资源的标识的类型。 |
Error |
资源管理错误附加信息。 |
Error |
错误详细信息。 |
Error |
错误响应 |
system |
与创建和上次修改资源相关的元数据。 |
Client
客户端资源。
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
id |
string |
资源的完全限定标识符。 |
|
name |
string |
资源的名称。 |
|
properties.attributes |
客户端的属性。 支持的值为 int、bool、string、string[]。 示例:“attributes”: { “room”: “345”, “floor”: 12, “deviceTypes”: [“Fan”, “Light”] } |
||
properties.authenticationName |
string |
客户端提供用于身份验证的名称。 默认值为资源的名称。 |
|
properties.clientCertificateAuthentication |
客户端证书身份验证信息。 |
||
properties.description |
string |
客户端资源的说明。 |
|
properties.provisioningState |
客户端资源的预配状态。 |
||
properties.state | Enabled |
指示客户端是否处于启用状态。 默认值为“已启用”。 |
|
systemData |
与事件网格资源相关的系统元数据。 |
||
type |
string |
资源的类型。 |
ClientCertificateAuthentication
客户端的证书身份验证属性。
名称 | 类型 | 说明 |
---|---|---|
allowedThumbprints |
string[] |
客户端身份验证期间允许的指纹列表。 仅当 validationScheme 为“ThumbprintMatch”时,才需要此属性。 |
validationScheme |
用于对客户端进行身份验证的验证方案。 默认值为 SubjectMatchesAuthenticationName。 |
ClientCertificateValidationScheme
用于对客户端进行身份验证的验证方案。 默认值为 SubjectMatchesAuthenticationName。
值 | 说明 |
---|---|
DnsMatchesAuthenticationName | |
EmailMatchesAuthenticationName | |
IpMatchesAuthenticationName | |
SubjectMatchesAuthenticationName | |
ThumbprintMatch | |
UriMatchesAuthenticationName |
ClientProvisioningState
客户端资源的预配状态。
值 | 说明 |
---|---|
Canceled | |
Creating | |
Deleted | |
Deleting | |
Failed | |
Succeeded | |
Updating |
ClientState
指示客户端是否处于启用状态。 默认值为“已启用”。
值 | 说明 |
---|---|
Disabled | |
Enabled |
createdByType
创建资源的标识的类型。
值 | 说明 |
---|---|
Application | |
Key | |
ManagedIdentity | |
User |
ErrorAdditionalInfo
资源管理错误附加信息。
名称 | 类型 | 说明 |
---|---|---|
info |
object |
其他信息。 |
type |
string |
其他信息类型。 |
ErrorDetail
错误详细信息。
名称 | 类型 | 说明 |
---|---|---|
additionalInfo |
错误附加信息。 |
|
code |
string |
错误代码。 |
details |
错误详细信息。 |
|
message |
string |
错误消息。 |
target |
string |
错误目标。 |
ErrorResponse
错误响应
名称 | 类型 | 说明 |
---|---|---|
error |
错误对象。 |
systemData
与创建和上次修改资源相关的元数据。
名称 | 类型 | 说明 |
---|---|---|
createdAt |
string (date-time) |
资源创建时间戳(UTC)。 |
createdBy |
string |
创建资源的标识。 |
createdByType |
创建资源的标识的类型。 |
|
lastModifiedAt |
string (date-time) |
上次修改的资源时间戳(UTC) |
lastModifiedBy |
string |
上次修改资源的标识。 |
lastModifiedByType |
上次修改资源的标识的类型。 |