清單 具有指定訂用帳戶、資源群組和資源名稱的 OpenShift 叢集認證。
作業會傳回認證。
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials?api-version=2023-09-04
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
resourceGroupName
|
path |
True
|
string
|
資源群組的名稱。 名稱不區分大小寫。
|
resourceName
|
path |
True
|
string
|
OpenShift 叢集資源的名稱。
|
subscriptionId
|
path |
True
|
string
|
目標訂用帳戶的標識碼。
|
api-version
|
query |
True
|
string
|
用於此作業的 API 版本。
|
回應
安全性
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名稱 |
Description |
user_impersonation
|
模擬您的用戶帳戶
|
範例
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-09-04
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/stable/2023-09-04/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/bce66ff64f0e9edc9ea6119d00324058413e81ed/specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-09-04/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
Sample Response
{
"kubeadminUsername": "kubeadmin",
"kubeadminPassword": "password"
}
定義
CloudError
CloudError 代表雲端錯誤。
CloudErrorBody
CloudErrorBody 代表雲端錯誤的主體。
名稱 |
類型 |
Description |
code
|
string
|
錯誤的識別碼。 程式碼不變,且要以程式設計方式使用。
|
details
|
CloudErrorBody[]
|
錯誤的其他詳細數據清單。
|
message
|
string
|
描述錯誤的訊息,適用於在使用者介面中顯示。
|
target
|
string
|
特定錯誤的目標。 例如,錯誤中的屬性名稱。
|
OpenShiftClusterCredentials
OpenShiftClusterCredentials 代表 OpenShift 叢集的認證。
名稱 |
類型 |
Description |
kubeadminPassword
|
string
|
kubeadmin 用戶的密碼。
|
kubeadminUsername
|
string
|
kubeadmin 使用者的用戶名稱。
|