指定された検索サービス名を使用できるかどうかを確認します。 Search Service名はサービス URI の一部であるため、グローバルに一意である必要があります (https://.search.windows.net).
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability?api-version=2023-11-01
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
subscriptionId
|
path |
True
|
string
|
Microsoft Azure サブスクリプションの一意識別子。 この値は、Azure Resource Manager API、コマンド ライン ツール、またはポータルから取得できます。
|
api-version
|
query |
True
|
string
|
要求ごとに使用する API バージョン。
|
名前 |
必須 |
型 |
説明 |
x-ms-client-request-id
|
|
string
uuid
|
クライアントが生成した、この要求を識別する GUID 値。 指定した場合、これは要求を追跡する方法として応答情報に含まれます。
|
要求本文
名前 |
必須 |
型 |
説明 |
name
|
True
|
string
|
検証する検索サービス名。 Search Service名には小文字、数字、ダッシュのみを含める必要があり、最初の 2 文字または最後の 1 文字としてダッシュを使用することはできません。連続するダッシュを含めることはできません。また、長さは 2 ~ 60 文字にする必要があります。
|
type
|
True
|
ResourceType
|
名前を検証するリソースの種類。 この値は常に 'searchServices' である必要があります。
|
応答
名前 |
型 |
説明 |
200 OK
|
CheckNameAvailabilityOutput
|
名前チェック完了です。 応答には、名前が有効で使用可能かどうかの詳細が含まれます。 名前が無効な場合、応答には、その理由を説明するメッセージも含まれます。
|
Other Status Codes
|
CloudError
|
HTTP 400 (無効な要求): 指定されたリソースの種類が 'searchServices' ではありません。
|
セキュリティ
azure_auth
OAuth2 承認フローをMicrosoft Entra IDします。
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
名前 |
説明 |
user_impersonation
|
ユーザー アカウントの借用
|
例
SearchCheckNameAvailability
要求のサンプル
POST https://management.azure.com/subscriptions/subid/providers/Microsoft.Search/checkNameAvailability?api-version=2023-11-01
{
"name": "mysearchservice",
"type": "searchServices"
}
import com.azure.resourcemanager.search.models.CheckNameAvailabilityInput;
/**
* Samples for Services CheckNameAvailability.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCheckNameAvailability.
* json
*/
/**
* Sample code: SearchCheckNameAvailability.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCheckNameAvailability(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().checkNameAvailabilityWithResponse(
new CheckNameAvailabilityInput().withName("mysearchservice"), null, com.azure.core.util.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
package armsearch_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/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCheckNameAvailability.json
func ExampleServicesClient_CheckNameAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().CheckNameAvailability(ctx, armsearch.CheckNameAvailabilityInput{
Name: to.Ptr("mysearchservice"),
Type: to.Ptr("searchServices"),
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.CheckNameAvailabilityOutput = armsearch.CheckNameAvailabilityOutput{
// Message: to.Ptr(""),
// IsNameAvailable: to.Ptr(false),
// Reason: to.Ptr(armsearch.UnavailableNameReasonAlreadyExists),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net).
*
* @summary Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net).
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCheckNameAvailability.json
*/
async function searchCheckNameAvailability() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const name = "mysearchservice";
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.checkNameAvailability(name);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCheckNameAvailability.json
// this example is just showing the usage of "Services_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "subid";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// invoke the operation
SearchServiceNameAvailabilityContent content = new SearchServiceNameAvailabilityContent("mysearchservice");
SearchServiceNameAvailabilityResult result = await subscriptionResource.CheckSearchServiceNameAvailabilityAsync(content);
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"nameAvailable": false,
"reason": "AlreadyExists",
"message": ""
}
定義
名前可用性 API チェック入力します。
名前 |
型 |
説明 |
name
|
string
|
検証する検索サービス名。 Search Service名には小文字、数字、ダッシュのみを含める必要があり、最初の 2 文字または最後の 1 文字としてダッシュを使用することはできません。連続するダッシュを含めることはできません。また、長さは 2 ~ 60 文字にする必要があります。
|
type
|
ResourceType
|
名前を検証するリソースの種類。 この値は常に 'searchServices' である必要があります。
|
CheckNameAvailabilityOutput
名前可用性 API の出力チェック。
名前 |
型 |
説明 |
message
|
string
|
名前が無効であり、リソースの名前付け要件を提供する理由を説明するメッセージ。 'Invalid' が 'reason' プロパティで返された場合にのみ使用できます。
|
nameAvailable
|
boolean
|
名前を使用できるかどうかを示す値。
|
reason
|
UnavailableNameReason
|
名前が使用できない理由。 'Invalid' は、指定された名前が名前付け要件 (正しくない長さ、サポートされていない文字など) と一致しないことを示します。 'AlreadyExists' は、名前が既に使用されているため使用できないことを示します。
|
CloudError
API エラーに関する情報が含まれています。
CloudErrorBody
エラー コードとメッセージを含む特定の API エラーについて説明します。
名前 |
型 |
説明 |
code
|
string
|
エラー状態を HTTP 状態コードよりも正確に記述するエラー コード。 特定のエラー ケースをプログラムで処理するために使用できます。
|
details
|
CloudErrorBody[]
|
このエラーに関連する入れ子になったエラーが含まれています。
|
message
|
string
|
エラーの詳細を説明し、デバッグ情報を提供するメッセージ。
|
target
|
string
|
特定のエラーのターゲット (たとえば、エラーのプロパティの名前)。
|
ResourceType
名前を検証するリソースの種類。 この値は常に 'searchServices' である必要があります。
名前 |
型 |
説明 |
searchServices
|
string
|
'searchServices' は、名前を検証できる唯一のリソースの種類です。
|
UnavailableNameReason
名前が使用できない理由。 'Invalid' は、指定された名前が名前付け要件 (正しくない長さ、サポートされていない文字など) と一致しないことを示します。 'AlreadyExists' は、名前が既に使用されているため使用できないことを示します。
名前 |
型 |
説明 |
AlreadyExists
|
string
|
検索サービス名は、別の検索サービスに既に割り当てられます。
|
Invalid
|
string
|
検索サービス名が名前付け要件と一致しません。
|