Skip to content

update_subscription async

update_subscription(
    *,
    config_overrides: Optional[AsyncShieldClientConfig] = None,
    auto_renew: Optional[AutoRenew] = None,
) -> UpdateSubscriptionResponse

Updates the details of an existing subscription. Only enter values for parameters you want to change. Empty parameters are not updated.

For accounts that are members of an Organizations organization, Shield Advanced subscriptions are billed against the organization's payer account, regardless of whether the payer account itself is subscribed.

Parameters:

  • auto_renew (Optional[AutoRenew], default: None ) –

    When you initally create a subscription, AutoRenew is set to ENABLED. If ENABLED, the subscription will be automatically renewed at the end of the existing subscription period. You can change this by submitting an UpdateSubscription request. If the UpdateSubscription request does not included a value for AutoRenew, the existing value for AutoRenew remains unchanged.

Raises:

  • InternalErrorException –

    Exception that indicates that a problem occurred with the service infrastructure. You can retry the request.

  • InvalidParameterException –

    Exception that indicates that the parameters passed to the API are invalid. If available, this exception includes details in additional properties.

  • LockedSubscriptionException –

    You are trying to update a subscription that has not yet completed the 1-year commitment. You can change the AutoRenew parameter during the last 30 days of your subscription. This exception indicates that you are attempting to change AutoRenew prior to that period.

  • OptimisticLockException –

    Exception that indicates that the resource state has been modified by another client. Retrieve the resource and then retry your request.

  • ResourceNotFoundException –

    Exception indicating the specified resource does not exist. If available, this exception includes details in additional properties.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_shield/_services/async_shield.py
async def update_subscription(
    self,
    *,
    config_overrides: Optional[AsyncShieldClientConfig] = None,
    auto_renew: Optional["capo_shield.types.auto_renew.AutoRenew"] = None,
) -> "capo_shield.types.update_subscription_response.UpdateSubscriptionResponse":
    """<p>Updates the details of an existing subscription. Only enter values for parameters you want to change. Empty parameters are not updated.</p> <note> <p>For accounts that are members of an Organizations organization, Shield Advanced subscriptions are billed against the organization's payer account, regardless of whether the payer account itself is subscribed. </p> </note>

    Args:
        auto_renew: <p>When you initally create a subscription, <code>AutoRenew</code> is set to <code>ENABLED</code>. If <code>ENABLED</code>, the subscription will be automatically renewed at the end of the existing subscription period. You can change this by submitting an <code>UpdateSubscription</code> request. If the <code>UpdateSubscription</code> request does not included a value for <code>AutoRenew</code>, the existing value for <code>AutoRenew</code> remains unchanged.</p>

    Raises:
        capo_shield.errors.internal_error_exception.InternalErrorException: <p>Exception that indicates that a problem occurred with the service infrastructure. You can retry the request.</p>
        capo_shield.errors.invalid_parameter_exception.InvalidParameterException: <p>Exception that indicates that the parameters passed to the API are invalid. If available, this exception includes details in additional properties. </p>
        capo_shield.errors.locked_subscription_exception.LockedSubscriptionException: <p>You are trying to update a subscription that has not yet completed the 1-year commitment. You can change the <code>AutoRenew</code> parameter during the last 30 days of your subscription. This exception indicates that you are attempting to change <code>AutoRenew</code> prior to that period.</p>
        capo_shield.errors.optimistic_lock_exception.OptimisticLockException: <p>Exception that indicates that the resource state has been modified by another client. Retrieve the resource and then retry your request.</p>
        capo_shield.errors.resource_not_found_exception.ResourceNotFoundException: <p>Exception indicating the specified resource does not exist. If available, this exception includes details in additional properties. </p>
        capo_shield.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_shield.types.update_subscription_request.UpdateSubscriptionRequest]",
    ) -> AsyncOperationResponse[
        "capo_shield.types.update_subscription_response.UpdateSubscriptionResponse"
    ]:
        import capo_shield._operations.aws_shield_20160616.update_subscription

        (
            output,
            http_response,
        ) = await capo_shield._operations.aws_shield_20160616.update_subscription.async_update_subscription(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateSubscription")
    )
    input_: capo_shield.types.update_subscription_request.UpdateSubscriptionRequest = {}
    if auto_renew is not None:
        input_["auto_renew"] = auto_renew

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output