AWS Образование озера: grant_permissions: Неизвестный параметр в Resource.Table: «TableWildcard» - PullRequest
2 голосов
/ 06 августа 2020

Попытка предоставить права доступа к озеру с помощью лямбда-функции. (Python 3.8) Насколько я понимаю, у меня есть код согласно документации. Тем не менее, мы столкнулись с массой бессмысленных ошибок о неверных параметрах. Может быть, мне просто нужен оптик? Или это какой-то нюанс или в какую сторону сегодня дует ветер с Амазонки?

import boto3
import json
from botocore.exceptions import ClientError

def main(event,context):

    client = boto3.client('lakeformation')

    response = client.grant_permissions(
        Principal={
            'DataLakePrincipalIdentifier': 'arn:aws:iam::123456789012:role/myRole'
        },
        Resource={
            'Table': {
                'DatabaseName': 'myDatabase',
                'TableWildcard': {}
            },
        },
        Permissions=['ALL'],
        PermissionsWithGrantOption=['ALL']
    )
       

============================= ================================================== =========

[ОШИБКА] ParamValidationError: Ошибка проверки параметра: Отсутствует обязательный параметр в Resource.Table: «Имя» Неизвестный параметр в Resource.Table: «TableWildcard», должен быть одним из: DatabaseName, Name Traceback (последний вызов последним): File "/var/task/main.py", строка 10, в основном response = client.grant_permissions (File "/var/runtime/botocore/client.py ", строка 316, в _api_call вернуть self._make_api_call (имя_операции, kwargs) Файл" /var/runtime/botocore/client.py ", строка 607, в _make_api_call request_dict = self._convert_to_request_dict (File" / var / runtime / botocore client.py ", строка 655, в _convert_to_request_dict request_dict = self._serializer.serialize_to_request (Файл" /var/runtime/botocore/validate.py ", строка 297, в serialize_to_request поднять ParamValidationError (report = report ())

1 Ответ

1 голос
/ 06 августа 2020

Я немного изучил проблему. И ошибка связана с тем, что для лямбда-выражения TableResoures определяется (обратите внимание на отсутствующий TableWildcard в лямбда-выражении):

    "TableResource":{
      "type":"structure",
      "required":[
        "DatabaseName",
        "Name"
      ],
      "members":{
        "DatabaseName":{
          "shape":"NameString",
          "documentation":"<p>The name of the database for the table. Unique to a Data Catalog. A database is a set of associated table definitions organized into a logical group. You can Grant and Revoke database privileges to a principal. </p>"
        },
        "Name":{
          "shape":"NameString",
          "documentation":"<p>The name of the table.</p>"
        }
      },
      "documentation":"<p>A structure for the table object. A table is a metadata definition that represents your data. You can Grant and Revoke table privileges to a principal. </p>"
    }

Напротив, последняя версия на github имеет :

    "TableResource":{
      "type":"structure",
      "required":["DatabaseName"],
      "members":{
        "CatalogId":{
          "shape":"CatalogIdString",
          "documentation":"<p>The identifier for the Data Catalog. By default, it is the account ID of the caller.</p>"
        },
        "DatabaseName":{
          "shape":"NameString",
          "documentation":"<p>The name of the database for the table. Unique to a Data Catalog. A database is a set of associated table definitions organized into a logical group. You can Grant and Revoke database privileges to a principal. </p>"
        },
        "Name":{
          "shape":"NameString",
          "documentation":"<p>The name of the table.</p>"
        },
        "TableWildcard":{
          "shape":"TableWildcard",
          "documentation":"<p>A wildcard object representing every table under a database.</p> <p>At least one of <code>TableResource$Name</code> or <code>TableResource$TableWildcard</code> is required.</p>"
        }
      }

Мне кажется, это какая-то ошибка.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...