从单个项目 IP 访问列表中删除单个条目
从指定项目的 IP 访问列表中删除一个访问列表条目。项目 IP 访问列表中的每个条目都包含一个 IP 地址、一个 CIDR 表示的 IP 地址区块或一个 AWS 安全群组 ID。MongoDB Cloud 仅允许客户端从列入项目 IP 访问列表中的 IP 地址连接到集群。要使用此资源,请求的服务账户或 API 密钥必须具有“项目所有者”角色。此资源将替换白名单资源。MongoDB Cloud 于 2021 年 7 月删除了白名单。更新您的应用程序以使用此新资源。/groups/{GROUP-ID}/accessList
端点管理数据库 IP 访问列表。此端点与管理 MongoDB Cloud 组织访问列表的 orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist
端点不同。
路径参数
-
用于标识项目的唯一 24-十六进制数字字符串。 使用 /groups 端点检索身份验证的用户有权访问权限的所有项目。
注意:群组和项目是同义词。您的群组 ID 与项目 ID 相同。对于现有群组,群组/项目 ID 保持不变。资源和相应的端点使用“群组”一词。
格式应符合以下模式:
^([a-f0-9]{24})$
。 -
您要从项目的 IP 访问列表中删除的访问列表条目。该值可以使用以下值之一:一个 AWS 安全组 ID、一个 IP 地址或一个 CIDR 地址区块。对于使用子网掩码的 CIDR 区块,将正斜杠 (
/
) 替换为其 URL 编码值 (%2F
)。当您从 IP 访问列表中删除条目时,被删除地址的现有连接可能会在不同时间内保持打开状态。MongoDB Cloud 关闭连接所需的时间取决于多个因素,包括:- 您的应用程序是如何建立连接的,
- MongoDB Cloud 或使用该地址的驱动程序的行为方式,以及
- 连接使用哪种协议(如 TCP 或 UDP)。
格式应符合以下模式:
^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$
。
查询参数
-
指示应用程序是否将响应包装在
envelope
JSON 对象中的标志。某些 API 客户端无法访问 HTTP 响应标头或状态代码。要修复此问题,请在查询中设置 Envelope=true。返回结果列表的端点将结果对象用作 envelope。应用程序将状态参数添加到响应正文中。默认值为
false
。 -
指示响应正文是否应采用 prettyprint 格式的标记。
默认值为
false
。Prettyprint
atlas api projectIpAccessList deleteGroupAccessListEntry --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20230101001/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.DeleteGroupAccessListEntryApiParams{}
httpResp, err := client.ProjectIPAccessListApi.
DeleteGroupAccessListEntryWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2023-01-01+json" \
-X DELETE "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/accessList/{entryValue}"
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2023-01-01+json" \
-X DELETE "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/accessList/{entryValue}"
{
"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"
}