我收到aws这样的回复

{
  "Owner": {
    "DisplayName": "2414218.aws",
    "ID": "xxxxxxxx"
  },
  "Grants": [
    {
      "Grantee": {
        "DisplayName": "2414218.aws",
        "ID": "yyyyyyyyyy"
      },
      "Permission": "FULL_CONTROL"
    },
    {
      "Grantee": {
        "URI": "http://acs.amazonaws.com/groups/global/AllUsers"
      },
      "Permission": "READ"
    }
  ]
}

我希望更新文件以便删除AllUsers(get object acl应该如下所示)
{
  "Owner": {
    "DisplayName": "2414218.aws",
    "ID": "xxxxxxxx"
  },
  "Grants": [
    {
      "Grantee": {
        "DisplayName": "2414218.aws",
        "ID": "yyyyyyyyyy"
      },
      "Permission": "FULL_CONTROL"
    }
  ]
}

如果我不知道还有什么其他的受赠人,我该怎么做呢?当我看到http://acs.amazonaws.com/groups/global/AllUsers
我正在使用aws s3api get-object-acl --bucket mhe-deployments-prod --key $keyFile | jq '.'查找策略

最佳答案

下面是一个jq筛选器,它将删除.Grantee.URI为“http://acs.amazonaws.com/groups/global/AllUsers”的所有.grantes数组元素:

.Grants |= map( select(.Grantee.URI != "http://acs.amazonaws.com/groups/global/AllUsers") )

输出:按要求

关于bash - 从bash中的ACL策略中删除AllUsers,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36044151/

10-11 07:55