Skip to content

associate_budget_with_resource

associate_budget_with_resource(
    budget_name: BudgetName,
    resource_id: Id,
    *,
    config_overrides: Optional[ServiceCatalogClientConfig] = None,
) -> AssociateBudgetWithResourceOutput

Associates the specified budget with the specified resource.

Parameters:

  • budget_name (BudgetName) –

    The name of the budget you want to associate.

  • resource_id (Id) –

    The resource identifier. Either a portfolio-id or a product-id.

Raises:

Source code in docs_src/capo_service_catalog/_services/service_catalog.py
def associate_budget_with_resource(
    self,
    budget_name: "capo_service_catalog.types.budget_name.BudgetName",
    resource_id: "capo_service_catalog.types.id.Id",
    *,
    config_overrides: Optional[ServiceCatalogClientConfig] = None,
) -> "capo_service_catalog.types.associate_budget_with_resource_output.AssociateBudgetWithResourceOutput":
    """<p>Associates the specified budget with the specified resource.</p>

    Args:
        budget_name: <p>The name of the budget you want to associate.</p>
        resource_id: <p> The resource identifier. Either a portfolio-id or a product-id.</p>

    Raises:
        capo_service_catalog.errors.duplicate_resource_exception.DuplicateResourceException: <p>The specified resource is a duplicate.</p>
        capo_service_catalog.errors.invalid_parameters_exception.InvalidParametersException: <p>One or more parameters provided to the operation are not valid.</p>
        capo_service_catalog.errors.limit_exceeded_exception.LimitExceededException: <p>The current limits of the service would have been exceeded by this operation. Decrease your resource use or increase your service limits and retry the operation.</p>
        capo_service_catalog.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_service_catalog.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_service_catalog.types.associate_budget_with_resource_input.AssociateBudgetWithResourceInput]",
    ) -> OperationResponse[
        "capo_service_catalog.types.associate_budget_with_resource_output.AssociateBudgetWithResourceOutput"
    ]:
        import capo_service_catalog._operations.aws242_service_catalog_service.associate_budget_with_resource

        output, http_response = (
            capo_service_catalog._operations.aws242_service_catalog_service.associate_budget_with_resource.associate_budget_with_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateBudgetWithResource")
    )
    input_: capo_service_catalog.types.associate_budget_with_resource_input.AssociateBudgetWithResourceInput = {
        "budget_name": budget_name,
        "resource_id": resource_id,
    }

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