AWS Lake Formation: grant_permissions: Неизвестный параметр в Resource.Table: "TableWildcard"

Попытка предоставить права доступа к озеру с помощью лямбда-функции. (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']
    )
       

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

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

1 ответ

Решение

Я немного исследовал проблему. И ошибка заключается в том, что в лямбде определение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>"
        }
      }

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

Другие вопросы по тегам