Verifique a disponibilidade do nome do namespace especificado.
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Relay/checkNameAvailability?api-version=2021-11-01
Parâmetros de URI
Nome |
Em |
Obrigatório |
Tipo |
Description |
subscriptionId
|
path |
True
|
string
|
Credenciais de assinatura que identificam exclusivamente a assinatura do Microsoft Azure. A ID da assinatura faz parte do URI para cada chamada de serviço.
|
api-version
|
query |
True
|
string
|
Versão de API do cliente.
|
Corpo da solicitação
Nome |
Tipo |
Description |
parameters
|
CheckNameAvailability
|
Parâmetros para marcar disponibilidade do nome do namespace especificado.
|
Respostas
Nome |
Tipo |
Description |
200 OK
|
CheckNameAvailabilityResult
|
Verifique a disponibilidade retornada com êxito.
|
Other Status Codes
|
ErrorResponse
|
Resposta de erro de retransmissão que descreve por que a operação falhou.
|
Segurança
azure_auth
Fluxo do OAuth2 do Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nome |
Description |
user_impersonation
|
representar sua conta de usuário
|
Exemplos
RelayCheckNameAvailability
Sample Request
POST https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.Relay/checkNameAvailability?api-version=2021-11-01
{
"name": "example-RelayNamespace1321"
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.relay import RelayAPI
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-relay
# USAGE
python relay_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 = RelayAPI(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.namespaces.check_name_availability(
parameters={"name": "example-RelayNamespace1321"},
)
print(response)
# x-ms-original-file: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/NameSpaces/RelayNameSpaceCheckNameAvailability.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 armrelay_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/relay/armrelay"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/NameSpaces/RelayNameSpaceCheckNameAvailability.json
func ExampleNamespacesClient_CheckNameAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armrelay.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewNamespacesClient().CheckNameAvailability(ctx, armrelay.CheckNameAvailability{
Name: to.Ptr("example-RelayNamespace1321"),
}, 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.CheckNameAvailabilityResult = armrelay.CheckNameAvailabilityResult{
// Message: to.Ptr(""),
// NameAvailable: to.Ptr(true),
// Reason: to.Ptr(armrelay.UnavailableReasonNone),
// }
}
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.Relay;
using Azure.ResourceManager.Relay.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/NameSpaces/RelayNameSpaceCheckNameAvailability.json
// this example is just showing the usage of "Namespaces_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// invoke the operation
RelayNameAvailabilityContent content = new RelayNameAvailabilityContent("example-RelayNamespace1321");
RelayNameAvailabilityResult result = await subscriptionResource.CheckRelayNamespaceNameAvailabilityAsync(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
Sample Response
{
"nameAvailable": true,
"reason": "None",
"message": ""
}
Definições
CheckNameAvailability
Parâmetros para marcar disponibilidade do nome do namespace especificado.
Nome |
Tipo |
Description |
name
|
string
|
O nome do namespace a ser marcar para disponibilidade. O nome do namespace pode conter apenas letras, números e hifens. O namespace deve começar com uma letra e deve terminar com uma letra ou número.
|
CheckNameAvailabilityResult
Descrição das propriedades da solicitação de disponibilidade do nome marcar.
Nome |
Tipo |
Description |
message
|
string
|
As informações detalhadas sobre o motivo associado ao namespace.
|
nameAvailable
|
boolean
|
Valor que indica que o namespace está disponível. Retornará true se o namespace estiver disponível; caso contrário, false.
|
reason
|
UnavailableReason
|
O motivo da indisponibilidade de um namespace.
|
ErrorAdditionalInfo
As informações adicionais do erro de gerenciamento de recursos.
Nome |
Tipo |
Description |
info
|
object
|
As informações adicionais.
|
type
|
string
|
O tipo de informação adicional.
|
ErrorDetail
O detalhe do erro.
Nome |
Tipo |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
As informações adicionais do erro.
|
code
|
string
|
O código de erro.
|
details
|
ErrorDetail[]
|
Os detalhes do erro.
|
message
|
string
|
A mensagem de erro.
|
target
|
string
|
O destino do erro.
|
ErrorResponse
Resposta de erro
Nome |
Tipo |
Description |
error
|
ErrorDetail
|
O objeto de erro.
|
UnavailableReason
O motivo da indisponibilidade de um namespace.
Nome |
Tipo |
Description |
InvalidName
|
string
|
|
NameInLockdown
|
string
|
|
NameInUse
|
string
|
|
None
|
string
|
|
SubscriptionIsDisabled
|
string
|
|
TooManyNamespaceInCurrentSubscription
|
string
|
|