Ruft die Ergebnisse eines Befehls ab, der auf dem verwalteten Cluster ausgeführt wurde.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}?api-version=2024-09-01
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
commandId
|
path |
True
|
string
|
ID des Befehls.
|
resourceGroupName
|
path |
True
|
string
|
Der Name der Ressourcengruppe. Bei dem Namen wird die Groß-/Kleinschreibung nicht beachtet.
|
resourceName
|
path |
True
|
string
|
Der Name der verwalteten Clusterressource.
RegEx-Muster: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$
|
subscriptionId
|
path |
True
|
string
uuid
|
Die ID des Zielabonnements. Der Wert muss eine UUID sein.
|
api-version
|
query |
True
|
string
|
Die API-Version, die für diesen Vorgang verwendet werden soll.
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
RunCommandResult
|
Befehl abgeschlossen
|
202 Accepted
|
|
Angenommen
Header
Location: string
|
Other Status Codes
|
CloudError
|
Fehlerantwort, die beschreibt, warum der Vorgang fehlgeschlagen ist. Wenn der Cluster nicht vorhanden ist, wird 404 (Nicht gefunden) zurückgegeben.
|
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
commandFailedResult
Beispielanforderung
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/commandResults/def7b3ea71bd4f7e9d226ddbc0f00ad9?api-version=2024-09-01
/**
* Samples for ManagedClusters GetCommandResult.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* RunCommandResultFailed.json
*/
/**
* Sample code: commandFailedResult.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void commandFailedResult(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getManagedClusters().getCommandResultWithResponse("rg1",
"clustername1", "def7b3ea71bd4f7e9d226ddbc0f00ad9", 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.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python run_command_result_failed.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 = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.managed_clusters.get_command_result(
resource_group_name="rg1",
resource_name="clustername1",
command_id="def7b3ea71bd4f7e9d226ddbc0f00ad9",
)
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultFailed.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 armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultFailed.json
func ExampleManagedClustersClient_GetCommandResult_commandFailedResult() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewManagedClustersClient().GetCommandResult(ctx, "rg1", "clustername1", "def7b3ea71bd4f7e9d226ddbc0f00ad9", 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.RunCommandResult = armcontainerservice.RunCommandResult{
// ID: to.Ptr("def7b3ea71bd4f7e9d226ddbc0f00ad9"),
// Properties: &armcontainerservice.CommandResultProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// Reason: to.Ptr("ImagePullBackoff"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the results of a command which has been run on the Managed Cluster.
*
* @summary Gets the results of a command which has been run on the Managed Cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultFailed.json
*/
async function commandFailedResult() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9";
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.managedClusters.getCommandResult(
resourceGroupName,
resourceName,
commandId,
);
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
location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/commandResults/0e9872e6629349dc865e27ee6f8bab2d?api-version=2024-09-01
{
"id": "def7b3ea71bd4f7e9d226ddbc0f00ad9",
"properties": {
"provisioningState": "failed",
"reason": "ImagePullBackoff"
}
}
commandSucceedResult
Beispielanforderung
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/commandResults/def7b3ea71bd4f7e9d226ddbc0f00ad9?api-version=2024-09-01
/**
* Samples for ManagedClusters GetCommandResult.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* RunCommandResultSucceed.json
*/
/**
* Sample code: commandSucceedResult.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void commandSucceedResult(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getManagedClusters().getCommandResultWithResponse("rg1",
"clustername1", "def7b3ea71bd4f7e9d226ddbc0f00ad9", 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.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python run_command_result_succeed.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 = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.managed_clusters.get_command_result(
resource_group_name="rg1",
resource_name="clustername1",
command_id="def7b3ea71bd4f7e9d226ddbc0f00ad9",
)
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultSucceed.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 armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultSucceed.json
func ExampleManagedClustersClient_GetCommandResult_commandSucceedResult() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewManagedClustersClient().GetCommandResult(ctx, "rg1", "clustername1", "def7b3ea71bd4f7e9d226ddbc0f00ad9", 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.RunCommandResult = armcontainerservice.RunCommandResult{
// ID: to.Ptr("def7b3ea71bd4f7e9d226ddbc0f00ad9"),
// Properties: &armcontainerservice.CommandResultProperties{
// ExitCode: to.Ptr[int32](0),
// FinishedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-17T00:28:33.000Z"); return t}()),
// Logs: to.Ptr("namespace dummy created"),
// ProvisioningState: to.Ptr("Succeeded"),
// StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-17T00:28:20.000Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the results of a command which has been run on the Managed Cluster.
*
* @summary Gets the results of a command which has been run on the Managed Cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultSucceed.json
*/
async function commandSucceedResult() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9";
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.managedClusters.getCommandResult(
resourceGroupName,
resourceName,
commandId,
);
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
location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/commandResults/0e9872e6629349dc865e27ee6f8bab2d?api-version=2024-09-01
{
"id": "def7b3ea71bd4f7e9d226ddbc0f00ad9",
"properties": {
"provisioningState": "succeeded",
"exitCode": 0,
"startedAt": "2021-02-17T00:28:20Z",
"finishedAt": "2021-02-17T00:28:33Z",
"logs": "namespace dummy created"
}
}
Definitionen
CloudError
Eine Fehlerantwort des Containerdiensts.
CloudErrorBody
Eine Fehlerantwort des Containerdiensts.
Name |
Typ |
Beschreibung |
code
|
string
|
Ein Bezeichner für den Fehler. Codes sind unveränderlich und sollen programmgesteuert genutzt werden.
|
details
|
CloudErrorBody[]
|
Eine Liste mit zusätzlichen Details zum Fehler.
|
message
|
string
|
Eine Meldung, die den Fehler beschreibt, der für die Anzeige in einer Benutzeroberfläche geeignet ist.
|
target
|
string
|
Das Ziel des bestimmten Fehlers. Beispielsweise der Name der Eigenschaft im Fehler.
|
RunCommandResult
Befehlsergebnis ausführen.
Name |
Typ |
Beschreibung |
id
|
string
|
Die Befehls-ID.
|
properties.exitCode
|
integer
|
Der Beendigungscode des Befehls
|
properties.finishedAt
|
string
|
Der Zeitpunkt, zu dem der Befehl abgeschlossen ist.
|
properties.logs
|
string
|
Die Befehlsausgabe.
|
properties.provisioningState
|
string
|
Bereitstellungsstatus
|
properties.reason
|
string
|
Eine Erläuterung, warum "provisioningState" auf "failed" festgelegt ist (falls ja).
|
properties.startedAt
|
string
|
Der Zeitpunkt, zu dem der Befehl gestartet wurde.
|