Skip to content

create_usage_limit async

create_usage_limit(
    *,
    config_overrides: Optional[AsyncRedshiftClientConfig] = None,
    cluster_identifier: Optional[String] = None,
    feature_type: Optional[UsageLimitFeatureType] = None,
    limit_type: Optional[UsageLimitLimitType] = None,
    amount: Optional[Long] = None,
    period: Optional[UsageLimitPeriod] = None,
    breach_action: Optional[UsageLimitBreachAction] = None,
    tags: Optional[TagList] = None,
) -> UsageLimit

Creates a usage limit for a specified Amazon Redshift feature on a cluster. The usage limit is identified by the returned usage limit identifier.

Parameters:

  • cluster_identifier (Optional[String], default: None ) –

    The identifier of the cluster that you want to limit usage.

  • feature_type (Optional[UsageLimitFeatureType], default: None ) –

    The Amazon Redshift feature that you want to limit.

  • limit_type (Optional[UsageLimitLimitType], default: None ) –

    The type of limit. Depending on the feature type, this can be based on a time duration or data size. If FeatureType is spectrum, then LimitType must be data-scanned. If FeatureType is concurrency-scaling, then LimitType must be time. If FeatureType is cross-region-datasharing, then LimitType must be data-scanned. If FeatureType is extra-compute-for-automatic-optimization, then LimitType must be time.

  • amount (Optional[Long], default: None ) –

    The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). The value must be a positive number.

  • period (Optional[UsageLimitPeriod], default: None ) –

    The time period that the amount applies to. A weekly period begins on Sunday. The default is monthly.

  • breach_action (Optional[UsageLimitBreachAction], default: None ) –

    The action that Amazon Redshift takes when the limit is reached. The default is log. For more information about this parameter, see UsageLimit.

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

    A list of tag instances.

Raises:

Source code in docs_src/capo_redshift/_services/async_redshift.py
async def create_usage_limit(
    self,
    *,
    config_overrides: Optional[AsyncRedshiftClientConfig] = None,
    cluster_identifier: Optional["capo_redshift.types.string.String"] = None,
    feature_type: Optional[
        "capo_redshift.types.usage_limit_feature_type.UsageLimitFeatureType"
    ] = None,
    limit_type: Optional[
        "capo_redshift.types.usage_limit_limit_type.UsageLimitLimitType"
    ] = None,
    amount: Optional["capo_redshift.types.long.Long"] = None,
    period: Optional[
        "capo_redshift.types.usage_limit_period.UsageLimitPeriod"
    ] = None,
    breach_action: Optional[
        "capo_redshift.types.usage_limit_breach_action.UsageLimitBreachAction"
    ] = None,
    tags: Optional["capo_redshift.types.tag_list.TagList"] = None,
) -> "capo_redshift.types.usage_limit.UsageLimit":
    """<p>Creates a usage limit for a specified Amazon Redshift feature on a cluster. The usage limit is identified by the returned usage limit identifier.</p>

    Args:
        cluster_identifier: <p>The identifier of the cluster that you want to limit usage.</p>
        feature_type: <p>The Amazon Redshift feature that you want to limit.</p>
        limit_type: <p>The type of limit. Depending on the feature type, this can be based on a time duration or data size. If <code>FeatureType</code> is <code>spectrum</code>, then <code>LimitType</code> must be <code>data-scanned</code>. If <code>FeatureType</code> is <code>concurrency-scaling</code>, then <code>LimitType</code> must be <code>time</code>. If <code>FeatureType</code> is <code>cross-region-datasharing</code>, then <code>LimitType</code> must be <code>data-scanned</code>. If <code>FeatureType</code> is <code>extra-compute-for-automatic-optimization</code>, then <code>LimitType</code> must be <code>time</code>. </p>
        amount: <p>The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). The value must be a positive number. </p>
        period: <p>The time period that the amount applies to. A <code>weekly</code> period begins on Sunday. The default is <code>monthly</code>. </p>
        breach_action: <p>The action that Amazon Redshift takes when the limit is reached. The default is log. For more information about this parameter, see <a>UsageLimit</a>.</p>
        tags: <p>A list of tag instances.</p>

    Raises:
        capo_redshift.errors.cluster_not_found_fault.ClusterNotFoundFault: <p>The <code>ClusterIdentifier</code> parameter does not refer to an existing cluster. </p>
        capo_redshift.errors.invalid_cluster_state_fault.InvalidClusterStateFault: <p>The specified cluster is not in the <code>available</code> state. </p>
        capo_redshift.errors.invalid_usage_limit_fault.InvalidUsageLimitFault: <p>The usage limit is not valid.</p>
        capo_redshift.errors.limit_exceeded_fault.LimitExceededFault: <p>The encryption key has exceeded its grant limit in Amazon Web Services KMS.</p>
        capo_redshift.errors.tag_limit_exceeded_fault.TagLimitExceededFault: <p>You have exceeded the number of tags allowed.</p>
        capo_redshift.errors.unsupported_operation_fault.UnsupportedOperationFault: <p>The requested operation isn't supported.</p>
        capo_redshift.errors.usage_limit_already_exists_fault.UsageLimitAlreadyExistsFault: <p>The usage limit already exists. </p>
        capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_redshift.types.create_usage_limit_message.CreateUsageLimitMessage]",
    ) -> AsyncOperationResponse["capo_redshift.types.usage_limit.UsageLimit"]:
        import capo_redshift._operations.redshift_service_version20121201.create_usage_limit

        (
            output,
            http_response,
        ) = await capo_redshift._operations.redshift_service_version20121201.create_usage_limit.async_create_usage_limit(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateUsageLimit")
    )
    input_: capo_redshift.types.create_usage_limit_message.CreateUsageLimitMessage = {}
    if cluster_identifier is not None:
        input_["cluster_identifier"] = cluster_identifier
    if feature_type is not None:
        input_["feature_type"] = feature_type
    if limit_type is not None:
        input_["limit_type"] = limit_type
    if amount is not None:
        input_["amount"] = amount
    if period is not None:
        input_["period"] = period
    if breach_action is not None:
        input_["breach_action"] = breach_action
    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