Skip to content

register_resource async

register_resource(
    resource_arn: ResourceArnString,
    *,
    config_overrides: Optional[AsyncLakeFormationClientConfig] = None,
    use_service_linked_role: Optional[NullableBoolean] = None,
    role_arn: Optional[IAMRoleArn] = None,
    with_federation: Optional[NullableBoolean] = None,
    hybrid_access_enabled: Optional[NullableBoolean] = None,
    with_privileged_access: Optional[Boolean] = None,
    expected_resource_owner_account: Optional[AccountIdString] = None,
) -> RegisterResourceResponse

Registers the resource as managed by the Data Catalog.

To add or update data, Lake Formation needs read/write access to the chosen data location. Choose a role that you know has permission to do this, or choose the AWSServiceRoleForLakeFormationDataAccess service-linked role. When you register the first Amazon S3 path, the service-linked role and a new inline policy are created on your behalf. Lake Formation adds the first path to the inline policy and attaches it to the service-linked role. When you register subsequent paths, Lake Formation adds the path to the existing policy.

The following request registers a new location and gives Lake Formation permission to use the service-linked role to access that location.

ResourceArn = arn:aws:s3:::my-bucket/ UseServiceLinkedRole = true

If UseServiceLinkedRole is not set to true, you must provide or set the RoleArn:

arn:aws:iam::12345:role/my-data-access-role

Parameters:

  • resource_arn (ResourceArnString) –

    The Amazon Resource Name (ARN) of the resource that you want to register.

  • use_service_linked_role (Optional[NullableBoolean], default: None ) –

    Designates an Identity and Access Management (IAM) service-linked role by registering this role with the Data Catalog. A service-linked role is a unique type of IAM role that is linked directly to Lake Formation.

    For more information, see Using Service-Linked Roles for Lake Formation.

  • role_arn (Optional[IAMRoleArn], default: None ) –

    The identifier for the role that registers the resource.

  • with_federation (Optional[NullableBoolean], default: None ) –

    Whether or not the resource is a federated resource.

  • hybrid_access_enabled (Optional[NullableBoolean], default: None ) –

    Specifies whether the data access of tables pointing to the location can be managed by both Lake Formation permissions as well as Amazon S3 bucket policies.

  • with_privileged_access (Optional[Boolean], default: None ) –

    Grants the calling principal the permissions to perform all supported Lake Formation operations on the registered data location.

  • expected_resource_owner_account (Optional[AccountIdString], default: None ) –

    The Amazon Web Services account that owns the Glue tables associated with specific Amazon S3 locations.

Raises:

Source code in docs_src/capo_lakeformation/_services/async_lake_formation.py
async def register_resource(
    self,
    resource_arn: "capo_lakeformation.types.resource_arn_string.ResourceArnString",
    *,
    config_overrides: Optional[AsyncLakeFormationClientConfig] = None,
    use_service_linked_role: Optional[
        "capo_lakeformation.types.nullable_boolean.NullableBoolean"
    ] = None,
    role_arn: Optional["capo_lakeformation.types.iam_role_arn.IAMRoleArn"] = None,
    with_federation: Optional[
        "capo_lakeformation.types.nullable_boolean.NullableBoolean"
    ] = None,
    hybrid_access_enabled: Optional[
        "capo_lakeformation.types.nullable_boolean.NullableBoolean"
    ] = None,
    with_privileged_access: Optional[
        "capo_lakeformation.types.boolean.Boolean"
    ] = None,
    expected_resource_owner_account: Optional[
        "capo_lakeformation.types.account_id_string.AccountIdString"
    ] = None,
) -> "capo_lakeformation.types.register_resource_response.RegisterResourceResponse":
    """<p>Registers the resource as managed by the Data Catalog.</p> <p>To add or update data, Lake Formation needs read/write access to the chosen data location. Choose a role that you know has permission to do this, or choose the AWSServiceRoleForLakeFormationDataAccess service-linked role. When you register the first Amazon S3 path, the service-linked role and a new inline policy are created on your behalf. Lake Formation adds the first path to the inline policy and attaches it to the service-linked role. When you register subsequent paths, Lake Formation adds the path to the existing policy.</p> <p>The following request registers a new location and gives Lake Formation permission to use the service-linked role to access that location.</p> <p> <code>ResourceArn = arn:aws:s3:::my-bucket/ UseServiceLinkedRole = true</code> </p> <p>If <code>UseServiceLinkedRole</code> is not set to true, you must provide or set the <code>RoleArn</code>:</p> <p> <code>arn:aws:iam::12345:role/my-data-access-role</code> </p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource that you want to register.</p>
        use_service_linked_role: <p>Designates an Identity and Access Management (IAM) service-linked role by registering this role with the Data Catalog. A service-linked role is a unique type of IAM role that is linked directly to Lake Formation.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/lake-formation/latest/dg/service-linked-roles.html">Using Service-Linked Roles for Lake Formation</a>.</p>
        role_arn: <p>The identifier for the role that registers the resource.</p>
        with_federation: <p>Whether or not the resource is a federated resource.</p>
        hybrid_access_enabled: <p> Specifies whether the data access of tables pointing to the location can be managed by both Lake Formation permissions as well as Amazon S3 bucket policies. </p>
        with_privileged_access: <p>Grants the calling principal the permissions to perform all supported Lake Formation operations on the registered data location. </p>
        expected_resource_owner_account: <p>The Amazon Web Services account that owns the Glue tables associated with specific Amazon S3 locations. </p>

    Raises:
        capo_lakeformation.errors.access_denied_exception.AccessDeniedException: <p>Access to a resource was denied.</p>
        capo_lakeformation.errors.already_exists_exception.AlreadyExistsException: <p>A resource to be created or added already exists.</p>
        capo_lakeformation.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist.</p>
        capo_lakeformation.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_lakeformation.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_lakeformation.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_lakeformation.errors.resource_number_limit_exceeded_exception.ResourceNumberLimitExceededException: <p>A resource numerical limit was exceeded.</p>
        capo_lakeformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lakeformation.types.register_resource_request.RegisterResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_lakeformation.types.register_resource_response.RegisterResourceResponse"
    ]:
        import capo_lakeformation._operations.aws_lake_formation.register_resource

        (
            output,
            http_response,
        ) = await capo_lakeformation._operations.aws_lake_formation.register_resource.async_register_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RegisterResource")
    )
    input_: capo_lakeformation.types.register_resource_request.RegisterResourceRequest = {
        "resource_arn": resource_arn
    }
    if use_service_linked_role is not None:
        input_["use_service_linked_role"] = use_service_linked_role
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if with_federation is not None:
        input_["with_federation"] = with_federation
    if hybrid_access_enabled is not None:
        input_["hybrid_access_enabled"] = hybrid_access_enabled
    if with_privileged_access is not None:
        input_["with_privileged_access"] = with_privileged_access
    if expected_resource_owner_account is not None:
        input_["expected_resource_owner_account"] = expected_resource_owner_account

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output