Visar autentiseringsuppgifter för ett OpenShift-kluster med den angivna prenumerationen, resursgruppen och resursnamnet.
Åtgärden returnerar autentiseringsuppgifterna.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials?api-version=2023-11-22
URI-parametrar
Name |
I |
Obligatorisk |
Typ |
Description |
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Namnet på resursgruppen. Namnet är skiftlägesokänsligt.
|
resourceName
|
path |
True
|
string
|
Namnet på OpenShift-klusterresursen.
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
ID för målprenumerationen.
|
api-version
|
query |
True
|
string
minLength: 1
|
DEN API-version som ska användas för den här åtgärden.
|
Svar
Name |
Typ |
Description |
200 OK
|
OpenShiftClusterCredentials
|
OK
|
Other Status Codes
|
CloudError
|
Felsvar som beskriver varför åtgärden misslyckades. Om resursen inte finns returneras 404 (hittades inte). Om någon av indataparametrarna är fel returneras 400 (felaktig begäran).
|
Säkerhet
azure_auth
Azure Active Directory OAuth2 Flow
Typ:
oauth2
Flow:
implicit
Auktoriseringswebbadress:
https://login.microsoftonline.com/common/oauth2/authorize
Omfattningar
Name |
Description |
user_impersonation
|
personifiera ditt användarkonto
|
Exempel
Lists credentials of an OpenShift cluster with the specified subscription, resource group and resource name.
Exempelbegäran
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
Exempelsvar
{
"kubeadminUsername": "kubeadmin",
"kubeadminPassword": "password"
}
Definitioner
Name |
Description |
CloudError
|
CloudError representerar ett molnfel.
|
CloudErrorBody
|
CloudErrorBody representerar brödtexten för ett molnfel.
|
OpenShiftClusterCredentials
|
OpenShiftClusterCredentials representerar ett OpenShift-klusters autentiseringsuppgifter.
|
CloudError
Objekt
CloudError representerar ett molnfel.
CloudErrorBody
Objekt
CloudErrorBody representerar brödtexten för ett molnfel.
Name |
Typ |
Description |
code
|
string
|
En identifierare för felet. Koder är invarianta och är avsedda att användas programmatiskt.
|
details
|
CloudErrorBody[]
|
En lista med ytterligare information om felet.
|
message
|
string
|
Ett meddelande som beskriver felet, avsett att vara lämpligt för visning i ett användargränssnitt.
|
target
|
string
|
Målet för det specifika felet. Till exempel namnet på egenskapen i fel.
|
OpenShiftClusterCredentials
Objekt
OpenShiftClusterCredentials representerar ett OpenShift-klusters autentiseringsuppgifter.
Name |
Typ |
Description |
kubeadminPassword
|
string
|
Lösenordet för kubeadmin-användaren.
|
kubeadminUsername
|
string
|
Användarnamnet för kubeadmin-användaren.
|