amazon-ads-mcp 0.2.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. amazon_ads_mcp/__init__.py +11 -0
  2. amazon_ads_mcp/auth/__init__.py +33 -0
  3. amazon_ads_mcp/auth/base.py +211 -0
  4. amazon_ads_mcp/auth/hooks.py +172 -0
  5. amazon_ads_mcp/auth/manager.py +791 -0
  6. amazon_ads_mcp/auth/oauth_state_store.py +277 -0
  7. amazon_ads_mcp/auth/providers/__init__.py +14 -0
  8. amazon_ads_mcp/auth/providers/direct.py +393 -0
  9. amazon_ads_mcp/auth/providers/example_auth0.py.example +216 -0
  10. amazon_ads_mcp/auth/providers/openbridge.py +512 -0
  11. amazon_ads_mcp/auth/registry.py +146 -0
  12. amazon_ads_mcp/auth/secure_token_store.py +297 -0
  13. amazon_ads_mcp/auth/token_store.py +723 -0
  14. amazon_ads_mcp/config/__init__.py +5 -0
  15. amazon_ads_mcp/config/sampling.py +111 -0
  16. amazon_ads_mcp/config/settings.py +366 -0
  17. amazon_ads_mcp/exceptions.py +314 -0
  18. amazon_ads_mcp/middleware/__init__.py +11 -0
  19. amazon_ads_mcp/middleware/authentication.py +1474 -0
  20. amazon_ads_mcp/middleware/caching.py +177 -0
  21. amazon_ads_mcp/middleware/oauth.py +175 -0
  22. amazon_ads_mcp/middleware/sampling.py +112 -0
  23. amazon_ads_mcp/models/__init__.py +320 -0
  24. amazon_ads_mcp/models/amc_models.py +837 -0
  25. amazon_ads_mcp/models/api_responses.py +847 -0
  26. amazon_ads_mcp/models/base_models.py +215 -0
  27. amazon_ads_mcp/models/builtin_responses.py +496 -0
  28. amazon_ads_mcp/models/dsp_models.py +556 -0
  29. amazon_ads_mcp/models/stores_brands.py +610 -0
  30. amazon_ads_mcp/server/__init__.py +6 -0
  31. amazon_ads_mcp/server/__main__.py +6 -0
  32. amazon_ads_mcp/server/builtin_prompts.py +269 -0
  33. amazon_ads_mcp/server/builtin_tools.py +962 -0
  34. amazon_ads_mcp/server/file_routes.py +547 -0
  35. amazon_ads_mcp/server/html_templates.py +149 -0
  36. amazon_ads_mcp/server/mcp_server.py +327 -0
  37. amazon_ads_mcp/server/openapi_utils.py +158 -0
  38. amazon_ads_mcp/server/sampling_handler.py +251 -0
  39. amazon_ads_mcp/server/server_builder.py +751 -0
  40. amazon_ads_mcp/server/sidecar_loader.py +178 -0
  41. amazon_ads_mcp/server/transform_executor.py +827 -0
  42. amazon_ads_mcp/tools/__init__.py +22 -0
  43. amazon_ads_mcp/tools/cache_management.py +105 -0
  44. amazon_ads_mcp/tools/download_tools.py +267 -0
  45. amazon_ads_mcp/tools/identity.py +236 -0
  46. amazon_ads_mcp/tools/oauth.py +598 -0
  47. amazon_ads_mcp/tools/profile.py +150 -0
  48. amazon_ads_mcp/tools/profile_listing.py +285 -0
  49. amazon_ads_mcp/tools/region.py +320 -0
  50. amazon_ads_mcp/tools/region_identity.py +175 -0
  51. amazon_ads_mcp/utils/__init__.py +6 -0
  52. amazon_ads_mcp/utils/async_compat.py +215 -0
  53. amazon_ads_mcp/utils/errors.py +452 -0
  54. amazon_ads_mcp/utils/export_content_type_resolver.py +249 -0
  55. amazon_ads_mcp/utils/export_download_handler.py +579 -0
  56. amazon_ads_mcp/utils/header_resolver.py +81 -0
  57. amazon_ads_mcp/utils/http/__init__.py +56 -0
  58. amazon_ads_mcp/utils/http/circuit_breaker.py +127 -0
  59. amazon_ads_mcp/utils/http/client_manager.py +329 -0
  60. amazon_ads_mcp/utils/http/request.py +207 -0
  61. amazon_ads_mcp/utils/http/resilience.py +512 -0
  62. amazon_ads_mcp/utils/http/resilient_client.py +195 -0
  63. amazon_ads_mcp/utils/http/retry.py +76 -0
  64. amazon_ads_mcp/utils/http_client.py +873 -0
  65. amazon_ads_mcp/utils/media/__init__.py +21 -0
  66. amazon_ads_mcp/utils/media/negotiator.py +243 -0
  67. amazon_ads_mcp/utils/media/types.py +199 -0
  68. amazon_ads_mcp/utils/openapi/__init__.py +16 -0
  69. amazon_ads_mcp/utils/openapi/json.py +55 -0
  70. amazon_ads_mcp/utils/openapi/loader.py +263 -0
  71. amazon_ads_mcp/utils/openapi/refs.py +46 -0
  72. amazon_ads_mcp/utils/region_config.py +200 -0
  73. amazon_ads_mcp/utils/response_wrapper.py +171 -0
  74. amazon_ads_mcp/utils/sampling_helpers.py +156 -0
  75. amazon_ads_mcp/utils/sampling_wrapper.py +173 -0
  76. amazon_ads_mcp/utils/security.py +630 -0
  77. amazon_ads_mcp/utils/tool_naming.py +137 -0
  78. amazon_ads_mcp-0.2.7.dist-info/METADATA +664 -0
  79. amazon_ads_mcp-0.2.7.dist-info/RECORD +82 -0
  80. amazon_ads_mcp-0.2.7.dist-info/WHEEL +4 -0
  81. amazon_ads_mcp-0.2.7.dist-info/entry_points.txt +3 -0
  82. amazon_ads_mcp-0.2.7.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,837 @@
