Skip to content

create_pricing_plan async

create_pricing_plan(
    name: PricingPlanName,
    *,
    config_overrides: Optional[AsyncbillingconductorClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    description: Optional[PricingPlanDescription] = None,
    pricing_rule_arns: Optional[PricingRuleArnsInput] = None,
    tags: Optional[TagMap] = None,
) -> CreatePricingPlanOutput

Creates a pricing plan that is used for computing Amazon Web Services charges for billing groups.

Parameters:

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you specify to ensure idempotency of the request. Idempotency ensures that an API request completes no more than one time. With an idempotent request, if the original request completes successfully, any subsequent retries complete successfully without performing any further actions.

  • name (PricingPlanName) –

    The name of the pricing plan. The names must be unique to each pricing plan.

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

    The description of the pricing plan.

  • pricing_rule_arns (Optional[PricingRuleArnsInput], default: None ) –

    A list of Amazon Resource Names (ARNs) that define the pricing plan parameters.

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

    A map that contains tag keys and tag values that are attached to a pricing plan.

Raises:

Source code in docs_src/capo_billingconductor/_services/async_billingconductor.py
async def create_pricing_plan(
    self,
    name: "capo_billingconductor.types.pricing_plan_name.PricingPlanName",
    *,
    config_overrides: Optional[AsyncbillingconductorClientConfig] = None,
    client_token: Optional[
        "capo_billingconductor.types.client_token.ClientToken"
    ] = None,
    description: Optional[
        "capo_billingconductor.types.pricing_plan_description.PricingPlanDescription"
    ] = None,
    pricing_rule_arns: Optional[
        "capo_billingconductor.types.pricing_rule_arns_input.PricingRuleArnsInput"
    ] = None,
    tags: Optional["capo_billingconductor.types.tag_map.TagMap"] = None,
) -> (
    "capo_billingconductor.types.create_pricing_plan_output.CreatePricingPlanOutput"
):
    """<p>Creates a pricing plan that is used for computing Amazon Web Services charges for billing groups. </p>

    Args:
        client_token: <p>A unique, case-sensitive identifier that you specify to ensure idempotency of the request. Idempotency ensures that an API request completes no more than one time. With an idempotent request, if the original request completes successfully, any subsequent retries complete successfully without performing any further actions.</p>
        name: <p>The name of the pricing plan. The names must be unique to each pricing plan. </p>
        description: <p>The description of the pricing plan. </p>
        pricing_rule_arns: <p> A list of Amazon Resource Names (ARNs) that define the pricing plan parameters. </p>
        tags: <p> A map that contains tag keys and tag values that are attached to a pricing plan. </p>

    Raises:
        capo_billingconductor.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. </p>
        capo_billingconductor.errors.conflict_exception.ConflictException: <p>You can cause an inconsistent state by updating or deleting a resource. </p>
        capo_billingconductor.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred while processing a request. </p>
        capo_billingconductor.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that doesn't exist. </p>
        capo_billingconductor.errors.service_limit_exceeded_exception.ServiceLimitExceededException: <p>The request would cause a service limit to exceed. </p>
        capo_billingconductor.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. </p>
        capo_billingconductor.errors.validation_exception.ValidationException: <p>The input doesn't match with the constraints specified by Amazon Web Services services.</p>
        capo_billingconductor.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_billingconductor.types.create_pricing_plan_input.CreatePricingPlanInput]",
    ) -> AsyncOperationResponse[
        "capo_billingconductor.types.create_pricing_plan_output.CreatePricingPlanOutput"
    ]:
        import capo_billingconductor._operations.aws_billing_conductor.create_pricing_plan

        (
            output,
            http_response,
        ) = await capo_billingconductor._operations.aws_billing_conductor.create_pricing_plan.async_create_pricing_plan(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_billingconductor.types.create_pricing_plan_input.CreatePricingPlanInput",
    ) -> dict[str, Any]:
        import capo_billingconductor.types.create_pricing_plan_input

        return (
            capo_billingconductor.types.create_pricing_plan_input.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreatePricingPlan", redact_input=_redact_input),
    )
    input_: capo_billingconductor.types.create_pricing_plan_input.CreatePricingPlanInput = {
        "name": name
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description
    if pricing_rule_arns is not None:
        input_["pricing_rule_arns"] = pricing_rule_arns
    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