Skip to content

create_budget async

create_budget(
    farm_id: FarmId,
    display_name: ResourceName,
    usage_tracking_resource: UsageTrackingResource,
    approximate_dollar_limit: ConsumedUsageLimit,
    actions: BudgetActionsToAdd,
    schedule: BudgetSchedule,
    *,
    config_overrides: Optional[AsyncdeadlineClientConfig] = None,
    description: Optional[Description] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[Tags] = None,
) -> CreateBudgetResponse

Creates a budget to set spending thresholds for your rendering activity.

Parameters:

  • farm_id (FarmId) –

    The farm ID to include in this budget.

  • display_name (ResourceName) –

    The display name of the budget.

    This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.

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

    The description of the budget.

    This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.

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

    The unique token which the server uses to recognize retries of the same request.

  • usage_tracking_resource (UsageTrackingResource) –

    The queue ID provided to this budget to track usage.

  • approximate_dollar_limit (ConsumedUsageLimit) –

    The dollar limit based on consumed usage.

  • actions (BudgetActionsToAdd) –

    The budget actions to specify what happens when the budget runs out.

  • schedule (BudgetSchedule) –

    The schedule to associate with this budget.

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

    Each tag consists of a tag key and a tag value. Tag keys and values are both required, but tag values can be empty strings.

Raises:

Source code in docs_src/capo_deadline/_services/async_deadline.py
async def create_budget(
    self,
    farm_id: "capo_deadline.types.farm_id.FarmId",
    display_name: "capo_deadline.types.resource_name.ResourceName",
    usage_tracking_resource: "capo_deadline.types.usage_tracking_resource.UsageTrackingResource",
    approximate_dollar_limit: "capo_deadline.types.consumed_usage_limit.ConsumedUsageLimit",
    actions: "capo_deadline.types.budget_actions_to_add.BudgetActionsToAdd",
    schedule: "capo_deadline.types.budget_schedule.BudgetSchedule",
    *,
    config_overrides: Optional[AsyncdeadlineClientConfig] = None,
    description: Optional["capo_deadline.types.description.Description"] = None,
    client_token: Optional["capo_deadline.types.client_token.ClientToken"] = None,
    tags: Optional["capo_deadline.types.tags.Tags"] = None,
) -> "capo_deadline.types.create_budget_response.CreateBudgetResponse":
    """<p>Creates a budget to set spending thresholds for your rendering activity.</p>

    Args:
        farm_id: <p>The farm ID to include in this budget.</p>
        display_name: <p>The display name of the budget.</p> <important> <p>This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.</p> </important>
        description: <p>The description of the budget.</p> <important> <p>This field can store any content. Escape or encode this content before displaying it on a webpage or any other system that might interpret the content of this field.</p> </important>
        client_token: <p>The unique token which the server uses to recognize retries of the same request.</p>
        usage_tracking_resource: <p>The queue ID provided to this budget to track usage.</p>
        approximate_dollar_limit: <p>The dollar limit based on consumed usage.</p>
        actions: <p>The budget actions to specify what happens when the budget runs out.</p>
        schedule: <p>The schedule to associate with this budget.</p>
        tags: <p>Each tag consists of a tag key and a tag value. Tag keys and values are both required, but tag values can be empty strings.</p>

    Raises:
        capo_deadline.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action.</p>
        capo_deadline.errors.internal_server_error_exception.InternalServerErrorException: <p>Deadline Cloud can't process your request right now. Try again later.</p>
        capo_deadline.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource can't be found.</p>
        capo_deadline.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You exceeded your service quota. Service quotas, also referred to as limits, are the maximum number of service resources or operations for your Amazon Web Services account.</p>
        capo_deadline.errors.throttling_exception.ThrottlingException: <p>Your request exceeded a request rate quota.</p>
        capo_deadline.errors.validation_exception.ValidationException: <p>The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.</p>
        capo_deadline.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_deadline.types.create_budget_request.CreateBudgetRequest]",
    ) -> AsyncOperationResponse[
        "capo_deadline.types.create_budget_response.CreateBudgetResponse"
    ]:
        import capo_deadline._operations.deadline.create_budget

        (
            output,
            http_response,
        ) = await capo_deadline._operations.deadline.create_budget.async_create_budget(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_deadline.types.create_budget_request.CreateBudgetRequest",
    ) -> dict[str, Any]:
        import capo_deadline.types.create_budget_request

        return capo_deadline.types.create_budget_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateBudget", redact_input=_redact_input),
    )
    input_: capo_deadline.types.create_budget_request.CreateBudgetRequest = {
        "farm_id": farm_id,
        "display_name": display_name,
        "usage_tracking_resource": usage_tracking_resource,
        "approximate_dollar_limit": approximate_dollar_limit,
        "actions": actions,
        "schedule": schedule,
    }
    if description is not None:
        input_["description"] = description
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    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