1
+ """Pydantic models for Amazon Marketing Cloud (AMC) API responses.
2
+
3
+ This module provides comprehensive type definitions for Amazon Marketing Cloud
4
+ API responses, including data clean rooms, custom queries, audiences, and
5
+ privacy-safe analytics.
6
+
7
+ The models cover all major AMC functionality including:
8
+ - Instance management and configuration
9
+ - Query execution and management
10
+ - Audience creation and management
11
+ - Data upload and processing
12
+ - Query templates and insights
13
+ - Privacy and compliance settings
14
+ - Workflow automation
15
+ """
16
+
17
+ from datetime import datetime
18
+ from enum import Enum
19
+ from typing import Any, Dict, List, Optional
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field
22
+
23
+
24
+ class AMCQueryStatus(str, Enum):
25
+ """AMC query execution status.
26
+
27
+ Represents the various states a query can be in during
28
+ execution in the Amazon Marketing Cloud.
29
+ """
30
+
31
+ PENDING = "PENDING"
32
+ RUNNING = "RUNNING"
33
+ SUCCEEDED = "SUCCEEDED"
34
+ FAILED = "FAILED"
35
+ CANCELLED = "CANCELLED"
36
+ TIMEOUT = "TIMEOUT"
37
+
38
+
39
+ class AMCQueryType(str, Enum):
40
+ """AMC query types.
41
+
42
+ Defines the different types of queries that can be
43
+ executed in Amazon Marketing Cloud.
44
+ """
45
+
46
+ SQL = "SQL"
47
+ INSTRUCTIONAL = "INSTRUCTIONAL"
48
+ TEMPLATE = "TEMPLATE"
49
+ SAVED = "SAVED"
50
+
51
+
52
+ class AMCDataSource(str, Enum):
53
+ """AMC data sources.
54
+
55
+ Lists all available data sources that can be queried
56
+ in Amazon Marketing Cloud.
57
+ """
58
+
59
+ AMAZON_ADS = "AMAZON_ADS"
60
+ AMAZON_DSP = "AMAZON_DSP"
61
+ AMAZON_ATTRIBUTION = "AMAZON_ATTRIBUTION"
62
+ RETAIL = "RETAIL"
63
+ STREAMING_TV = "STREAMING_TV"
64
+ CUSTOM_UPLOAD = "CUSTOM_UPLOAD"
65
+ FIRST_PARTY = "FIRST_PARTY"
66
+
67
+
68
+ class AMCAudienceStatus(str, Enum):
69
+ """AMC audience status.
70
+
71
+ Represents the various states an audience can be in
72
+ during creation and management.
73
+ """
74
+
75
+ ACTIVE = "ACTIVE"
76
+ PROCESSING = "PROCESSING"
77
+ FAILED = "FAILED"
78
+ EXPIRED = "EXPIRED"
79
+ DELETED = "DELETED"
80
+
81
+
82
+ class AMCPrivacyLevel(str, Enum):
83
+ """Privacy threshold levels.
84
+
85
+ Defines the different privacy protection levels available
86
+ for AMC queries and data processing.
87
+ """
88
+
89
+ STANDARD = "STANDARD"
90
+ STRICT = "STRICT"
91
+ CUSTOM = "CUSTOM"
92
+
93
+
94
+ class AMCExportFormat(str, Enum):
95
+ """Export format options.
96
+
97
+ Lists all supported export formats for AMC query results
98
+ and data downloads.
99
+ """
100
+
101
+ CSV = "CSV"
102
+ PARQUET = "PARQUET"
103
+ JSON = "JSON"
104
+ AVRO = "AVRO"
105
+
106
+
107
+ class AMCInstanceType(str, Enum):
108
+ """AMC instance types.
109
+
110
+ Defines the different types of AMC instances available
111
+ for different use cases and environments.
112
+ """
113
+
114
+ PRODUCTION = "PRODUCTION"
115
+ SANDBOX = "SANDBOX"
116
+ DEVELOPMENT = "DEVELOPMENT"
117
+
118
+
119
+ # Base AMC Model
120
+ class BaseAMCModel(BaseModel):
121
+ """Base model for AMC entities.
122
+
123
+ Provides common configuration for all AMC models including
124
+ extra field handling, alias population, and string processing.
125
+ """
126
+
127
+ model_config = ConfigDict(
128
+ extra="allow",
129
+ populate_by_name=True,
130
+ str_strip_whitespace=True,
131
+ )
132
+
133
+
134
+ # AMC Instance Models
135
+ class AMCInstance(BaseAMCModel):
136
+ """AMC instance model.
137
+
138
+ Represents an Amazon Marketing Cloud instance with all
139
+ its configuration and metadata.
140
+
141
+ :param instanceId: Unique identifier for the AMC instance
142
+ :type instanceId: str
143
+ :param instanceName: Human-readable name for the instance
144
+ :type instanceName: str
145
+ :param instanceType: Type of instance (production, sandbox, etc.)
146
+ :type instanceType: AMCInstanceType
147
+ :param region: AWS region where the instance is located
148
+ :type region: str
149
+ :param advertiserId: Associated advertiser identifier
150
+ :type advertiserId: str
151
+ :param dataSources: List of available data sources for this instance
152
+ :type dataSources: List[AMCDataSource]
153
+ :param createdAt: When the instance was created
154
+ :type createdAt: datetime
155
+ :param lastAccessedAt: When the instance was last accessed
156
+ :type lastAccessedAt: Optional[datetime]
157
+ :param settings: Additional instance configuration settings
158
+ :type settings: Dict[str, Any]
159
+ """
160
+
161
+ instanceId: str = Field(..., description="AMC instance ID")
162
+ instanceName: str = Field(..., description="Instance name")
163
+ instanceType: AMCInstanceType = Field(..., description="Instance type")
164
+ region: str = Field(..., description="AWS region")
165
+ advertiserId: str = Field(..., description="Advertiser ID")
166
+ dataSources: List[AMCDataSource] = Field(..., description="Available data sources")
167
+ createdAt: datetime = Field(..., description="Creation timestamp")
168
+ lastAccessedAt: Optional[datetime] = Field(
169
+ None, description="Last accessed timestamp"
170
+ )
171
+ settings: Dict[str, Any] = Field(
172
+ default_factory=dict, description="Instance settings"
173
+ )
174
+
175
+
176
+ class AMCInstanceListResponse(BaseAMCModel):
177
+ """Response for AMC instance list operations.
178
+
179
+ Contains a list of AMC instances with pagination support.
180
+
181
+ :param instances: List of AMC instances
182
+ :type instances: List[AMCInstance]
183
+ :param nextToken: Token for retrieving the next page of results
184
+ :type nextToken: Optional[str]
185
+ :param totalResults: Total number of instances available
186
+ :type totalResults: Optional[int]
187
+ """
188
+
189
+ instances: List[AMCInstance] = Field(default_factory=list)
190
+ nextToken: Optional[str] = Field(None)
191
+ totalResults: Optional[int] = Field(None)
192
+
193
+
194
+ # Query Models
195
+ class AMCQuery(BaseAMCModel):
196
+ """AMC query model.
197
+
198
+ Represents a saved query in Amazon Marketing Cloud with
199
+ all its metadata and configuration.
200
+
201
+ :param queryId: Unique identifier for the query
202
+ :type queryId: str
203
+ :param queryName: Human-readable name for the query
204
+ :type queryName: str
205
+ :param instanceId: AMC instance where the query is stored
206
+ :type instanceId: str
207
+ :param queryType: Type of query (SQL, template, etc.)
208
+ :type queryType: AMCQueryType
209
+ :param queryText: The actual SQL query text
210
+ :type queryText: str
211
+ :param parameters: Optional parameters for the query
212
+ :type parameters: Optional[Dict[str, Any]]
213
+ :param description: Optional description of the query
214
+ :type description: Optional[str]
215
+ :param tags: List of tags associated with the query
216
+ :type tags: List[str]
217
+ :param createdBy: User ID who created the query
218
+ :type createdBy: str
219
+ :param createdAt: When the query was created
220
+ :type createdAt: datetime
221
+ :param lastModifiedAt: When the query was last modified
222
+ :type lastModifiedAt: datetime
223
+ :param isPublic: Whether the query is publicly accessible
224
+ :type isPublic: bool
225
+ """
226
+
227
+ queryId: str = Field(..., description="Query ID")
228
+ queryName: str = Field(..., description="Query name")
229
+ instanceId: str = Field(..., description="AMC instance ID")
230
+ queryType: AMCQueryType = Field(..., description="Query type")
231
+ queryText: str = Field(..., description="SQL query text")
232
+ parameters: Optional[Dict[str, Any]] = Field(None, description="Query parameters")
233
+ description: Optional[str] = Field(None, description="Query description")
234
+ tags: List[str] = Field(default_factory=list, description="Query tags")
235
+ createdBy: str = Field(..., description="Creator user ID")
236
+ createdAt: datetime = Field(..., description="Creation timestamp")
237
+ lastModifiedAt: datetime = Field(..., description="Last modification timestamp")
238
+ isPublic: bool = Field(False, description="Is query public")
239
+
240
+
241
+ class AMCQueryExecution(BaseAMCModel):
242
+ """AMC query execution model.
243
+
244
+ Represents a single execution of an AMC query with
245
+ performance metrics and results.
246
+
247
+ :param executionId: Unique identifier for the execution
248
+ :type executionId: str
249
+ :param queryId: ID of the query that was executed
250
+ :type queryId: str
251
+ :param instanceId: AMC instance where execution occurred
252
+ :type instanceId: str
253
+ :param status: Current status of the execution
254
+ :type status: AMCQueryStatus
255
+ :param startTime: When execution began
256
+ :type startTime: datetime
257
+ :param endTime: When execution completed (if finished)
258
+ :type endTime: Optional[datetime]
259
+ :param durationSeconds: Total execution time in seconds
260
+ :type durationSeconds: Optional[int]
261
+ :param outputLocation: S3 location where results are stored
262
+ :type outputLocation: Optional[str]
263
+ :param outputFormat: Format of the output data
264
+ :type outputFormat: AMCExportFormat
265
+ :param rowCount: Number of rows in the result set
266
+ :type rowCount: Optional[int]
267
+ :param errorMessage: Error details if execution failed
268
+ :type errorMessage: Optional[str]
269
+ :param queryPlan: Query execution plan details
270
+ :type queryPlan: Optional[Dict[str, Any]]
271
+ :param statistics: Performance statistics for the execution
272
+ :type statistics: Optional[Dict[str, Any]]
273
+ """
274
+
275
+ executionId: str = Field(..., description="Execution ID")
276
+ queryId: str = Field(..., description="Query ID")
277
+ instanceId: str = Field(..., description="AMC instance ID")
278
+ status: AMCQueryStatus = Field(..., description="Execution status")
279
+ startTime: datetime = Field(..., description="Execution start time")
280
+ endTime: Optional[datetime] = Field(None, description="Execution end time")
281
+ durationSeconds: Optional[int] = Field(None, description="Execution duration")
282
+ outputLocation: Optional[str] = Field(None, description="S3 output location")
283
+ outputFormat: AMCExportFormat = Field(..., description="Output format")
284
+ rowCount: Optional[int] = Field(None, description="Result row count")
285
+ errorMessage: Optional[str] = Field(None, description="Error message if failed")
286
+ queryPlan: Optional[Dict[str, Any]] = Field(
287
+ None, description="Query execution plan"
288
+ )
289
+ statistics: Optional[Dict[str, Any]] = Field(
290
+ None, description="Execution statistics"
291
+ )
292
+
293
+
294
+ class AMCQueryExecutionRequest(BaseAMCModel):
295
+ """Request to execute an AMC query.
296
+
297
+ Contains all parameters needed to execute a query in
298
+ Amazon Marketing Cloud.
299
+
300
+ :param queryId: ID of a saved query to execute
301
+ :type queryId: Optional[str]
302
+ :param queryText: Ad-hoc SQL query text to execute
303
+ :type queryText: Optional[str]
304
+ :param parameters: Parameters to substitute in the query
305
+ :type parameters: Optional[Dict[str, Any]]
306
+ :param outputFormat: Desired format for query results
307
+ :type outputFormat: AMCExportFormat
308
+ :param outputLocation: Custom S3 location for results
309
+ :type outputLocation: Optional[str]
310
+ :param timeRange: Time range constraints for the query
311
+ :type timeRange: Optional[Dict[str, str]]
312
+ :param privacySettings: Privacy and compliance settings
313
+ :type privacySettings: Optional[Dict[str, Any]]
314
+ """
315
+
316
+ queryId: Optional[str] = Field(None, description="Saved query ID")
317
+ queryText: Optional[str] = Field(None, description="Ad-hoc query text")
318
+ parameters: Optional[Dict[str, Any]] = Field(None, description="Query parameters")
319
+ outputFormat: AMCExportFormat = Field(
320
+ AMCExportFormat.CSV, description="Output format"
321
+ )
322
+ outputLocation: Optional[str] = Field(None, description="Custom S3 output location")
323
+ timeRange: Optional[Dict[str, str]] = Field(
324
+ None, description="Time range for query"
325
+ )
326
+ privacySettings: Optional[Dict[str, Any]] = Field(
327
+ None, description="Privacy settings"
328
+ )
329
+
330
+
331
+ class AMCQueryListResponse(BaseAMCModel):
332
+ """Response for AMC query list operations.
333
+
334
+ Contains a list of AMC queries with pagination support.
335
+
336
+ :param queries: List of AMC queries
337
+ :type queries: List[AMCQuery]
338
+ :param nextToken: Token for retrieving the next page of results
339
+ :type nextToken: Optional[str]
340
+ :param totalResults: Total number of queries available
341
+ :type totalResults: Optional[int]
342
+ """
343
+
344
+ queries: List[AMCQuery] = Field(default_factory=list)
345
+ nextToken: Optional[str] = Field(None)
346
+ totalResults: Optional[int] = Field(None)
347
+
348
+
349
+ # Audience Models
350
+ class AMCAudience(BaseAMCModel):
351
+ """AMC audience model.
352
+
353
+ Represents a targetable audience created from AMC query results
354
+ with activation and refresh capabilities.
355
+
356
+ :param audienceId: Unique identifier for the audience
357
+ :type audienceId: str
358
+ :param audienceName: Human-readable name for the audience
359
+ :type audienceName: str
360
+ :param instanceId: AMC instance where audience is stored
361
+ :type instanceId: str
362
+ :param queryId: ID of the query used to create the audience
363
+ :type queryId: str
364
+ :param status: Current status of the audience
365
+ :type status: AMCAudienceStatus
366
+ :param audienceSize: Estimated number of users in the audience
367
+ :type audienceSize: Optional[int]
368
+ :param matchRate: Percentage of users that match the criteria
369
+ :type matchRate: Optional[float]
370
+ :param description: Optional description of the audience
371
+ :type description: Optional[str]
372
+ :param refreshSchedule: Cron expression for automatic refresh
373
+ :type refreshSchedule: Optional[str]
374
+ :param lastRefreshedAt: When the audience was last refreshed
375
+ :type lastRefreshedAt: Optional[datetime]
376
+ :param expiresAt: When the audience expires
377
+ :type expiresAt: Optional[datetime]
378
+ :param destinations: List of activation destinations
379
+ :type destinations: List[str]
380
+ :param createdAt: When the audience was created
381
+ :type createdAt: datetime
382
+ :param updatedAt: When the audience was last updated
383
+ :type updatedAt: datetime
384
+ """
385
+
386
+ audienceId: str = Field(..., description="Audience ID")
387
+ audienceName: str = Field(..., description="Audience name")
388
+ instanceId: str = Field(..., description="AMC instance ID")
389
+ queryId: str = Field(..., description="Source query ID")
390
+ status: AMCAudienceStatus = Field(..., description="Audience status")
391
+ audienceSize: Optional[int] = Field(None, description="Estimated audience size")
392
+ matchRate: Optional[float] = Field(None, description="Match rate percentage")
393
+ description: Optional[str] = Field(None, description="Audience description")
394
+ refreshSchedule: Optional[str] = Field(None, description="Refresh schedule (cron)")
395
+ lastRefreshedAt: Optional[datetime] = Field(
396
+ None, description="Last refresh timestamp"
397
+ )
398
+ expiresAt: Optional[datetime] = Field(None, description="Expiration timestamp")
399
+ destinations: List[str] = Field(
400
+ default_factory=list, description="Activation destinations"
401
+ )
402
+ createdAt: datetime = Field(..., description="Creation timestamp")
403
+ updatedAt: datetime = Field(..., description="Last update timestamp")
404
+
405
+
406
+ class AMCAudienceCreateRequest(BaseAMCModel):
407
+ """Request to create an AMC audience.
408
+
409
+ Contains all parameters needed to create a new audience
410
+ from AMC query results.
411
+
412
+ :param audienceName: Name for the new audience
413
+ :type audienceName: str
414
+ :param queryId: ID of the query to use for audience creation
415
+ :type queryId: str
416
+ :param description: Optional description of the audience
417
+ :type description: Optional[str]
418
+ :param refreshSchedule: Cron expression for automatic refresh
419
+ :type refreshSchedule: Optional[str]
420
+ :param ttlDays: Number of days the audience should live
421
+ :type ttlDays: Optional[int]
422
+ :param destinations: List of activation destinations
423
+ :type destinations: List[str]
424
+ """
425
+
426
+ audienceName: str = Field(..., description="Audience name")
427
+ queryId: str = Field(..., description="Source query ID")
428
+ description: Optional[str] = Field(None, description="Audience description")
429
+ refreshSchedule: Optional[str] = Field(None, description="Refresh schedule (cron)")
430
+ ttlDays: Optional[int] = Field(30, description="Time to live in days")
431
+ destinations: List[str] = Field(
432
+ default_factory=list, description="Activation destinations"
433
+ )
434
+
435
+
436
+ class AMCAudienceListResponse(BaseAMCModel):
437
+ """Response for AMC audience list operations.
438
+
439
+ Contains a list of AMC audiences with pagination support.
440
+
441
+ :param audiences: List of AMC audiences
442
+ :type audiences: List[AMCAudience]
443
+ :param nextToken: Token for retrieving the next page of results
444
+ :type nextToken: Optional[str]
445
+ :param totalResults: Total number of audiences available
446
+ :type totalResults: Optional[int]
447
+ """
448
+
449
+ audiences: List[AMCAudience] = Field(default_factory=list)
450
+ nextToken: Optional[str] = Field(None)
451
+ totalResults: Optional[int] = Field(None)
452
+
453
+
454
+ # Data Upload Models
455
+ class AMCDataUpload(BaseAMCModel):
456
+ """AMC data upload model.
457
+
458
+ Represents a data upload to Amazon Marketing Cloud with
459
+ processing status and metadata.
460
+
461
+ :param uploadId: Unique identifier for the upload
462
+ :type uploadId: str
463
+ :param instanceId: AMC instance where data was uploaded
464
+ :type instanceId: str
465
+ :param datasetName: Name of the uploaded dataset
466
+ :type datasetName: str
467
+ :param uploadStatus: Current status of the upload
468
+ :type uploadStatus: str
469
+ :param fileSize: Size of the uploaded file in bytes
470
+ :type fileSize: int
471
+ :param rowCount: Number of rows in the uploaded data
472
+ :type rowCount: Optional[int]
473
+ :param dataSchema: Schema definition for the uploaded data
474
+ :type dataSchema: Dict[str, str]
475
+ :param uploadedAt: When the upload was initiated
476
+ :type uploadedAt: datetime
477
+ :param processedAt: When processing was completed
478
+ :type processedAt: Optional[datetime]
479
+ :param errorDetails: List of errors encountered during processing
480
+ :type errorDetails: Optional[List[Dict[str, Any]]]
481
+ """
482
+
483
+ uploadId: str = Field(..., description="Upload ID")
484
+ instanceId: str = Field(..., description="AMC instance ID")
485
+ datasetName: str = Field(..., description="Dataset name")
486
+ uploadStatus: str = Field(..., description="Upload status")
487
+ fileSize: int = Field(..., description="File size in bytes")
488
+ rowCount: Optional[int] = Field(None, description="Number of rows")
489
+ dataSchema: Dict[str, str] = Field(
490
+ ...,
491
+ alias="schema",
492
+ serialization_alias="schema",
493
+ description="Data schema",
494
+ )
495
+ uploadedAt: datetime = Field(..., description="Upload timestamp")
496
+ processedAt: Optional[datetime] = Field(
497
+ None, description="Processing completion timestamp"
498
+ )
499
+ errorDetails: Optional[List[Dict[str, Any]]] = Field(
500
+ None, description="Upload errors"
501
+ )
502
+
503
+
504
+ class AMCDataUploadRequest(BaseAMCModel):
505
+ """Request to upload data to AMC.
506
+
507
+ Contains all parameters needed to upload data to
508
+ Amazon Marketing Cloud.
509
+
510
+ :param datasetName: Name for the new dataset
511
+ :type datasetName: str
512
+ :param dataSchema: Schema definition for the data
513
+ :type dataSchema: Dict[str, str]
514
+ :param fileUrl: S3 URL of the data file to upload
515
+ :type fileUrl: str
516
+ :param fileFormat: Format of the data file
517
+ :type fileFormat: str
518
+ :param compressionType: Type of compression used (if any)
519
+ :type compressionType: Optional[str]
520
+ :param hasHeader: Whether the file has a header row
521
+ :type hasHeader: bool
522
+ :param delimiter: Field delimiter for CSV files
523
+ :type delimiter: Optional[str]
524
+ """
525
+
526
+ datasetName: str = Field(..., description="Dataset name")
527
+ dataSchema: Dict[str, str] = Field(
528
+ ...,
529
+ alias="schema",
530
+ serialization_alias="schema",
531
+ description="Data schema",
532
+ )
533
+ fileUrl: str = Field(..., description="S3 URL of data file")
534
+ fileFormat: str = Field(..., description="File format (CSV, JSON, etc)")
535
+ compressionType: Optional[str] = Field(None, description="Compression type")
536
+ hasHeader: bool = Field(True, description="File has header row")
537
+ delimiter: Optional[str] = Field(",", description="Field delimiter for CSV")
538
+
539
+
540
+ # Template Models
541
+ class AMCQueryTemplate(BaseAMCModel):
542
+ """AMC query template model.
543
+
544
+ Represents a reusable query template with parameterized
545
+ SQL and example usage.
546
+
547
+ :param templateId: Unique identifier for the template
548
+ :type templateId: str
549
+ :param templateName: Human-readable name for the template
550
+ :type templateName: str
551
+ :param category: Category or grouping for the template
552
+ :type category: str
553
+ :param description: Detailed description of the template
554
+ :type description: str
555
+ :param templateQuery: SQL template with parameter placeholders
556
+ :type templateQuery: str
557
+ :param requiredParameters: List of required parameters
558
+ :type requiredParameters: List[str]
559
+ :param optionalParameters: List of optional parameters
560
+ :type optionalParameters: List[str]
561
+ :param outputSchema: Expected structure of query results
562
+ :type outputSchema: Dict[str, str]
563
+ :param exampleParameters: Example values for parameters
564
+ :type exampleParameters: Dict[str, Any]
565
+ :param tags: List of tags for categorization
566
+ :type tags: List[str]
567
+ :param isOfficial: Whether this is an Amazon-provided template
568
+ :type isOfficial: bool
569
+ """
570
+
571
+ templateId: str = Field(..., description="Template ID")
572
+ templateName: str = Field(..., description="Template name")
573
+ category: str = Field(..., description="Template category")
574
+ description: str = Field(..., description="Template description")
575
+ templateQuery: str = Field(..., description="Template SQL with placeholders")
576
+ requiredParameters: List[str] = Field(..., description="Required parameters")
577
+ optionalParameters: List[str] = Field(
578
+ default_factory=list, description="Optional parameters"
579
+ )
580
+ outputSchema: Dict[str, str] = Field(..., description="Expected output schema")
581
+ exampleParameters: Dict[str, Any] = Field(
582
+ ..., description="Example parameter values"
583
+ )
584
+ tags: List[str] = Field(default_factory=list, description="Template tags")
585
+ isOfficial: bool = Field(False, description="Is Amazon official template")
586
+
587
+
588
+ class AMCQueryTemplateListResponse(BaseAMCModel):
589
+ """Response for AMC query template list operations.
590
+
591
+ Contains a list of AMC query templates with categorization.
592
+
593
+ :param templates: List of AMC query templates
594
+ :type templates: List[AMCQueryTemplate]
595
+ :param nextToken: Token for retrieving the next page of results
596
+ :type nextToken: Optional[str]
597
+ :param categories: List of available template categories
598
+ :type categories: List[str]
599
+ """
600
+
601
+ templates: List[AMCQueryTemplate] = Field(default_factory=list)
602
+ nextToken: Optional[str] = Field(None)
603
+ categories: List[str] = Field(
604
+ default_factory=list, description="Available categories"
605
+ )
606
+
607
+
608
+ # Insights Models
609
+ class AMCInsight(BaseAMCModel):
610
+ """AMC automated insight model.
611
+
612
+ Represents an automated insight generated by Amazon Marketing Cloud
613
+ with recommendations and supporting data.
614
+
615
+ :param insightId: Unique identifier for the insight
616
+ :type insightId: str
617
+ :param instanceId: AMC instance where insight was generated
618
+ :type instanceId: str
619
+ :param insightType: Category or type of insight
620
+ :type insightType: str
621
+ :param title: Human-readable title for the insight
622
+ :type title: str
623
+ :param description: Detailed description of the insight
624
+ :type description: str
625
+ :param significance: Importance level of the insight
626
+ :type significance: str
627
+ :param metrics: Key performance metrics supporting the insight
628
+ :type metrics: Dict[str, Any]
629
+ :param recommendations: List of actionable recommendations
630
+ :type recommendations: List[str]
631
+ :param supportingData: Additional data supporting the insight
632
+ :type supportingData: Dict[str, Any]
633
+ :param generatedAt: When the insight was generated
634
+ :type generatedAt: datetime
635
+ :param expiresAt: When the insight expires
636
+ :type expiresAt: datetime
637
+ """
638
+
639
+ insightId: str = Field(..., description="Insight ID")
640
+ instanceId: str = Field(..., description="AMC instance ID")
641
+ insightType: str = Field(..., description="Type of insight")
642
+ title: str = Field(..., description="Insight title")
643
+ description: str = Field(..., description="Insight description")
644
+ significance: str = Field(..., description="Significance level (HIGH, MEDIUM, LOW)")
645
+ metrics: Dict[str, Any] = Field(..., description="Key metrics")
646
+ recommendations: List[str] = Field(..., description="Action recommendations")
647
+ supportingData: Dict[str, Any] = Field(..., description="Supporting data")
648
+ generatedAt: datetime = Field(..., description="Generation timestamp")
649
+ expiresAt: datetime = Field(..., description="Expiration timestamp")
650
+
651
+
652
+ class AMCInsightListResponse(BaseAMCModel):
653
+ """Response for AMC insight list operations.
654
+
655
+ Contains a list of AMC insights with pagination support.
656
+
657
+ :param insights: List of AMC insights
658
+ :type insights: List[AMCInsight]
659
+ :param nextToken: Token for retrieving the next page of results
660
+ :type nextToken: Optional[str]
661
+ :param totalResults: Total number of insights available
662
+ :type totalResults: Optional[int]
663
+ """
664
+
665
+ insights: List[AMCInsight] = Field(default_factory=list)
666
+ nextToken: Optional[str] = Field(None)
667
+ totalResults: Optional[int] = Field(None)
668
+
669
+
670
+ # Privacy and Compliance Models
671
+ class AMCPrivacyConfig(BaseAMCModel):
672
+ """AMC privacy configuration model.
673
+
674
+ Represents privacy and compliance settings for an AMC instance
675
+ including differential privacy and data retention policies.
676
+
677
+ :param instanceId: AMC instance this configuration applies to
678
+ :type instanceId: str
679
+ :param privacyLevel: Overall privacy protection level
680
+ :type privacyLevel: AMCPrivacyLevel
681
+ :param minimumAggregationThreshold: Minimum group size for results
682
+ :type minimumAggregationThreshold: int
683
+ :param differentialPrivacyEnabled: Whether differential privacy is enabled
684
+ :type differentialPrivacyEnabled: bool
685
+ :param noiseLevel: Amount of noise added for differential privacy
686
+ :type noiseLevel: Optional[float]
687
+ :param suppressedDimensions: Dimensions that are suppressed for privacy
688
+ :type suppressedDimensions: List[str]
689
+ :param dataRetentionDays: How long data is retained
690
+ :type dataRetentionDays: int
691
+ :param allowedDataSources: Data sources that are permitted
692
+ :type allowedDataSources: List[AMCDataSource]
693
+ :param blockedDataSources: Data sources that are blocked
694
+ :type blockedDataSources: List[AMCDataSource]
695
+ """
696
+
697
+ instanceId: str = Field(..., description="AMC instance ID")
698
+ privacyLevel: AMCPrivacyLevel = Field(..., description="Privacy level")
699
+ minimumAggregationThreshold: int = Field(
700
+ ..., description="Minimum aggregation threshold"
701
+ )
702
+ differentialPrivacyEnabled: bool = Field(
703
+ ..., description="Differential privacy enabled"
704
+ )
705
+ noiseLevel: Optional[float] = Field(
706
+ None, description="Noise level for differential privacy"
707
+ )
708
+ suppressedDimensions: List[str] = Field(
709
+ default_factory=list, description="Suppressed dimensions"
710
+ )
711
+ dataRetentionDays: int = Field(..., description="Data retention period in days")
712
+ allowedDataSources: List[AMCDataSource] = Field(
713
+ ..., description="Allowed data sources"
714
+ )
715
+ blockedDataSources: List[AMCDataSource] = Field(
716
+ default_factory=list, description="Blocked data sources"
717
+ )
718
+
719
+
720
+ # Workflow Models
721
+ class AMCWorkflow(BaseAMCModel):
722
+ """AMC workflow model for automated query execution.
723
+
724
+ Represents an automated workflow that executes queries on a schedule
725
+ with multiple steps and error handling.
726
+
727
+ :param workflowId: Unique identifier for the workflow
728
+ :type workflowId: str
729
+ :param workflowName: Human-readable name for the workflow
730
+ :type workflowName: str
731
+ :param instanceId: AMC instance where workflow is defined
732
+ :type instanceId: str
733
+ :param description: Optional description of the workflow
734
+ :type description: Optional[str]
735
+ :param steps: List of workflow execution steps
736
+ :type steps: List[Dict[str, Any]]
737
+ :param schedule: Cron expression for execution schedule
738
+ :type schedule: Optional[str]
739
+ :param isActive: Whether the workflow is currently active
740
+ :type isActive: bool
741
+ :param lastExecutionTime: When the workflow was last executed
742
+ :type lastExecutionTime: Optional[datetime]
743
+ :param nextExecutionTime: When the workflow will next execute
744
+ :type nextExecutionTime: Optional[datetime]
745
+ :param createdAt: When the workflow was created
746
+ :type createdAt: datetime
747
+ :param updatedAt: When the workflow was last updated
748
+ :type updatedAt: datetime
749
+ """
750
+
751
+ workflowId: str = Field(..., description="Workflow ID")
752
+ workflowName: str = Field(..., description="Workflow name")
753
+ instanceId: str = Field(..., description="AMC instance ID")
754
+ description: Optional[str] = Field(None, description="Workflow description")
755
+ steps: List[Dict[str, Any]] = Field(..., description="Workflow steps")
756
+ schedule: Optional[str] = Field(None, description="Execution schedule (cron)")
757
+ isActive: bool = Field(True, description="Is workflow active")
758
+ lastExecutionTime: Optional[datetime] = Field(
759
+ None, description="Last execution timestamp"
760
+ )
761
+ nextExecutionTime: Optional[datetime] = Field(
762
+ None, description="Next scheduled execution"
763
+ )
764
+ createdAt: datetime = Field(..., description="Creation timestamp")
765
+ updatedAt: datetime = Field(..., description="Last update timestamp")
766
+
767
+
768
+ class AMCWorkflowExecution(BaseAMCModel):
769
+ """AMC workflow execution model.
770
+
771
+ Represents a single execution of an AMC workflow with
772
+ step results and error handling.
773
+
774
+ :param executionId: Unique identifier for the execution
775
+ :type executionId: str
776
+ :param workflowId: ID of the workflow that was executed
777
+ :type workflowId: str
778
+ :param status: Current status of the execution
779
+ :type status: AMCQueryStatus
780
+ :param startTime: When execution began
781
+ :type startTime: datetime
782
+ :param endTime: When execution completed (if finished)
783
+ :type endTime: Optional[datetime]
784
+ :param stepResults: Results for each workflow step
785
+ :type stepResults: List[Dict[str, Any]]
786
+ :param errorDetails: Error details if execution failed
787
+ :type errorDetails: Optional[Dict[str, Any]]
788
+ """
789
+
790
+ executionId: str = Field(..., description="Execution ID")
791
+ workflowId: str = Field(..., description="Workflow ID")
792
+ status: AMCQueryStatus = Field(..., description="Execution status")
793
+ startTime: datetime = Field(..., description="Start time")
794
+ endTime: Optional[datetime] = Field(None, description="End time")
795
+ stepResults: List[Dict[str, Any]] = Field(..., description="Results for each step")
796
+ errorDetails: Optional[Dict[str, Any]] = Field(
797
+ None, description="Error details if failed"
798
+ )
799
+
800
+
801
+ # Export all models
802
+ __all__ = [
803
+ # Enums
804
+ "AMCQueryStatus",
805
+ "AMCQueryType",
806
+ "AMCDataSource",
807
+ "AMCAudienceStatus",
808
+ "AMCPrivacyLevel",
809
+ "AMCExportFormat",
810
+ "AMCInstanceType",
811
+ # Instance models
812
+ "AMCInstance",
813
+ "AMCInstanceListResponse",
814
+ # Query models
815
+ "AMCQuery",
816
+ "AMCQueryExecution",
817
+ "AMCQueryExecutionRequest",
818
+ "AMCQueryListResponse",
819
+ # Audience models
820
+ "AMCAudience",
821
+ "AMCAudienceCreateRequest",
822
+ "AMCAudienceListResponse",
823
+ # Data upload models
824
+ "AMCDataUpload",
825
+ "AMCDataUploadRequest",
826
+ # Template models
827
+ "AMCQueryTemplate",
828
+ "AMCQueryTemplateListResponse",
829
+ # Insight models
830
+ "AMCInsight",
831
+ "AMCInsightListResponse",
832
+ # Privacy models
833
+ "AMCPrivacyConfig",
834
+ # Workflow models
835
+ "AMCWorkflow",
836
+ "AMCWorkflowExecution",
837
+ ]