检查 IoT Central 应用程序名称是否可用。
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability?api-version=2021-06-01
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
subscriptionId
|
path |
True
|
string
|
订阅标识符。
|
api-version
|
query |
True
|
string
|
API 的版本。
|
请求正文
名称 |
必需 |
类型 |
说明 |
name
|
True
|
string
|
要检查的 IoT Central 应用程序实例的名称。
|
type
|
|
string
|
要查询的 IoT Central 资源的类型。
|
响应
名称 |
类型 |
说明 |
200 OK
|
AppAvailabilityInfo
|
这是一个同步操作。 正文包含 JSON 序列化响应,该响应指定 IoT Central 应用程序名称是否可用。 如果该名称不可用,则正文包含原因。
|
Other Status Codes
|
CloudError
|
DefaultErrorResponse
|
安全性
azure_auth
Azure Active Directory OAuth2 流
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
Apps_CheckNameAvailability
示例请求
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.IoTCentral/checkNameAvailability?api-version=2021-06-01
{
"name": "myiotcentralapp",
"type": "IoTApps"
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.iotcentral.models.OperationInputs;
/** Samples for Apps CheckNameAvailability. */
public final class Main {
/*
* x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckNameAvailability.json
*/
/**
* Sample code: Apps_CheckNameAvailability.
*
* @param manager Entry point to IotCentralManager.
*/
public static void appsCheckNameAvailability(com.azure.resourcemanager.iotcentral.IotCentralManager manager) {
manager
.apps()
.checkNameAvailabilityWithResponse(
new OperationInputs().withName("myiotcentralapp").withType("IoTApps"), Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.iotcentral import IotCentralClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-iotcentral
# USAGE
python apps_check_name_availability.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = IotCentralClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.apps.check_name_availability(
operation_inputs={"name": "myiotcentralapp", "type": "IoTApps"},
)
print(response)
# x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckNameAvailability.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armiotcentral_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotcentral/armiotcentral"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckNameAvailability.json
func ExampleAppsClient_CheckNameAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armiotcentral.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAppsClient().CheckNameAvailability(ctx, armiotcentral.OperationInputs{
Name: to.Ptr("myiotcentralapp"),
Type: to.Ptr("IoTApps"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AppAvailabilityInfo = armiotcentral.AppAvailabilityInfo{
// NameAvailable: to.Ptr(true),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
示例响应
code: 200
{
"nameAvailable": true
}
{
"error": {
"code": "Error code",
"message": "Error message",
"target": "Error target"
}
}
定义
AppAvailabilityInfo
指示给定的 IoT Central 应用程序名称或子域是否可用的属性。
名称 |
类型 |
说明 |
message
|
string
|
详细原因消息。
|
nameAvailable
|
boolean
|
该值指示所提供的名称是否可用。
|
reason
|
string
|
不可用的原因。
|
CloudError
错误详细信息。
名称 |
类型 |
说明 |
error.code
|
string
|
错误代码。
|
error.details
|
CloudErrorBody[]
|
有关错误的其他详细信息的列表。
|
error.message
|
string
|
错误消息。
|
error.target
|
string
|
特定错误的目标。
|
CloudErrorBody
错误响应的详细信息。
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
details
|
CloudErrorBody[]
|
有关错误的其他详细信息的列表。
|
message
|
string
|
错误消息。
|
target
|
string
|
特定错误的目标。
|
输入值。
名称 |
类型 |
默认值 |
说明 |
name
|
string
|
|
要检查的 IoT Central 应用程序实例的名称。
|
type
|
string
|
IoTApps
|
要查询的 IoT Central 资源的类型。
|