Listet anmeldeinformationen eines OpenShift-Clusters mit dem angegebenen Abonnement, der Ressourcengruppe und dem Ressourcennamen auf.
Der Vorgang gibt die Anmeldeinformationen zurück.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials?api-version=2023-11-22
URI-Parameter
Name |
In |
Erforderlich |
Typ |
Beschreibung |
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Der Name der Ressourcengruppe. Bei dem Namen wird die Groß-/Kleinschreibung nicht beachtet.
|
resourceName
|
path |
True
|
string
|
Der Name der OpenShift-Clusterressource.
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
Die ID des Zielabonnements.
|
api-version
|
query |
True
|
string
minLength: 1
|
Die API-Version, die für diesen Vorgang verwendet werden soll.
|
Antworten
Name |
Typ |
Beschreibung |
200 OK
|
OpenShiftClusterCredentials
|
OKAY
|
Other Status Codes
|
CloudError
|
Fehlerantwort, die beschreibt, warum der Vorgang fehlgeschlagen ist. Wenn die Ressource nicht vorhanden ist, wird 404 (Nicht gefunden) zurückgegeben. Wenn einer der Eingabeparameter falsch ist, wird 400 (Ungültige Anforderung) 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
Lists credentials of an OpenShift cluster with the specified subscription, resource group and resource name.
Beispielanforderung
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
Beispiel für eine Antwort
{
"kubeadminUsername": "kubeadmin",
"kubeadminPassword": "password"
}
Definitionen
Name |
Beschreibung |
CloudError
|
CloudError stellt einen Cloudfehler dar.
|
CloudErrorBody
|
CloudErrorBody stellt den Textkörper eines Cloudfehlers dar.
|
OpenShiftClusterCredentials
|
OpenShiftClusterCredentials stellt die Anmeldeinformationen eines OpenShift-Clusters dar.
|
CloudError
Objekt
CloudError stellt einen Cloudfehler dar.
Name |
Typ |
Beschreibung |
error
|
CloudErrorBody
|
Eine Fehlerantwort des Diensts.
|
CloudErrorBody
Objekt
CloudErrorBody stellt den Textkörper eines Cloudfehlers dar.
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.
|
OpenShiftClusterCredentials
Objekt
OpenShiftClusterCredentials stellt die Anmeldeinformationen eines OpenShift-Clusters dar.
Name |
Typ |
Beschreibung |
kubeadminPassword
|
string
|
Das Kennwort für den Kubeadmin-Benutzer.
|
kubeadminUsername
|
string
|
Der Benutzername für den Kubeadmin-Benutzer.
|