Checks that the resource name is valid and is not already in use.
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability?api-version=2023-02-01
URI Parameters
Name |
In |
Required |
Type |
Description |
location
|
path |
True
|
string
|
the region
|
subscriptionId
|
path |
True
|
string
|
Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
|
api-version
|
query |
True
|
string
|
Client Api Version.
|
Request Body
Name |
Required |
Type |
Description |
name
|
True
|
string
|
The resource name to validate. e.g."my-resource-name"
|
type
|
True
|
string
|
The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub"
|
Responses
Name |
Type |
Description |
200 OK
|
NameAvailability
|
Success. The response describes the name availability.
|
Other Status Codes
|
ErrorResponse
|
Error response describing why the operation failed.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
WebPubSub_CheckNameAvailability
Sample Request
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SignalRService/locations/eastus/checkNameAvailability?api-version=2023-02-01
{
"type": "Microsoft.SignalRService/WebPubSub",
"name": "myWebPubSubService"
}
import com.azure.resourcemanager.webpubsub.models.NameAvailabilityParameters;
/** Samples for WebPubSub CheckNameAvailability. */
public final class Main {
/*
* x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_CheckNameAvailability.json
*/
/**
* Sample code: WebPubSub_CheckNameAvailability.
*
* @param manager Entry point to WebPubSubManager.
*/
public static void webPubSubCheckNameAvailability(com.azure.resourcemanager.webpubsub.WebPubSubManager manager) {
manager
.webPubSubs()
.checkNameAvailabilityWithResponse(
"eastus",
new NameAvailabilityParameters()
.withType("Microsoft.SignalRService/WebPubSub")
.withName("myWebPubSubService"),
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
from azure.identity import DefaultAzureCredential
from azure.mgmt.webpubsub import WebPubSubManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-webpubsub
# USAGE
python web_pub_sub_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 = WebPubSubManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.web_pub_sub.check_name_availability(
location="eastus",
parameters={"name": "myWebPubSubService", "type": "Microsoft.SignalRService/WebPubSub"},
)
print(response)
# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_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 armwebpubsub_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/webpubsub/armwebpubsub"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_CheckNameAvailability.json
func ExampleClient_CheckNameAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armwebpubsub.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewClient().CheckNameAvailability(ctx, "eastus", armwebpubsub.NameAvailabilityParameters{
Name: to.Ptr("myWebPubSubService"),
Type: to.Ptr("Microsoft.SignalRService/WebPubSub"),
}, 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.NameAvailability = armwebpubsub.NameAvailability{
// Message: to.Ptr("The name is already taken. Please try a different name."),
// NameAvailable: to.Ptr(false),
// Reason: to.Ptr("AlreadyExists"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WebPubSubManagementClient } = require("@azure/arm-webpubsub");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Checks that the resource name is valid and is not already in use.
*
* @summary Checks that the resource name is valid and is not already in use.
* x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_CheckNameAvailability.json
*/
async function webPubSubCheckNameAvailability() {
const subscriptionId =
process.env["WEB-PUBSUB_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const location = "eastus";
const parameters = {
name: "myWebPubSubService",
type: "Microsoft.SignalRService/WebPubSub",
};
const credential = new DefaultAzureCredential();
const client = new WebPubSubManagementClient(credential, subscriptionId);
const result = await client.webPubSub.checkNameAvailability(location, parameters);
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
Sample Response
{
"nameAvailable": false,
"reason": "AlreadyExists",
"message": "The name is already taken. Please try a different name."
}
Definitions
ErrorAdditionalInfo
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ErrorResponse
Error response
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
NameAvailability
Result of the request to check name availability. It contains a flag and possible reason of failure.
Name |
Type |
Description |
message
|
string
|
The message of the operation.
|
nameAvailable
|
boolean
|
Indicates whether the name is available or not.
|
reason
|
string
|
The reason of the availability. Required if name is not available.
|
NameAvailabilityParameters
Data POST-ed to the nameAvailability action
Name |
Type |
Description |
name
|
string
|
The resource name to validate. e.g."my-resource-name"
|
type
|
string
|
The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub"
|