授予指定访问角色对指定项目的访问权限。此 API 终结点是为 MongoDB Cloud 服务创建统一访问权限过程中的一个步骤。GCP 服务帐号访问无需执行此操作。
角色要求
- 项目所有者
PATCH /API/Atlas/v1.0/groups/{groupId}/cloudProviderAccess/{roleId}
curl \
--request PATCH 'https://cloud.mongodb.com/api/atlas/v1.0/groups/32b6e34b3d91647abb20e7b8/cloudProviderAccess/{roleId}' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"providerName": "AWS",
"iamAssumedRoleArn": "arn:aws:iam::123456789012:root"
}'
请求示例
AWS
{
"providerName": "AWS",
"iamAssumedRoleArn": "arn:aws:iam::123456789012:root"
}
{
"providerName": "AZURE",
"atlasAzureAppId": "string",
"servicePrincipalId": "string",
"tenantId": "string"
}
{
"providerName": "GCP"
}
响应示例 (200)
AWS
AWS
{
"atlasAWSAccountArn": "arn:aws:iam::772401394250:role/my-test-aws-role",
"atlasAssumedRoleExternalId": "feb2dfc7-f760-4288-a403-01c7c2345005",
"authorizedDate": "2024-05-30T14:12:00Z",
"createdDate": "2024-05-30T14:11:00Z",
"featureUsages": [],
"iamAssumedRoleArn": "arn:aws:iam::123456789012:root",
"providerName": "AWS",
"roleId": "32b6e34b3d91647abb20e7b8"
}
AZURE
{
"_id": "32b6e34b3d91647abb20e7b8",
"atlasAzureAppId": "da5dd062-f3ca-4cb5-b86a-05f82203ab67",
"createdDate": "2024-05-30T14:11:00Z",
"featureUsages": [],
"lastUpdatedDate": "2024-05-30T14:12:00Z",
"providerName": "AZURE",
"servicePrincipalId": "ec8e7844-912d-4869-86e9-6d0dfca4b8af",
"tenantId": "4297fc77-1592-4de8-a6d5-a8c32401df87"
}
GCP
{
"createdDate": "2024-05-30T14:11:00Z",
"featureUsages": [],
"gcpServiceAccountForAtlas": "mongodb-atlas-1234567890123456@p-111111111111111111111111.iam.gserviceaccount.com",
"providerName": "GCP",
"roleId": "32b6e34b3d91647abb20e7b8",
"status": "COMPLETE"
}
响应示例 (400)
{
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"error": 400,
"errorCode": "VALIDATION_ERROR",
"reason": "Bad Request"
}
响应示例 (401)
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 401,
"errorCode": "NOT_ORG_GROUP_CREATOR",
"reason": "Unauthorized"
}
响应示例 (403)
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 403,
"errorCode": "CANNOT_CHANGE_GROUP_NAME",
"reason": "Forbidden"
}
响应示例 (404)
{
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"error": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"reason": "Not Found"
}
响应示例 (409)
{
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot delete organization link while there is active migration in following project ids: 60c4fd418ebe251047c50554",
"error": 409,
"errorCode": "CANNOT_DELETE_ORG_ACTIVE_LIVE_MIGRATION_ATLAS_ORG_LINK",
"reason": "Conflict"
}
响应示例 (500)
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 500,
"errorCode": "UNEXPECTED_ERROR",
"reason": "Internal Server Error"
}