1명의 MongoDB 클라우드 사용자 생성
더 이상 사용되지 않습니다.
하나의 MongoDB Cloud 사용자 계정을 생성합니다. MongoDB Cloud 사용자 계정은 MongoDB Cloud 애플리케이션에 대한 액세스 권한만 부여합니다. 데이터베이스 액세스 권한을 부여하려면 데이터베이스 사용자를 만듭니다. MongoDB Cloud는 지정한 사용자에게 프로젝트에 참여하도록 초대하는 이메일을 보냅니다. 초대를 받은 사용자는 초대를 수락할 때까지 프로젝트에 액세스할 수 없습니다. 초대는 30일 후에 만료됩니다.
MongoDB Cloud는 MongoDB Cloud 사용자 멤버십을 팀당 최대 250명의 MongoDB Cloud 사용자로 제한합니다. MongoDB Cloud는 MongoDB 클라우드 사용자 멤버십을 프로젝트당 500명의 MongoDB 클라우드 사용자와 조직당 500명의 MongoDB 클라우드 사용자로 제한합니다. 여기에는 조직 내 모든 프로젝트의 통합 멤버십이 포함됩니다. 작업이 이러한 제한을 초과하면 MongoDB Cloud에서 오류를 발생시킵니다. 예를 들어, 5개의 프로젝트가 있는 조직이 있고 각 프로젝트에 100명의 MongoDB Cloud 사용자가 있으며 각 MongoDB Cloud 사용자가 하나의 프로젝트에만 속해 있는 경우, 먼저 조직에서 기존 MongoDB Cloud 사용자를 제거하지 않고는 이 조직에 어떤 MongoDB Cloud 사용자도 추가할 수 없습니다.
이 리소스를 사용하기 위해 요청하는 서비스 계정 또는 API 키는 어떤 역할이든 가질 수 있습니다.
쿼리 매개변수
-
애플리케이션이 응답을
envelope
JSON 객체로 래핑할지 여부를 나타내는 플래그입니다. 일부 API 클라이언트는 HTTP 응답 헤더 또는 상태 코드에 액세스할 수 없습니다. 이 문제를 해결하려면 쿼리에서 envelope=true를 설정합니다. 결과 목록을 반환하는 엔드포인트는 결과 객체를 엔벨로프로 사용합니다. 애플리케이션은 응답 본문에 상태 매개변수를 추가합니다.기본값은
false
입니다. -
응답 본문이 프리티프린트 형식이어야 하는지 여부를 나타내는 플래그입니다.
기본값은
false
입니다.Prettyprint
body
필수 사항
MongoDB 클라우드 사용자 계정을 생성합니다.
-
MongoDB Cloud 사용자의 지리적 위치를 식별하는 두 개의 알파벳 문자입니다. 이 매개변수는 ISO 3166-1a2 코드 형식을 사용합니다.
형식은
^([A-Z]{2})$
패턴 과 일치해야 합니다. -
MongoDB Cloud 사용자의 이름입니다.
-
MongoDB Cloud 사용자의 성입니다.
-
MongoDB Cloud 사용자의 휴대폰 번호입니다.
형식은
(?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})$
패턴 과 일치해야 합니다. -
비밀번호는 MongoDB 클라우드에 로그인할 사용자 이름으로 적용됩니다. MongoDB Cloud는 새로운 MongoDB Cloud 사용자 생성에 대한 응답을 제외하고 이 매개변수를 반환하지 않습니다. MongoDB Cloud 콘솔에서 비밀번호가 설정된 후에는 MongoDB Cloud 사용자만 비밀번호를 업데이트할 수 있습니다.
최소 길이는
8
입니다. -
MongoDB Cloud 사용자의 역할과 해당 역할이 적용되는 해당 조직 또는 프로젝트를 표시하는 객체 목록입니다. 하나의 역할이 하나의 조직 또는 하나의 프로젝트에 적용될 수는 있지만 둘 다 적용될 수는 없습니다.
MongoDB Cloud 사용자의 역할과 해당 역할 적용되는 해당 조직 또는 프로젝트 . 각 역할 하나의 조직 또는 하나의 프로젝트 에 적용 할 수 있지만 둘 다 적용할 수는 없습니다.
-
MongoDB 클라우드 사용자의 사용자 이름을 나타내는 이메일 주소입니다.
atlas api mongoDbCloudUsers createUser --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20241113001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.CreateUserApiParams{}
sdkResp, httpResp, err := client.MongoDBCloudUsersApi.
CreateUserWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2024-11-13+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/users" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2024-11-13+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/users" \
-d '{ <Payload> }'
{
"country": "string",
"firstName": "string",
"lastName": "string",
"mobileNumber": "string",
"password": "string",
"roles": [
{
"groupId": "32b6e34b3d91647abb20e7b8",
"orgId": "32b6e34b3d91647abb20e7b8",
"roleName": "ORG_MEMBER"
}
],
"username": "hello@example.com"
}
{
"country": "string",
"createdAt": "2025-05-04T09:42:00Z",
"emailAddress": "hello@example.com",
"firstName": "string",
"id": "32b6e34b3d91647abb20e7b8",
"lastAuth": "2025-05-04T09:42:00Z",
"lastName": "string",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"mobileNumber": "string",
"password": "string",
"roles": [
{
"groupId": "32b6e34b3d91647abb20e7b8",
"orgId": "32b6e34b3d91647abb20e7b8",
"roleName": "ORG_MEMBER"
}
],
"teamIds": [
"32b6e34b3d91647abb20e7b8"
],
"username": "hello@example.com"
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}