create_metric
¶
create_metric(
app_id: AppId,
name: MetricDisplayName,
description: MetricDescription,
event_type: SourceEventType,
unit_name: UnitName,
definition: MetricDefinition,
*,
config_overrides: Optional[AppMonetizationClientConfig] = None,
client_token: Optional[ClientToken] = None,
tags: Optional[TagMap] = None,
) -> CreateMetricResponse
Creates a usage metric definition for an app. A metric beyond the Metrics per app quota is refused with ServiceQuotaExceededException.
Parameters:
-
app_id(AppId) –The ID of the app the metric belongs to.
-
name(MetricDisplayName) –A human-readable display name for the metric (for example,
Riddles Solved). -
description(MetricDescription) –A description of what the metric measures.
-
event_type(SourceEventType) –The event type this metric aggregates. Must match the eventType sent on PutEvent.
-
unit_name(UnitName) –The unit of measure for the metric (for example, "requests" or "tokens").
-
definition(MetricDefinition) –The aggregation definition: filters, aggregation function, grouping, and period.
-
client_token(Optional[ClientToken], default:None) –A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.
-
tags(Optional[TagMap], default:None) –Optional tags to add to the metric when it is created. Tagging on create also requires permission for appmonetization:TagResource.
Raises:
-
AccessDeniedException–The caller does not have sufficient permission to perform this action.
-
ConflictException–The request conflicts with the current state of the resource, such as a duplicate identifier or a version mismatch. Retrieve the current state of the resource and retry the request.
-
IdempotencyConflictException–The clientToken was reused with a request that differs from the original request. Retry the operation with a new clientToken.
-
InternalServerException–An unexpected error occurred while processing the request.
-
InvalidConfigurationException–The requested configuration is not valid.
-
ResourceNotFoundException–The referenced resource does not exist.
-
RevisionConflictException–The request's revision does not match the resource's current revision. Retry with the current revision.
-
ServiceQuotaExceededException–The request would cause a service quota to be exceeded.
-
ThrottlingException–The request was denied due to request throttling.
-
ValidationException–The request failed input validation.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_appmonetization/_services/app_monetization.py
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | |