Skip to content

create_scaling_plan

create_scaling_plan(
    scaling_plan_name: ScalingPlanName,
    application_source: ApplicationSource,
    scaling_instructions: ScalingInstructions,
    *,
    config_overrides: Optional[AutoScalingPlansClientConfig] = None,
) -> CreateScalingPlanResponse

Creates a scaling plan.

Parameters:

  • scaling_plan_name (ScalingPlanName) –

    The name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes.

  • application_source (ApplicationSource) –

    A CloudFormation stack or set of tags. You can create one scaling plan per application source.

    For more information, see ApplicationSource in the AWS Auto Scaling API Reference.

  • scaling_instructions (ScalingInstructions) –

    The scaling instructions.

    For more information, see ScalingInstruction in the AWS Auto Scaling API Reference.

Raises:

  • ConcurrentUpdateException –

    Concurrent updates caused an exception, for example, if you request an update to a scaling plan that already has a pending update.

  • InternalServiceException –

    The service encountered an internal error.

  • LimitExceededException –

    Your account exceeded a limit. This exception is thrown when a per-account resource limit is exceeded.

  • ValidationException –

    An exception was thrown for a validation issue. Review the parameters provided.

  • UnknownServiceError –

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

Source code in docs_src/capo_auto_scaling_plans/_services/auto_scaling_plans.py
def create_scaling_plan(
    self,
    scaling_plan_name: "capo_auto_scaling_plans.types.scaling_plan_name.ScalingPlanName",
    application_source: "capo_auto_scaling_plans.types.application_source.ApplicationSource",
    scaling_instructions: "capo_auto_scaling_plans.types.scaling_instructions.ScalingInstructions",
    *,
    config_overrides: Optional[AutoScalingPlansClientConfig] = None,
) -> "capo_auto_scaling_plans.types.create_scaling_plan_response.CreateScalingPlanResponse":
    """<p>Creates a scaling plan. </p>

    Args:
        scaling_plan_name: <p>The name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes.</p>
        application_source: <p>A CloudFormation stack or set of tags. You can create one scaling plan per application source.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/plans/APIReference/API_ApplicationSource.html">ApplicationSource</a> in the <i>AWS Auto Scaling API Reference</i>.</p>
        scaling_instructions: <p>The scaling instructions.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/plans/APIReference/API_ScalingInstruction.html">ScalingInstruction</a> in the <i>AWS Auto Scaling API Reference</i>.</p>

    Raises:
        capo_auto_scaling_plans.errors.concurrent_update_exception.ConcurrentUpdateException: <p>Concurrent updates caused an exception, for example, if you request an update to a scaling plan that already has a pending update.</p>
        capo_auto_scaling_plans.errors.internal_service_exception.InternalServiceException: <p>The service encountered an internal error.</p>
        capo_auto_scaling_plans.errors.limit_exceeded_exception.LimitExceededException: <p>Your account exceeded a limit. This exception is thrown when a per-account resource limit is exceeded.</p>
        capo_auto_scaling_plans.errors.validation_exception.ValidationException: <p>An exception was thrown for a validation issue. Review the parameters provided.</p>
        capo_auto_scaling_plans.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_auto_scaling_plans.types.create_scaling_plan_request.CreateScalingPlanRequest]",
    ) -> OperationResponse[
        "capo_auto_scaling_plans.types.create_scaling_plan_response.CreateScalingPlanResponse"
    ]:
        import capo_auto_scaling_plans._operations.any_scale_scaling_planner_frontend_service.create_scaling_plan

        output, http_response = (
            capo_auto_scaling_plans._operations.any_scale_scaling_planner_frontend_service.create_scaling_plan.create_scaling_plan(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateScalingPlan")
    )
    input_: capo_auto_scaling_plans.types.create_scaling_plan_request.CreateScalingPlanRequest = {
        "scaling_plan_name": scaling_plan_name,
        "application_source": application_source,
        "scaling_instructions": scaling_instructions,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output