Enumera las credenciales de un clúster de OpenShift con la suscripción, el grupo de recursos y el nombre de recurso especificados.
La operación devuelve las credenciales.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials?api-version=2023-11-22
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Nombre del grupo de recursos. El nombre no distingue mayúsculas de minúsculas.
|
resourceName
|
path |
True
|
string
|
Nombre del recurso de clúster de OpenShift.
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
Identificador de la suscripción de destino.
|
api-version
|
query |
True
|
string
minLength: 1
|
Versión de la API que se va a usar para esta operación.
|
Respuestas
Nombre |
Tipo |
Description |
200 OK
|
OpenShiftClusterCredentials
|
De acuerdo
|
Other Status Codes
|
CloudError
|
Respuesta de error que describe por qué se produjo un error en la operación. Si el recurso no existe, se devuelve 404 (no encontrado). Si alguno de los parámetros de entrada es incorrecto, se devuelve 400 (solicitud incorrecta).
|
Seguridad
azure_auth
Flujo de OAuth2 de Azure Active Directory
Tipo:
oauth2
Flujo:
implicit
Dirección URL de autorización:
https://login.microsoftonline.com/common/oauth2/authorize
Ámbitos
Nombre |
Description |
user_impersonation
|
suplantar la cuenta de usuario
|
Ejemplos
Lists credentials of an OpenShift cluster with the specified subscription, resource group and resource name.
Solicitud de ejemplo
POST https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/openShiftClusters/resourceName/listCredentials?api-version=2023-11-22
/**
* Samples for OpenShiftClusters ListCredentials.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/
* examples/OpenShiftClusters_ListCredentials.json
*/
/**
* Sample code: Lists credentials of an OpenShift cluster with the specified subscription, resource group and
* resource name.
*
* @param manager Entry point to RedHatOpenShiftManager.
*/
public static void listsCredentialsOfAnOpenShiftClusterWithTheSpecifiedSubscriptionResourceGroupAndResourceName(
com.azure.resourcemanager.redhatopenshift.RedHatOpenShiftManager manager) {
manager.openShiftClusters().listCredentialsWithResponse("resourceGroup", "resourceName",
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.redhatopenshift import AzureRedHatOpenShiftClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redhatopenshift
# USAGE
python open_shift_clusters_list_credentials.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 = AzureRedHatOpenShiftClient(
credential=DefaultAzureCredential(),
subscription_id="subscriptionId",
)
response = client.open_shift_clusters.list_credentials(
resource_group_name="resourceGroup",
resource_name="resourceName",
)
print(response)
# x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_ListCredentials.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 armredhatopenshift_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redhatopenshift/armredhatopenshift"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c1cea38fb7e5cec9afe223a2ed15cbe2fbeecbdb/specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_ListCredentials.json
func ExampleOpenShiftClustersClient_ListCredentials() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armredhatopenshift.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewOpenShiftClustersClient().ListCredentials(ctx, "resourceGroup", "resourceName", 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.OpenShiftClusterCredentials = armredhatopenshift.OpenShiftClusterCredentials{
// KubeadminPassword: to.Ptr("password"),
// KubeadminUsername: to.Ptr("kubeadmin"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureRedHatOpenShiftClient } = require("@azure/arm-redhatopenshift");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to The operation returns the credentials.
*
* @summary The operation returns the credentials.
* x-ms-original-file: specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/examples/OpenShiftClusters_ListCredentials.json
*/
async function listsCredentialsOfAnOpenShiftClusterWithTheSpecifiedSubscriptionResourceGroupAndResourceName() {
const subscriptionId = process.env["REDHATOPENSHIFT_SUBSCRIPTION_ID"] || "subscriptionId";
const resourceGroupName = process.env["REDHATOPENSHIFT_RESOURCE_GROUP"] || "resourceGroup";
const resourceName = "resourceName";
const credential = new DefaultAzureCredential();
const client = new AzureRedHatOpenShiftClient(credential, subscriptionId);
const result = await client.openShiftClusters.listCredentials(resourceGroupName, resourceName);
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
Respuesta de muestra
{
"kubeadminUsername": "kubeadmin",
"kubeadminPassword": "password"
}
Definiciones
Nombre |
Description |
CloudError
|
CloudError representa un error en la nube.
|
CloudErrorBody
|
CloudErrorBody representa el cuerpo de un error en la nube.
|
OpenShiftClusterCredentials
|
OpenShiftClusterCredentials representa las credenciales de un clúster de OpenShift.
|
CloudError
Object
CloudError representa un error en la nube.
Nombre |
Tipo |
Description |
error
|
CloudErrorBody
|
Respuesta de error del servicio.
|
CloudErrorBody
Object
CloudErrorBody representa el cuerpo de un error en la nube.
Nombre |
Tipo |
Description |
code
|
string
|
Identificador del error. Los códigos son invariables y están diseñados para consumirse mediante programación.
|
details
|
CloudErrorBody[]
|
Lista de detalles adicionales sobre el error.
|
message
|
string
|
Mensaje que describe el error, diseñado para ser adecuado para mostrarse en una interfaz de usuario.
|
target
|
string
|
Destino del error concreto. Por ejemplo, el nombre de la propiedad en error.
|
OpenShiftClusterCredentials
Object
OpenShiftClusterCredentials representa las credenciales de un clúster de OpenShift.
Nombre |
Tipo |
Description |
kubeadminPassword
|
string
|
Contraseña del usuario kubeadmin.
|
kubeadminUsername
|
string
|
Nombre de usuario del usuario kubeadmin.
|