Controleert of de naam van het Batch-account beschikbaar is in de opgegeven regio.
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability?api-version=2024-07-01
URI-parameters
Name |
In |
Vereist |
Type |
Description |
locationName
|
path |
True
|
string
|
De gewenste regio voor de naamcontrole.
|
subscriptionId
|
path |
True
|
string
|
De Azure-abonnements-id. Dit is een tekenreeks met GUID-indeling (bijvoorbeeld 00000000-0000-0000-0000-000000000000000)
|
api-version
|
query |
True
|
string
|
De API-versie die moet worden gebruikt met de HTTP-aanvraag.
|
Aanvraagbody
Name |
Vereist |
Type |
Description |
name
|
True
|
string
|
De naam die moet worden gecontroleerd op beschikbaarheid
|
type
|
True
|
ResourceType
|
Het resourcetype.
|
Antwoorden
Name |
Type |
Description |
200 OK
|
CheckNameAvailabilityResult
|
Succes. Retourneert details over of een Batch-accountnaam beschikbaar is.
|
Other Status Codes
|
CloudError
|
Foutreactie waarin wordt beschreven waarom de bewerking is mislukt.
|
Beveiliging
azure_auth
Microsoft Entra OAuth 2.0-verificatiecodestroom
Type:
oauth2
Stroom:
implicit
Autorisatie-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiken
Name |
Description |
user_impersonation
|
Uw gebruikersaccount imiteren
|
Voorbeelden
LocationCheckNameAvailability_AlreadyExists
Voorbeeldaanvraag
POST https://management.azure.com/subscriptions/subid/providers/Microsoft.Batch/locations/japaneast/checkNameAvailability?api-version=2024-07-01
{
"name": "existingaccountname",
"type": "Microsoft.Batch/batchAccounts"
}
import com.azure.resourcemanager.batch.models.CheckNameAvailabilityParameters;
/**
* Samples for Location CheckNameAvailability.
*/
public final class Main {
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/
* LocationCheckNameAvailability_AlreadyExists.json
*/
/**
* Sample code: LocationCheckNameAvailability_AlreadyExists.
*
* @param manager Entry point to BatchManager.
*/
public static void
locationCheckNameAvailabilityAlreadyExists(com.azure.resourcemanager.batch.BatchManager manager) {
manager.locations().checkNameAvailabilityWithResponse("japaneast",
new CheckNameAvailabilityParameters().withName("existingaccountname"), 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.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python location_check_name_availability_already_exists.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 = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.location.check_name_availability(
location_name="japaneast",
parameters={"name": "existingaccountname", "type": "Microsoft.Batch/batchAccounts"},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_AlreadyExists.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 armbatch_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/batch/armbatch/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_AlreadyExists.json
func ExampleLocationClient_CheckNameAvailability_locationCheckNameAvailabilityAlreadyExists() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewLocationClient().CheckNameAvailability(ctx, "japaneast", armbatch.CheckNameAvailabilityParameters{
Name: to.Ptr("existingaccountname"),
Type: to.Ptr("Microsoft.Batch/batchAccounts"),
}, 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 = armbatch.CheckNameAvailabilityResult{
// Message: to.Ptr("An account named 'existingaccountname' is already in use."),
// NameAvailable: to.Ptr(false),
// Reason: to.Ptr(armbatch.NameAvailabilityReasonAlreadyExists),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Checks whether the Batch account name is available in the specified region.
*
* @summary Checks whether the Batch account name is available in the specified region.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_AlreadyExists.json
*/
async function locationCheckNameAvailabilityAlreadyExists() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const locationName = "japaneast";
const parameters = {
name: "existingaccountname",
type: "Microsoft.Batch/batchAccounts",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.location.checkNameAvailability(locationName, 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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_AlreadyExists.json
// this example is just showing the usage of "Location_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
AzureLocation locationName = new AzureLocation("japaneast");
BatchNameAvailabilityContent content = new BatchNameAvailabilityContent("existingaccountname");
BatchNameAvailabilityResult result = await subscriptionResource.CheckBatchNameAvailabilityAsync(locationName, 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
Voorbeeldrespons
{
"nameAvailable": false,
"reason": "AlreadyExists",
"message": "An account named 'existingaccountname' is already in use."
}
LocationCheckNameAvailability_Available
Voorbeeldaanvraag
POST https://management.azure.com/subscriptions/subid/providers/Microsoft.Batch/locations/japaneast/checkNameAvailability?api-version=2024-07-01
{
"name": "newaccountname",
"type": "Microsoft.Batch/batchAccounts"
}
import com.azure.resourcemanager.batch.models.CheckNameAvailabilityParameters;
/**
* Samples for Location CheckNameAvailability.
*/
public final class Main {
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/
* LocationCheckNameAvailability_Available.json
*/
/**
* Sample code: LocationCheckNameAvailability_Available.
*
* @param manager Entry point to BatchManager.
*/
public static void locationCheckNameAvailabilityAvailable(com.azure.resourcemanager.batch.BatchManager manager) {
manager.locations().checkNameAvailabilityWithResponse("japaneast",
new CheckNameAvailabilityParameters().withName("newaccountname"), 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.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python location_check_name_availability_available.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 = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.location.check_name_availability(
location_name="japaneast",
parameters={"name": "newaccountname", "type": "Microsoft.Batch/batchAccounts"},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_Available.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 armbatch_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/batch/armbatch/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_Available.json
func ExampleLocationClient_CheckNameAvailability_locationCheckNameAvailabilityAvailable() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewLocationClient().CheckNameAvailability(ctx, "japaneast", armbatch.CheckNameAvailabilityParameters{
Name: to.Ptr("newaccountname"),
Type: to.Ptr("Microsoft.Batch/batchAccounts"),
}, 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 = armbatch.CheckNameAvailabilityResult{
// 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
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Checks whether the Batch account name is available in the specified region.
*
* @summary Checks whether the Batch account name is available in the specified region.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_Available.json
*/
async function locationCheckNameAvailabilityAvailable() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const locationName = "japaneast";
const parameters = {
name: "newaccountname",
type: "Microsoft.Batch/batchAccounts",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.location.checkNameAvailability(locationName, 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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/LocationCheckNameAvailability_Available.json
// this example is just showing the usage of "Location_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
AzureLocation locationName = new AzureLocation("japaneast");
BatchNameAvailabilityContent content = new BatchNameAvailabilityContent("newaccountname");
BatchNameAvailabilityResult result = await subscriptionResource.CheckBatchNameAvailabilityAsync(locationName, 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
Voorbeeldrespons
{
"nameAvailable": true
}
Definities
CheckNameAvailabilityParameters
Object
Parameters voor een beschikbaarheidsaanvraag voor de controlenaam.
Name |
Type |
Description |
name
|
string
|
De naam die moet worden gecontroleerd op beschikbaarheid
|
type
|
ResourceType
|
Het resourcetype.
|
CheckNameAvailabilityResult
Object
Het antwoord van de bewerking CheckNameAvailability.
Name |
Type |
Description |
message
|
string
|
Hiermee wordt een foutbericht weergegeven waarin de waarde Reden in meer detail wordt uitgelegd.
|
nameAvailable
|
boolean
|
Hiermee wordt een Booleaanse waarde opgehaald die aangeeft of de naam beschikbaar is voor gebruik. Indien waar, is de naam beschikbaar. Als deze onwaar is, is de naam al gebruikt of ongeldig en kan deze niet worden gebruikt.
|
reason
|
NameAvailabilityReason
|
Hiermee haalt u de reden op dat de naam van een Batch-account niet kan worden gebruikt. Het element Reason wordt alleen geretourneerd als NameAvailable onwaar is.
|
CloudError
Object
Een foutreactie van de Batch-service.
Name |
Type |
Description |
error
|
CloudErrorBody
|
De hoofdtekst van het foutbericht.
|
CloudErrorBody
Object
Een foutreactie van de Batch-service.
Name |
Type |
Description |
code
|
string
|
Een id voor de fout. Codes zijn invariant en zijn bedoeld om programmatisch te worden gebruikt.
|
details
|
CloudErrorBody[]
|
Een lijst met aanvullende informatie over de fout.
|
message
|
string
|
Een bericht met een beschrijving van de fout, bedoeld om te worden weergegeven in een gebruikersinterface.
|
target
|
string
|
Het doel van de specifieke fout. Bijvoorbeeld de naam van de eigenschap in fout.
|
NameAvailabilityReason
Inventarisatie
Hiermee haalt u de reden op dat de naam van een Batch-account niet kan worden gebruikt. Het element Reason wordt alleen geretourneerd als NameAvailable onwaar is.
Waarde |
Description |
AlreadyExists
|
De aangevraagde naam is al in gebruik.
|
Invalid
|
De aangevraagde naam is ongeldig.
|
ResourceType
Inventarisatie
Het resourcetype.
Waarde |
Description |
Microsoft.Batch/batchAccounts
|
Het resourcetype batchaccount.
|