Pobiera wyniki polecenia, które zostało uruchomione w klastrze zarządzanym.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}?api-version=2024-09-01
Parametry identyfikatora URI
Nazwa |
W |
Wymagane |
Typ |
Opis |
commandId
|
path |
True
|
string
|
Identyfikator polecenia.
|
resourceGroupName
|
path |
True
|
string
|
Nazwa grupy zasobów. Nazwa jest niewrażliwa na wielkość liter.
|
resourceName
|
path |
True
|
string
|
Nazwa zasobu klastra zarządzanego.
Wzorzec wyrażenia regularnego: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$
|
subscriptionId
|
path |
True
|
string
uuid
|
Identyfikator subskrypcji docelowej. Wartość musi być identyfikatorem UUID.
|
api-version
|
query |
True
|
string
|
Wersja interfejsu API do użycia dla tej operacji.
|
Odpowiedzi
Nazwa |
Typ |
Opis |
200 OK
|
RunCommandResult
|
zakończono polecenie
|
202 Accepted
|
|
Akceptowane
Nagłówki
Location: string
|
Other Status Codes
|
CloudError
|
Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się. Jeśli klaster nie istnieje, zostanie zwrócony błąd 404 (nie znaleziono).
|
Zabezpieczenia
azure_auth
Przepływ protokołu OAuth2 usługi Azure Active Directory
Typ:
oauth2
Flow:
implicit
Adres URL autoryzacji:
https://login.microsoftonline.com/common/oauth2/authorize
Zakresy
Nazwa |
Opis |
user_impersonation
|
personifikacja konta użytkownika
|
Przykłady
commandFailedResult
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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"
}
}
Definicje
CloudError
Odpowiedź na błąd z usługi Container Service.
CloudErrorBody
Odpowiedź na błąd z usługi Container Service.
Nazwa |
Typ |
Opis |
code
|
string
|
Identyfikator błędu. Kody są niezmienne i mają być używane programowo.
|
details
|
CloudErrorBody[]
|
Lista dodatkowych szczegółów dotyczących błędu.
|
message
|
string
|
Komunikat opisujący błąd, który ma być odpowiedni do wyświetlania w interfejsie użytkownika.
|
target
|
string
|
Element docelowy określonego błędu. Na przykład nazwa właściwości w błędzie.
|
RunCommandResult
uruchom wynik polecenia.
Nazwa |
Typ |
Opis |
id
|
string
|
Identyfikator polecenia.
|
properties.exitCode
|
integer
|
Kod zakończenia polecenia
|
properties.finishedAt
|
string
|
Czas zakończenia polecenia.
|
properties.logs
|
string
|
Dane wyjściowe polecenia.
|
properties.provisioningState
|
string
|
stan aprowizacji
|
properties.reason
|
string
|
Wyjaśnienie przyczyny niepowodzenia parametru provisioningState (jeśli tak).
|
properties.startedAt
|
string
|
Czas uruchomienia polecenia.
|