Skip to content

create_data_grant async

create_data_grant(
    name: DataGrantName,
    grant_distribution_scope: GrantDistributionScope,
    receiver_principal: ReceiverPrincipal,
    source_data_set_id: Id,
    *,
    config_overrides: Optional[AsyncDataExchangeClientConfig] = None,
    ends_at: Optional[Timestamp] = None,
    description: Optional[Description] = None,
    tags: Optional[MapOf__string] = None,
) -> CreateDataGrantResponse

This operation creates a data grant.

Parameters:

  • name (DataGrantName) –

    The name of the data grant.

  • grant_distribution_scope (GrantDistributionScope) –

    The distribution scope of the data grant.

  • receiver_principal (ReceiverPrincipal) –

    The Amazon Web Services account ID of the data grant receiver.

  • source_data_set_id (Id) –

    The ID of the data set used to create the data grant.

  • ends_at (Optional[Timestamp], default: None ) –

    The timestamp of when access to the associated data set ends.

  • description (Optional[Description], default: None ) –

    The description of the data grant.

  • tags (Optional[MapOf__string], default: None ) –

    The tags to add to the data grant. A tag is a key-value pair.

Raises:

Source code in docs_src/capo_dataexchange/_services/async_data_exchange.py
async def create_data_grant(
    self,
    name: "capo_dataexchange.types.data_grant_name.DataGrantName",
    grant_distribution_scope: "capo_dataexchange.types.grant_distribution_scope.GrantDistributionScope",
    receiver_principal: "capo_dataexchange.types.receiver_principal.ReceiverPrincipal",
    source_data_set_id: "capo_dataexchange.types.id.Id",
    *,
    config_overrides: Optional[AsyncDataExchangeClientConfig] = None,
    ends_at: Optional["capo_dataexchange.types.timestamp.Timestamp"] = None,
    description: Optional["capo_dataexchange.types.description.Description"] = None,
    tags: Optional["capo_dataexchange.types.map_of__string.MapOf__string"] = None,
) -> "capo_dataexchange.types.create_data_grant_response.CreateDataGrantResponse":
    """<p>This operation creates a data grant.</p>

    Args:
        name: <p>The name of the data grant.</p>
        grant_distribution_scope: <p>The distribution scope of the data grant.</p>
        receiver_principal: <p>The Amazon Web Services account ID of the data grant receiver.</p>
        source_data_set_id: <p>The ID of the data set used to create the data grant.</p>
        ends_at: <p>The timestamp of when access to the associated data set ends.</p>
        description: <p>The description of the data grant.</p>
        tags: <p>The tags to add to the data grant. A tag is a key-value pair.</p>

    Raises:
        capo_dataexchange.errors.access_denied_exception.AccessDeniedException: <p>Access to the resource is denied.</p>
        capo_dataexchange.errors.internal_server_exception.InternalServerException: <p>An exception occurred with the service.</p>
        capo_dataexchange.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource couldn't be found.</p>
        capo_dataexchange.errors.service_limit_exceeded_exception.ServiceLimitExceededException: <p>The request has exceeded the quotas imposed by the service.</p>
        capo_dataexchange.errors.throttling_exception.ThrottlingException: <p>The limit on the number of requests per second was exceeded.</p>
        capo_dataexchange.errors.validation_exception.ValidationException: <p>The request was invalid.</p>
        capo_dataexchange.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_dataexchange.types.create_data_grant_request.CreateDataGrantRequest]",
    ) -> AsyncOperationResponse[
        "capo_dataexchange.types.create_data_grant_response.CreateDataGrantResponse"
    ]:
        import capo_dataexchange._operations.data_exchange.create_data_grant

        (
            output,
            http_response,
        ) = await capo_dataexchange._operations.data_exchange.create_data_grant.async_create_data_grant(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDataGrant")
    )
    input_: capo_dataexchange.types.create_data_grant_request.CreateDataGrantRequest = {
        "name": name,
        "grant_distribution_scope": grant_distribution_scope,
        "receiver_principal": receiver_principal,
        "source_data_set_id": source_data_set_id,
    }
    if ends_at is not None:
        input_["ends_at"] = ends_at
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags

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