Skip to content

create_limit

create_limit(
    farm_id: FarmId,
    display_name: ResourceName,
    amount_requirement_name: AmountRequirementName,
    max_count: MaxCount,
    *,
    config_overrides: Optional[deadlineClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    description: Optional[Description] = None,
) -> CreateLimitResponse

Creates a limit that manages the distribution of shared resources, such as floating licenses. A limit can throttle work assignments, help manage workloads, and track current usage. Before you use a limit, you must associate the limit with one or more queues.

You must add the amountRequirementName to a step in a job template to declare the limit requirement.

Parameters:

  • farm_id (FarmId) –

    The farm ID of the farm that contains the limit.

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

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

  • display_name (ResourceName) –

    The display name of the limit.

    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.

  • amount_requirement_name (AmountRequirementName) –

    The value that you specify as the name in the amounts field of the hostRequirements in a step of a job template to declare the limit requirement.

  • max_count (MaxCount) –

    The maximum number of resources constrained by this limit. When all of the resources are in use, steps that require the limit won't be scheduled until the resource is available.

    The maxCount must not be 0. If the value is -1, there is no restriction on the number of resources that can be acquired for this limit.

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

    A description of the limit. A description helps you identify the purpose of the limit.

    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.

Raises:

Source code in docs_src/capo_deadline/_services/deadline.py
def create_limit(
    self,
    farm_id: "capo_deadline.types.farm_id.FarmId",
    display_name: "capo_deadline.types.resource_name.ResourceName",
    amount_requirement_name: "capo_deadline.types.amount_requirement_name.AmountRequirementName",
    max_count: "capo_deadline.types.max_count.MaxCount",
    *,
    config_overrides: Optional[deadlineClientConfig] = None,
    client_token: Optional["capo_deadline.types.client_token.ClientToken"] = None,
    description: Optional["capo_deadline.types.description.Description"] = None,
) -> "capo_deadline.types.create_limit_response.CreateLimitResponse":
    """<p>Creates a limit that manages the distribution of shared resources, such as floating licenses. A limit can throttle work assignments, help manage workloads, and track current usage. Before you use a limit, you must associate the limit with one or more queues. </p> <p>You must add the <code>amountRequirementName</code> to a step in a job template to declare the limit requirement.</p>

    Args:
        farm_id: <p>The farm ID of the farm that contains the limit.</p>
        client_token: <p>The unique token which the server uses to recognize retries of the same request.</p>
        display_name: <p>The display name of the limit.</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>
        amount_requirement_name: <p>The value that you specify as the <code>name</code> in the <code>amounts</code> field of the <code>hostRequirements</code> in a step of a job template to declare the limit requirement.</p>
        max_count: <p>The maximum number of resources constrained by this limit. When all of the resources are in use, steps that require the limit won't be scheduled until the resource is available.</p> <p>The <code>maxCount</code> must not be 0. If the value is -1, there is no restriction on the number of resources that can be acquired for this limit.</p>
        description: <p>A description of the limit. A description helps you identify the purpose of the limit.</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>

    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.
    """

    def _handler(
        req: "OperationRequest[capo_deadline.types.create_limit_request.CreateLimitRequest]",
    ) -> OperationResponse[
        "capo_deadline.types.create_limit_response.CreateLimitResponse"
    ]:
        import capo_deadline._operations.deadline.create_limit

        output, http_response = (
            capo_deadline._operations.deadline.create_limit.create_limit(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_deadline.types.create_limit_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateLimit", redact_input=_redact_input),
    )
    input_: capo_deadline.types.create_limit_request.CreateLimitRequest = {
        "farm_id": farm_id,
        "display_name": display_name,
        "amount_requirement_name": amount_requirement_name,
        "max_count": max_count,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description

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