Voert de beschikbaarheidscontrole van de resourcenaam uit.
Controleert de beschikbaarheid van de resourcenaam.
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability?api-version=2021-02-16-preview
URI-parameters
Name |
In |
Vereist |
Type |
Description |
location
|
path |
True
|
string
minLength: 1
|
De naam van de Azure-regio.
|
subscriptionId
|
path |
True
|
string
(uuid)
|
De id van het doelabonnement. De waarde moet een UUID zijn.
|
api-version
|
query |
True
|
string
minLength: 1
|
De API-versie die voor deze bewerking moet worden gebruikt.
|
Aanvraagbody
Name |
Type |
Description |
name
|
string
|
Hiermee kunt u de resourcenaam opvragen of instellen.
|
type
|
string
|
Hiermee haalt u het resourcetype op of stelt u dit in.
|
Antwoorden
Beveiliging
azure_auth
Azure Active Directory OAuth2-stroom
Type:
oauth2
Stroom:
implicit
Autorisatie-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiken
Name |
Description |
user_impersonation
|
Uw gebruikersaccount imiteren
|
Voorbeelden
CheckNameAvailability
Voorbeeldaanvraag
POST https://management.azure.com/subscriptions/930CEC23-4430-4513-B855-DBA237E2F3BF/providers/Microsoft.DataReplication/locations/trfqtbtmusswpibw/checkNameAvailability?api-version=2021-02-16-preview
{
"name": "updkdcixs",
"type": "gngmcancdauwhdixjjvqnfkvqc"
}
import com.azure.resourcemanager.recoveryservicesdatareplication.models.CheckNameAvailabilityModel;
/**
* Samples for ResourceProvider CheckNameAvailability.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-
* preview/examples/CheckNameAvailability.json
*/
/**
* Sample code: CheckNameAvailability.
*
* @param manager Entry point to RecoveryServicesDataReplicationManager.
*/
public static void checkNameAvailability(
com.azure.resourcemanager.recoveryservicesdatareplication.RecoveryServicesDataReplicationManager manager) {
manager.resourceProviders().checkNameAvailabilityWithResponse("trfqtbtmusswpibw",
new CheckNameAvailabilityModel().withName("updkdcixs").withType("gngmcancdauwhdixjjvqnfkvqc"),
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.recoveryservicesdatareplication import RecoveryServicesDataReplicationMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-recoveryservicesdatareplication
# USAGE
python 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 = RecoveryServicesDataReplicationMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="930CEC23-4430-4513-B855-DBA237E2F3BF",
)
response = client.check_name_availability(
location="trfqtbtmusswpibw",
)
print(response)
# x-ms-original-file: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/CheckNameAvailability.json
func ExampleAzureSiteRecoveryManagementServiceAPIClient_CheckNameAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAzureSiteRecoveryManagementServiceAPIClient().CheckNameAvailability(ctx, "trfqtbtmusswpibw", &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions{Body: &armrecoveryservicesdatareplication.CheckNameAvailabilityModel{
Name: to.Ptr("updkdcixs"),
Type: to.Ptr("gngmcancdauwhdixjjvqnfkvqc"),
},
})
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.CheckNameAvailabilityResponseModel = armrecoveryservicesdatareplication.CheckNameAvailabilityResponseModel{
// Message: to.Ptr("gddmrunlrhtuhm"),
// NameAvailable: to.Ptr(true),
// Reason: to.Ptr("wwbvswyrmghbmv"),
// }
}
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.RecoveryServicesDataReplication.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.RecoveryServicesDataReplication;
// Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/CheckNameAvailability.json
// this example is just showing the usage of "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 = "930CEC23-4430-4513-B855-DBA237E2F3BF";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// invoke the operation
AzureLocation location = new AzureLocation("trfqtbtmusswpibw");
DataReplicationNameAvailabilityContent content = new DataReplicationNameAvailabilityContent
{
Name = "updkdcixs",
ResourceType = new ResourceType("gngmcancdauwhdixjjvqnfkvqc"),
};
DataReplicationNameAvailabilityResult result = await subscriptionResource.CheckDataReplicationNameAvailabilityAsync(location, content: 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,
"reason": "wwbvswyrmghbmv",
"message": "gddmrunlrhtuhm"
}
Definities
CheckNameAvailabilityModel
Object
Controleer het beschikbaarheidsmodel van de naam.
Name |
Type |
Description |
name
|
string
|
Hiermee kunt u de resourcenaam opvragen of instellen.
|
type
|
string
|
Hiermee haalt u het resourcetype op of stelt u dit in.
|
CheckNameAvailabilityResponseModel
Object
Controleer het antwoordmodel voor de beschikbaarheid van namen.
Name |
Type |
Description |
message
|
string
|
Hiermee haalt u het bericht op of stelt u het bericht in voor de resourcenaam die niet beschikbaar is.
|
nameAvailable
|
boolean
|
Hiermee wordt een waarde opgehaald of ingesteld die aangeeft of de resourcenaam beschikbaar is of niet.
|
reason
|
string
|
Hiermee haalt u de reden op waarom de resourcenaam niet beschikbaar is of stelt u deze in.
|
ErrorAdditionalInfo
Object
Aanvullende informatie over de resourcebeheerfout.
Name |
Type |
Description |
info
|
object
|
De aanvullende informatie.
|
type
|
string
|
Het extra informatietype.
|
ErrorDetail
Object
De foutdetails.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
De fout bevat aanvullende informatie.
|
code
|
string
|
De foutcode.
|
details
|
ErrorDetail[]
|
De foutdetails.
|
message
|
string
|
Het foutbericht.
|
target
|
string
|
Het foutdoel.
|
ErrorResponse
Object
Foutreactie
Name |
Type |
Description |
error
|
ErrorDetail
|
Het foutobject.
|