为指定的云提供商创建一个访问权限角色。某些MongoDB Cloud 功能使用这些云提供商访问权限角色进行身份验证。对于GCP提供商,如果尚未预配项目文件夹, Atlas现在将异步创建角色。将返回状态为 IN_PROGRESS 的中间角色,并预配最终的服务帐户。GCP项目设立完成后,后续请求将同步创建服务帐号。
角色要求
- 项目所有者
路径参数
-
用于标识项目的唯一 24-十六进制数字字符串。 使用 /groups 端点检索身份验证的用户有权访问权限的所有项目。
注意:群组和项目是同义词。您的群组 ID 与项目 ID 相同。对于现有群组,群组/项目 ID 保持不变。资源和相应的端点使用“群组”一词。
格式应符合以下模式:
^([a-f0-9]{24})$。
查询参数
-
指示应用程序是否将响应包装在
envelopeJSON 对象中的标志。某些 API 客户端无法访问 HTTP 响应标头或状态代码。要修复此问题,请在查询中设置 Envelope=true。返回结果列表的端点将结果对象用作 envelope。应用程序将状态参数添加到响应正文中。默认值为
false。 -
指示响应正文是否应采用 prettyprint 格式的标记。
默认值为
false。Prettyprint
POST /API/Atlas/v1.0/groups/{groupId}/cloudProviderAccess
curl \
--request POST 'https://cloud.mongodb.com/api/atlas/v1.0/groups/32b6e34b3d91647abb20e7b8/cloudProviderAccess' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"providerName":"AWS"}'
请求示例
AWS
{
"providerName": "AWS"
}
{
"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"
}
响应示例 (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"
}
响应示例 (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"
}