create_subscription
¶
create_subscription(
plan_family: str,
plan_tier: str,
resource_arns: ResourceArns,
*,
config_overrides: Optional[PricingPlanManagerClientConfig] = None,
usage_level: Optional[str] = None,
approval_mode: Optional[ApprovalMode] = None,
client_token: Optional[IdempotencyToken] = None,
) -> CreateSubscriptionOutput
Creates a flat-rate pricing subscription for the specified resources.
When approvalMode is set to MANUAL, paid-tier subscriptions are created in PENDING_APPROVAL status and require a separate ApprovePaidSubscription call before billing starts. Free-tier subscriptions are always activated immediately regardless of approval mode.
When approvalMode is set to IMMEDIATE or is not specified, the subscription is activated immediately.
Parameters:
-
plan_family(str) –The pricing plan family to subscribe to, such as
CloudFront. -
plan_tier(str) –The tier level for the subscription, such as
FREE,PRO,BUSINESS, orPREMIUM. -
usage_level(Optional[str], default:None) –The usage level within the plan tier. Specify
DEFAULTfor the base configuration, or a higher level if your plan tier supports it. -
resource_arns(ResourceArns) –The ARNs of the resources to include in the subscription. Specify one or more supported resources.
For subscriptions in the CloudFront plan family, the resources must include exactly one Amazon CloudFront distribution and exactly one WAF web ACL. You can also include other supported resources, such as Amazon Route 53 hosted zones and CloudFront KeyValueStores.
-
approval_mode(Optional[ApprovalMode], default:None) –Determines whether the subscription requires explicit approval before billing starts. Set to
MANUALto require a separateApprovePaidSubscriptioncall, orIMMEDIATEto activate the subscription right away. For paid tier plans, this defaults toMANUALif not specified. For theFREEplan tier, onlyIMMEDIATEis supported, and it is the default. -
client_token(Optional[IdempotencyToken], default:None) –A unique, case-sensitive identifier that you provide to ensure that the request is handled only once. If you send the same request with the same client token, the API returns the original response without creating a duplicate subscription.
Raises:
-
AccessDeniedException–You do not have the required permissions to perform this operation. Verify that your IAM policy grants access to this action.
-
ConflictException–The request conflicts with the current state of the resource. This typically occurs when the
ETagvalue in theIf-Matchheader does not match the current version of the subscription. Retrieve the latest version and retry. -
InternalServerException–An unexpected error occurred on the server. Retry the request.
-
ResourceNotFoundException–The specified subscription was not found. Verify that the ARN is correct and that the subscription belongs to your account.
-
ServiceQuotaExceededException–The request would exceed a service limit. You have reached the maximum number of subscriptions allowed for your account.
-
ThrottlingException–The request rate exceeds the allowed limit. Wait briefly and retry the request.
-
ValidationException–The request failed a business rule validation. For example, the specified resource might already be associated with another subscription, or the subscription might not be in the required state for this operation.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Create a flat-rate pricing subscription (deferred approval)
>>> client.create_subscription(plan_family='CloudFront', plan_tier='PRO', resource_arns=['arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE', 'arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/a1b2c3d4'], approval_mode='MANUAL')
Create a subscription with approval mode
>>> client.create_subscription(plan_family='CloudFront', plan_tier='PRO', resource_arns=['arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE', 'arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/a1b2c3d4'], approval_mode='IMMEDIATE')
Source code in docs_src/capo_pricing_plan_manager/_services/pricing_plan_manager.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |