Lists credentials of an OpenShift cluster with the specified subscription, resource group and resource name.
The operation returns the credentials.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials?api-version=2023-11-22
URI Parameters
Name |
In |
Required |
Type |
Description |
resourceGroupName
|
path |
True
|
string
|
The name of the resource group. The name is case insensitive.
|
resourceName
|
path |
True
|
string
|
The name of the OpenShift cluster resource.
|
subscriptionId
|
path |
True
|
string
|
The ID of the target subscription.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
Responses
Name |
Type |
Description |
200 OK
|
OpenShiftClusterCredentials
|
OK
|
Other Status Codes
|
CloudError
|
Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
Lists credentials of an OpenShift cluster with the specified subscription, resource group and resource name.
Sample request
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
Sample response
{
"kubeadminUsername": "kubeadmin",
"kubeadminPassword": "password"
}
Definitions
CloudError
CloudError represents a cloud error.
Name |
Type |
Description |
error
|
CloudErrorBody
|
An error response from the service.
|
CloudErrorBody
CloudErrorBody represents the body of a cloud error.
Name |
Type |
Description |
code
|
string
|
An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
|
details
|
CloudErrorBody[]
|
A list of additional details about the error.
|
message
|
string
|
A message describing the error, intended to be suitable for display in a user interface.
|
target
|
string
|
The target of the particular error. For example, the name of the property in error.
|
OpenShiftClusterCredentials
OpenShiftClusterCredentials represents an OpenShift cluster's credentials.
Name |
Type |
Description |
kubeadminPassword
|
string
|
The password for the kubeadmin user.
|
kubeadminUsername
|
string
|
The username for the kubeadmin user.
|