Répertorier les clés de test d’un service.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys?api-version=2023-12-01
Paramètres URI
Nom |
Dans |
Obligatoire |
Type |
Description |
resourceGroupName
|
path |
True
|
string
|
Nom du groupe de ressources qui contient la ressource. Vous pouvez obtenir cette valeur à partir de l’API Azure Resource Manager ou du portail.
|
serviceName
|
path |
True
|
string
|
Nom de la ressource de service.
Modèle d’expression régulière: ^[a-z][a-z0-9-]*[a-z0-9]$
|
subscriptionId
|
path |
True
|
string
|
Obtient l’ID d’abonnement qui identifie de manière unique l’abonnement Microsoft Azure. L’ID d’abonnement fait partie de l’URI pour chaque appel de service.
|
api-version
|
query |
True
|
string
|
Version de l’API à utiliser pour cette opération.
|
Réponses
Nom |
Type |
Description |
200 OK
|
TestKeys
|
Réussite. La réponse décrit les clés de test.
|
Other Status Codes
|
CloudError
|
Réponse d’erreur décrivant la raison de l’échec de l’opération.
|
Sécurité
azure_auth
Flux OAuth2 Azure Active Directory
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
Nom |
Description |
user_impersonation
|
Emprunter l’identité de votre compte d’utilisateur
|
Exemples
Services_ListTestKeys
Exemple de requête
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.AppPlatform/Spring/myservice/listTestKeys?api-version=2023-12-01
/**
* Samples for Services ListTestKeys.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/appplatform/resource-manager/Microsoft.AppPlatform/stable/2023-12-01/examples/Services_ListTestKeys
* .json
*/
/**
* Sample code: Services_ListTestKeys.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void servicesListTestKeys(com.azure.resourcemanager.AzureResourceManager azure) {
azure.springServices().manager().serviceClient().getServices().listTestKeysWithResponse("myResourceGroup",
"myservice", 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.appplatform import AppPlatformManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-appplatform
# USAGE
python services_list_test_keys.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 = AppPlatformManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.services.list_test_keys(
resource_group_name="myResourceGroup",
service_name="myservice",
)
print(response)
# x-ms-original-file: specification/appplatform/resource-manager/Microsoft.AppPlatform/stable/2023-12-01/examples/Services_ListTestKeys.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 armappplatform_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appplatform/armappplatform/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/685aad3f33d355c1d9c89d493ee9398865367bd8/specification/appplatform/resource-manager/Microsoft.AppPlatform/stable/2023-12-01/examples/Services_ListTestKeys.json
func ExampleServicesClient_ListTestKeys() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armappplatform.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().ListTestKeys(ctx, "myResourceGroup", "myservice", 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.TestKeys = armappplatform.TestKeys{
// Enabled: to.Ptr(true),
// PrimaryKey: to.Ptr("<primaryKey>"),
// PrimaryTestEndpoint: to.Ptr("<primaryTestEndpoint>"),
// SecondaryKey: to.Ptr("<secondaryKey>"),
// SecondaryTestEndpoint: to.Ptr("<secondaryTestEndpoint>"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AppPlatformManagementClient } = require("@azure/arm-appplatform");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to List test keys for a Service.
*
* @summary List test keys for a Service.
* x-ms-original-file: specification/appplatform/resource-manager/Microsoft.AppPlatform/stable/2023-12-01/examples/Services_ListTestKeys.json
*/
async function servicesListTestKeys() {
const subscriptionId =
process.env["APPPLATFORM_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["APPPLATFORM_RESOURCE_GROUP"] || "myResourceGroup";
const serviceName = "myservice";
const credential = new DefaultAzureCredential();
const client = new AppPlatformManagementClient(credential, subscriptionId);
const result = await client.services.listTestKeys(resourceGroupName, serviceName);
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
Exemple de réponse
{
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>",
"primaryTestEndpoint": "<primaryTestEndpoint>",
"secondaryTestEndpoint": "<secondaryTestEndpoint>",
"enabled": true
}
Définitions
CloudError
Réponse d’erreur du service.
Nom |
Type |
Description |
error
|
CloudErrorBody
|
Réponse d’erreur du service.
|
CloudErrorBody
Réponse d’erreur du service.
Nom |
Type |
Description |
code
|
string
|
Identificateur de l'erreur. Les codes sont invariants et sont destinés à être consommés par programmation.
|
details
|
CloudErrorBody[]
|
Liste des détails supplémentaires sur l’erreur.
|
message
|
string
|
Message décrivant l’erreur, destiné à être affiché dans une interface utilisateur.
|
target
|
string
|
Cible de l’erreur particulière. Par exemple, le nom de la propriété dans l’erreur.
|
TestKeys
Charge utile des clés de test
Nom |
Type |
Description |
enabled
|
boolean
|
Indique si la fonctionnalité de point de terminaison de test est activée ou non
|
primaryKey
|
string
|
Clé primaire
|
primaryTestEndpoint
|
string
|
Point de terminaison de test principal
|
secondaryKey
|
string
|
Clé secondaire
|
secondaryTestEndpoint
|
string
|
Point de terminaison de test secondaire
|