Skip to content

grant_permissions

grant_permissions(
    principal: DataLakePrincipal,
    resource: Resource,
    permissions: PermissionList,
    *,
    config_overrides: Optional[LakeFormationClientConfig] = None,
    catalog_id: Optional[CatalogIdString] = None,
    condition: Optional[Condition] = None,
    permissions_with_grant_option: Optional[PermissionList] = None,
) -> GrantPermissionsResponse

Grants permissions to the principal to access metadata in the Data Catalog and data organized in underlying data storage such as Amazon S3.

For information about permissions, see Security and Access Control to Metadata and Data.

Parameters:

  • catalog_id (Optional[CatalogIdString], default: None ) –

    The identifier for the Data Catalog. By default, the account ID. The Data Catalog is the persistent metadata store. It contains database definitions, table definitions, and other control information to manage your Lake Formation environment.

  • principal (DataLakePrincipal) –

    The principal to be granted the permissions on the resource. Supported principals are IAM users or IAM roles, and they are defined by their principal type and their ARN.

    Note that if you define a resource with a particular ARN, then later delete, and recreate a resource with that same ARN, the resource maintains the permissions already granted.

  • resource (Resource) –

    The resource to which permissions are to be granted. Resources in Lake Formation are the Data Catalog, databases, and tables.

  • permissions (PermissionList) –

    The permissions granted to the principal on the resource. Lake Formation defines privileges to grant and revoke access to metadata in the Data Catalog and data organized in underlying data storage such as Amazon S3. Lake Formation requires that each principal be authorized to perform a specific task on Lake Formation resources.

  • permissions_with_grant_option (Optional[PermissionList], default: None ) –

    Indicates a list of the granted permissions that the principal may pass to other users. These permissions may only be a subset of the permissions granted in the Privileges.

Raises:

Source code in docs_src/capo_lakeformation/_services/lake_formation.py
def grant_permissions(
    self,
    principal: "capo_lakeformation.types.data_lake_principal.DataLakePrincipal",
    resource: "capo_lakeformation.types.resource.Resource",
    permissions: "capo_lakeformation.types.permission_list.PermissionList",
    *,
    config_overrides: Optional[LakeFormationClientConfig] = None,
    catalog_id: Optional[
        "capo_lakeformation.types.catalog_id_string.CatalogIdString"
    ] = None,
    condition: Optional["capo_lakeformation.types.condition.Condition"] = None,
    permissions_with_grant_option: Optional[
        "capo_lakeformation.types.permission_list.PermissionList"
    ] = None,
) -> "capo_lakeformation.types.grant_permissions_response.GrantPermissionsResponse":
    """<p>Grants permissions to the principal to access metadata in the Data Catalog and data organized in underlying data storage such as Amazon S3.</p> <p>For information about permissions, see <a href="https://docs.aws.amazon.com/lake-formation/latest/dg/security-data-access.html">Security and Access Control to Metadata and Data</a>.</p>

    Args:
        catalog_id: <p>The identifier for the Data Catalog. By default, the account ID. The Data Catalog is the persistent metadata store. It contains database definitions, table definitions, and other control information to manage your Lake Formation environment. </p>
        principal: <p>The principal to be granted the permissions on the resource. Supported principals are IAM users or IAM roles, and they are defined by their principal type and their ARN.</p> <p>Note that if you define a resource with a particular ARN, then later delete, and recreate a resource with that same ARN, the resource maintains the permissions already granted. </p>
        resource: <p>The resource to which permissions are to be granted. Resources in Lake Formation are the Data Catalog, databases, and tables.</p>
        permissions: <p>The permissions granted to the principal on the resource. Lake Formation defines privileges to grant and revoke access to metadata in the Data Catalog and data organized in underlying data storage such as Amazon S3. Lake Formation requires that each principal be authorized to perform a specific task on Lake Formation resources. </p>
        permissions_with_grant_option: <p>Indicates a list of the granted permissions that the principal may pass to other users. These permissions may only be a subset of the permissions granted in the <code>Privileges</code>.</p>

    Raises:
        capo_lakeformation.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Two processes are trying to modify a resource simultaneously.</p>
        capo_lakeformation.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist.</p>
        capo_lakeformation.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_lakeformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lakeformation.types.grant_permissions_request.GrantPermissionsRequest]",
    ) -> OperationResponse[
        "capo_lakeformation.types.grant_permissions_response.GrantPermissionsResponse"
    ]:
        import capo_lakeformation._operations.aws_lake_formation.grant_permissions

        output, http_response = (
            capo_lakeformation._operations.aws_lake_formation.grant_permissions.grant_permissions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GrantPermissions")
    )
    input_: capo_lakeformation.types.grant_permissions_request.GrantPermissionsRequest = {
        "principal": principal,
        "resource": resource,
        "permissions": permissions,
    }
    if catalog_id is not None:
        input_["catalog_id"] = catalog_id
    if condition is not None:
        input_["condition"] = condition
    if permissions_with_grant_option is not None:
        input_["permissions_with_grant_option"] = permissions_with_grant_option

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output