Überprüft, ob der Containerregistrierungsname zur Verwendung verfügbar ist. Der Name darf nur alphanumerische Zeichen enthalten, global eindeutig und zwischen 5 und 50 Zeichen lang sein.
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability?api-version=2023-01-01-preview
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
subscriptionId
|
path |
True
|
string
(uuid)
|
Die ID des Zielabonnements. Der Wert muss eine UUID sein.
|
api-version
|
query |
True
|
string
minLength: 1
|
Die API-Version, die für diesen Vorgang verwendet werden soll.
|
Anforderungstext
Name |
Erforderlich |
Typ |
Beschreibung |
name
|
True
|
string
minLength: 5 maxLength: 50 pattern: ^[a-zA-Z0-9]*$
|
Der Name der Containerregistrierung.
|
type
|
True
|
ContainerRegistryResourceType
|
Der Ressourcentyp der Containerregistrierung. Dieses Feld muss auf "Microsoft.ContainerRegistry/registries" festgelegt werden.
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
RegistryNameStatus
|
Die Anforderung war erfolgreich; die Anforderung war wohlgeformt und richtig empfangen.
|
Sicherheit
azure_auth
Azure Active Directory OAuth2-Fluss
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
Name |
Beschreibung |
user_impersonation
|
Identitätswechsel ihres Benutzerkontos
|
Beispiele
RegistryCheckNameAvailable
Beispielanforderung
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerRegistry/checkNameAvailability?api-version=2023-01-01-preview
{
"name": "myRegistry",
"type": "Microsoft.ContainerRegistry/registries"
}
package armcontainerregistry_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/containerregistry/armcontainerregistry"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryCheckNameAvailable.json
func ExampleRegistriesClient_CheckNameAvailability_registryCheckNameAvailable() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerregistry.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRegistriesClient().CheckNameAvailability(ctx, armcontainerregistry.RegistryNameCheckRequest{
Name: to.Ptr("myRegistry"),
Type: to.Ptr("Microsoft.ContainerRegistry/registries"),
}, 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.RegistryNameStatus = armcontainerregistry.RegistryNameStatus{
// 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 { ContainerRegistryManagementClient } = require("@azure/arm-containerregistry");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length.
*
* @summary Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length.
* x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryCheckNameAvailable.json
*/
async function registryCheckNameAvailable() {
const subscriptionId =
process.env["CONTAINERREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const registryNameCheckRequest = {
name: "myRegistry",
type: "Microsoft.ContainerRegistry/registries",
};
const credential = new DefaultAzureCredential();
const client = new ContainerRegistryManagementClient(credential, subscriptionId);
const result = await client.registries.checkNameAvailability(registryNameCheckRequest);
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
Beispiel für eine Antwort
{
"nameAvailable": true
}
RegistryCheckNameNotAvailable
Beispielanforderung
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerRegistry/checkNameAvailability?api-version=2023-01-01-preview
{
"name": "myRegistry",
"type": "Microsoft.ContainerRegistry/registries"
}
package armcontainerregistry_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/containerregistry/armcontainerregistry"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryCheckNameNotAvailable.json
func ExampleRegistriesClient_CheckNameAvailability_registryCheckNameNotAvailable() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerregistry.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRegistriesClient().CheckNameAvailability(ctx, armcontainerregistry.RegistryNameCheckRequest{
Name: to.Ptr("myRegistry"),
Type: to.Ptr("Microsoft.ContainerRegistry/registries"),
}, 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.RegistryNameStatus = armcontainerregistry.RegistryNameStatus{
// Message: to.Ptr("The registry myRegistry is already in use."),
// 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 { ContainerRegistryManagementClient } = require("@azure/arm-containerregistry");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length.
*
* @summary Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length.
* x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryCheckNameNotAvailable.json
*/
async function registryCheckNameNotAvailable() {
const subscriptionId =
process.env["CONTAINERREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const registryNameCheckRequest = {
name: "myRegistry",
type: "Microsoft.ContainerRegistry/registries",
};
const credential = new DefaultAzureCredential();
const client = new ContainerRegistryManagementClient(credential, subscriptionId);
const result = await client.registries.checkNameAvailability(registryNameCheckRequest);
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
Beispiel für eine Antwort
{
"nameAvailable": false,
"reason": "AlreadyExists",
"message": "The registry myRegistry is already in use."
}
Definitionen
Name |
Beschreibung |
ContainerRegistryResourceType
|
Der Ressourcentyp der Containerregistrierung. Dieses Feld muss auf "Microsoft.ContainerRegistry/registries" festgelegt werden.
|
RegistryNameCheckRequest
|
Eine Anforderung, um zu überprüfen, ob ein Containerregistrierungsname verfügbar ist.
|
RegistryNameStatus
|
Das Ergebnis einer Anforderung zur Überprüfung der Verfügbarkeit eines Containerregistrierungsnamens.
|
ContainerRegistryResourceType
Enumeration
Der Ressourcentyp der Containerregistrierung. Dieses Feld muss auf "Microsoft.ContainerRegistry/registries" festgelegt werden.
Wert |
Beschreibung |
Microsoft.ContainerRegistry/registries
|
|
RegistryNameCheckRequest
Objekt
Eine Anforderung, um zu überprüfen, ob ein Containerregistrierungsname verfügbar ist.
Name |
Typ |
Beschreibung |
name
|
string
minLength: 5 maxLength: 50 pattern: ^[a-zA-Z0-9]*$
|
Der Name der Containerregistrierung.
|
type
|
ContainerRegistryResourceType
|
Der Ressourcentyp der Containerregistrierung. Dieses Feld muss auf "Microsoft.ContainerRegistry/registries" festgelegt werden.
|
RegistryNameStatus
Objekt
Das Ergebnis einer Anforderung zur Überprüfung der Verfügbarkeit eines Containerregistrierungsnamens.
Name |
Typ |
Beschreibung |
message
|
string
|
Ist dies der Fall, wird die Fehlermeldung angezeigt, die weitere Details enthält, aus dem Grund, warum der Name nicht verfügbar ist.
|
nameAvailable
|
boolean
|
Der Wert, der angibt, ob der Name verfügbar ist.
|
reason
|
string
|
Wenn vorhanden, ist der Grund, warum der Name nicht verfügbar ist.
|