Check name availability (Otro: Comprobar disponibilidad del nombre)
Comprobación de si hay un nombre de área de trabajo disponible
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/checkNameAvailability?api-version=2021-06-01
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
subscriptionId
|
path |
True
|
string
|
Identificador de la suscripción de destino.
|
api-version
|
query |
True
|
string
|
Versión de API que se usará para la operación.
|
Cuerpo de la solicitud
Nombre |
Tipo |
Description |
name
|
string
|
Nombre del área de trabajo
|
type
|
string
|
Tipo: área de trabajo
|
Respuestas
Ejemplos
Check for a workspace name that already exists
Sample Request
POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Synapse/checkNameAvailability?api-version=2021-06-01
{
"name": "workspace1",
"type": "Microsoft.Synapse/workspaces"
}
import com.azure.resourcemanager.synapse.models.CheckNameAvailabilityRequest;
/** Samples for Operations CheckNameAvailability. */
public final class Main {
/*
* x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/CheckNameAvailabilityWorkspaceAlreadyExists.json
*/
/**
* Sample code: Check for a workspace name that already exists.
*
* @param manager Entry point to SynapseManager.
*/
public static void checkForAWorkspaceNameThatAlreadyExists(
com.azure.resourcemanager.synapse.SynapseManager manager) {
manager
.operations()
.checkNameAvailabilityWithResponse(
new CheckNameAvailabilityRequest().withName("workspace1").withType("Microsoft.Synapse/workspaces"),
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.synapse import SynapseManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-synapse
# USAGE
python check_name_availability_workspace_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 = SynapseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-1111-2222-3333-444444444444",
)
response = client.operations.check_name_availability(
request={"name": "workspace1", "type": "Microsoft.Synapse/workspaces"},
)
print(response)
# x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/CheckNameAvailabilityWorkspaceAlreadyExists.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 armsynapse_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/synapse/armsynapse"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/CheckNameAvailabilityWorkspaceAlreadyExists.json
func ExampleOperationsClient_CheckNameAvailability_checkForAWorkspaceNameThatAlreadyExists() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsynapse.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewOperationsClient().CheckNameAvailability(ctx, armsynapse.CheckNameAvailabilityRequest{
Name: to.Ptr("workspace1"),
Type: to.Ptr("Microsoft.Synapse/workspaces"),
}, 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.CheckNameAvailabilityResponse = armsynapse.CheckNameAvailabilityResponse{
// Name: to.Ptr("workspace1"),
// Available: to.Ptr(false),
// Message: to.Ptr("Specified workspace name is already used"),
// 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 { SynapseManagementClient } = require("@azure/arm-synapse");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Check whether a workspace name is available
*
* @summary Check whether a workspace name is available
* x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/CheckNameAvailabilityWorkspaceAlreadyExists.json
*/
async function checkForAWorkspaceNameThatAlreadyExists() {
const subscriptionId =
process.env["SYNAPSE_SUBSCRIPTION_ID"] || "00000000-1111-2222-3333-444444444444";
const request = {
name: "workspace1",
type: "Microsoft.Synapse/workspaces",
};
const credential = new DefaultAzureCredential();
const client = new SynapseManagementClient(credential, subscriptionId);
const result = await client.operations.checkNameAvailability(request);
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
{
"name": "workspace1",
"available": false,
"reason": "AlreadyExists",
"message": "Specified workspace name is already used"
}
{
"error": {
"code": "Error code",
"message": "Error message"
}
}
Check for a workspace name that is available
Sample Request
POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Synapse/checkNameAvailability?api-version=2021-06-01
{
"name": "workspace1",
"type": "Microsoft.ProjectArcadia/workspaces"
}
import com.azure.resourcemanager.synapse.models.CheckNameAvailabilityRequest;
/** Samples for Operations CheckNameAvailability. */
public final class Main {
/*
* x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/CheckNameAvailabilityWorkspaceAvailable.json
*/
/**
* Sample code: Check for a workspace name that is available.
*
* @param manager Entry point to SynapseManager.
*/
public static void checkForAWorkspaceNameThatIsAvailable(com.azure.resourcemanager.synapse.SynapseManager manager) {
manager
.operations()
.checkNameAvailabilityWithResponse(
new CheckNameAvailabilityRequest()
.withName("workspace1")
.withType("Microsoft.ProjectArcadia/workspaces"),
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.synapse import SynapseManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-synapse
# USAGE
python check_name_availability_workspace_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 = SynapseManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-1111-2222-3333-444444444444",
)
response = client.operations.check_name_availability(
request={"name": "workspace1", "type": "Microsoft.ProjectArcadia/workspaces"},
)
print(response)
# x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/CheckNameAvailabilityWorkspaceAvailable.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 armsynapse_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/synapse/armsynapse"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/CheckNameAvailabilityWorkspaceAvailable.json
func ExampleOperationsClient_CheckNameAvailability_checkForAWorkspaceNameThatIsAvailable() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsynapse.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewOperationsClient().CheckNameAvailability(ctx, armsynapse.CheckNameAvailabilityRequest{
Name: to.Ptr("workspace1"),
Type: to.Ptr("Microsoft.ProjectArcadia/workspaces"),
}, 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.CheckNameAvailabilityResponse = armsynapse.CheckNameAvailabilityResponse{
// Name: to.Ptr("workspace1"),
// Available: 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 { SynapseManagementClient } = require("@azure/arm-synapse");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Check whether a workspace name is available
*
* @summary Check whether a workspace name is available
* x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/CheckNameAvailabilityWorkspaceAvailable.json
*/
async function checkForAWorkspaceNameThatIsAvailable() {
const subscriptionId =
process.env["SYNAPSE_SUBSCRIPTION_ID"] || "00000000-1111-2222-3333-444444444444";
const request = {
name: "workspace1",
type: "Microsoft.ProjectArcadia/workspaces",
};
const credential = new DefaultAzureCredential();
const client = new SynapseManagementClient(credential, subscriptionId);
const result = await client.operations.checkNameAvailability(request);
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
{
"name": "workspace1",
"available": true,
"reason": null,
"message": null
}
{
"error": {
"code": "Error code",
"message": "Error message"
}
}
Definiciones
CheckNameAvailabilityRequest
Comprobación de la solicitud de disponibilidad de nombres
Nombre |
Tipo |
Description |
name
|
string
|
Nombre del área de trabajo
|
type
|
string
|
Tipo: área de trabajo
|
CheckNameAvailabilityResponse
Comprobación de la respuesta de disponibilidad de nombres
Nombre |
Tipo |
Description |
available
|
boolean
|
Si el nombre del área de trabajo está disponible
|
message
|
string
|
Mensaje de validación
|
name
|
string
|
Nombre del área de trabajo
|
reason
|
string
|
Motivo por el que el nombre del área de trabajo es o no está disponible
|
ErrorAdditionalInfo
Información adicional sobre el error de administración de recursos.
Nombre |
Tipo |
Description |
info
|
object
|
Información adicional.
|
type
|
string
|
Tipo de información adicional.
|
ErrorDetail
Detalle del error.
Nombre |
Tipo |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Información adicional del error.
|
code
|
string
|
Código de error.
|
details
|
ErrorDetail[]
|
Los detalles del error.
|
message
|
string
|
El mensaje de error.
|
target
|
string
|
Destino del error.
|
ErrorResponse
Respuesta de error
Nombre |
Tipo |
Description |
error
|
ErrorDetail
|
Objeto de error.
|