Creates an event tracker that you use when adding event data to a specified dataset group using the PutEvents API.
Only one event tracker can be associated with a dataset group. You will get an error if you call CreateEventTracker using the same dataset group as an existing event tracker.
When you create an event tracker, the response includes a tracking ID, which you pass as a parameter when you use the PutEvents operation. Amazon Personalize then appends the event data to the Item interactions dataset of the dataset group you specify in your event tracker.
The event tracker can be in one of the following states:
To get the status of the event tracker, call DescribeEventTracker.
The event tracker must be in the ACTIVE state before using the tracking ID.
Related APIs
Parameters:
-
name
(Name)
–
The name for the event tracker.
-
dataset_group_arn
(Arn)
–
The Amazon Resource Name (ARN) of the dataset group that receives the event data.
-
tags
(Optional[Tags], default:
None
)
–
A list of tags to apply to the event tracker.
Raises:
Source code in docs_src/capo_personalize/_services/personalize.py
| def create_event_tracker(
self,
name: "capo_personalize.types.name.Name",
dataset_group_arn: "capo_personalize.types.arn.Arn",
*,
config_overrides: Optional[PersonalizeClientConfig] = None,
tags: Optional["capo_personalize.types.tags.Tags"] = None,
) -> "capo_personalize.types.create_event_tracker_response.CreateEventTrackerResponse":
"""<p>Creates an event tracker that you use when adding event data to a specified dataset group using the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_UBS_PutEvents.html">PutEvents</a> API.</p> <note> <p>Only one event tracker can be associated with a dataset group. You will get an error if you call <code>CreateEventTracker</code> using the same dataset group as an existing event tracker.</p> </note> <p>When you create an event tracker, the response includes a tracking ID, which you pass as a parameter when you use the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_UBS_PutEvents.html">PutEvents</a> operation. Amazon Personalize then appends the event data to the Item interactions dataset of the dataset group you specify in your event tracker. </p> <p>The event tracker can be in one of the following states:</p> <ul> <li> <p>CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED</p> </li> <li> <p>DELETE PENDING > DELETE IN_PROGRESS</p> </li> </ul> <p>To get the status of the event tracker, call <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeEventTracker.html">DescribeEventTracker</a>.</p> <note> <p>The event tracker must be in the ACTIVE state before using the tracking ID.</p> </note> <p class="title"> <b>Related APIs</b> </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_ListEventTrackers.html">ListEventTrackers</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeEventTracker.html">DescribeEventTracker</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DeleteEventTracker.html">DeleteEventTracker</a> </p> </li> </ul>
Args:
name: <p>The name for the event tracker.</p>
dataset_group_arn: <p>The Amazon Resource Name (ARN) of the dataset group that receives the event data.</p>
tags: <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the event tracker.</p>
Raises:
capo_personalize.errors.invalid_input_exception.InvalidInputException: <p>Provide a valid value for the field or parameter.</p>
capo_personalize.errors.limit_exceeded_exception.LimitExceededException: <p>The limit on the number of requests per second has been exceeded.</p>
capo_personalize.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</p>
capo_personalize.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
capo_personalize.errors.resource_not_found_exception.ResourceNotFoundException: <p>Could not find the specified resource.</p>
capo_personalize.errors.too_many_tags_exception.TooManyTagsException: <p>You have exceeded the maximum number of tags you can apply to this resource. </p>
capo_personalize.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_personalize.types.create_event_tracker_request.CreateEventTrackerRequest]",
) -> OperationResponse[
"capo_personalize.types.create_event_tracker_response.CreateEventTrackerResponse"
]:
import capo_personalize._operations.amazon_personalize.create_event_tracker
output, http_response = (
capo_personalize._operations.amazon_personalize.create_event_tracker.create_event_tracker(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_personalize.types.create_event_tracker_request.CreateEventTrackerRequest",
) -> dict[str, Any]:
import capo_personalize.types.create_event_tracker_request
return capo_personalize.types.create_event_tracker_request.redact_sensitive(
input_
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("CreateEventTracker", redact_input=_redact_input),
)
input_: capo_personalize.types.create_event_tracker_request.CreateEventTrackerRequest = {
"name": name,
"dataset_group_arn": dataset_group_arn,
}
if tags is not None:
input_["tags"] = tags
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|