Obtém os resultados de um comando que foi executado no Cluster Gerenciado.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}?api-version=2024-09-01
Parâmetros do URI
Name |
Em |
Necessário |
Tipo |
Description |
commandId
|
path |
True
|
string
|
Id do comando.
|
resourceGroupName
|
path |
True
|
string
|
O nome do grupo de recursos. O nome não diferencia maiúsculas de minúsculas.
|
resourceName
|
path |
True
|
string
|
O nome do recurso de cluster gerenciado.
Padrão Regex: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$
|
subscriptionId
|
path |
True
|
string
uuid
|
A ID da assinatura de destino. O valor deve ser um UUID.
|
api-version
|
query |
True
|
string
|
A versão da API a ser usada para esta operação.
|
Respostas
Name |
Tipo |
Description |
200 OK
|
RunCommandResult
|
comando concluído
|
202 Accepted
|
|
Aceito
Cabeçalhos
Location: string
|
Other Status Codes
|
CloudError
|
Resposta de erro descrevendo por que a operação falhou. Se o cluster não existir, 404 (Não encontrado) será retornado.
|
Segurança
azure_auth
Azure Ative Directory OAuth2 Flow
Tipo:
oauth2
Fluxo:
implicit
URL de Autorização:
https://login.microsoftonline.com/common/oauth2/authorize
Âmbitos
Name |
Description |
user_impersonation
|
personificar a sua conta de utilizador
|
Exemplos
commandFailedResult
Pedido de amostra
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
Resposta da amostra
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
Pedido de amostra
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
Resposta da amostra
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"
}
}
Definições
CloudError
Uma resposta de erro do serviço de contêiner.
CloudErrorBody
Uma resposta de erro do serviço de contêiner.
Name |
Tipo |
Description |
code
|
string
|
Um identificador para o erro. Os códigos são invariantes e destinam-se a ser consumidos programaticamente.
|
details
|
CloudErrorBody[]
|
Uma lista de detalhes adicionais sobre o erro.
|
message
|
string
|
Uma mensagem descrevendo o erro, destinada a ser adequada para exibição em uma interface do usuário.
|
target
|
string
|
O alvo do erro específico. Por exemplo, o nome da propriedade em erro.
|
RunCommandResult
Execute o resultado do comando.
Name |
Tipo |
Description |
id
|
string
|
A id do comando.
|
properties.exitCode
|
integer
|
O código de saída do comando
|
properties.finishedAt
|
string
|
A hora em que o comando terminou.
|
properties.logs
|
string
|
A saída do comando.
|
properties.provisioningState
|
string
|
Estado de provisionamento
|
properties.reason
|
string
|
Uma explicação do motivo pelo qual provisioningState está definido como failed (em caso afirmativo).
|
properties.startedAt
|
string
|
A hora em que o comando foi iniciado.
|