Skip to content

enable_aws_network_performance_metric_subscription async

enable_aws_network_performance_metric_subscription(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    source: Optional[String] = None,
    destination: Optional[String] = None,
    metric: Optional[MetricType] = None,
    statistic: Optional[StatisticType] = None,
    dry_run: Optional[Boolean] = None,
) -> EnableAwsNetworkPerformanceMetricSubscriptionResult

Enables Infrastructure Performance subscriptions.

Parameters:

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

    The source Region (like us-east-1) or Availability Zone ID (like use1-az1) that the metric subscription is enabled for. If you use Availability Zone IDs, the Source and Destination Availability Zones must be in the same Region.

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

    The target Region (like us-east-2) or Availability Zone ID (like use2-az2) that the metric subscription is enabled for. If you use Availability Zone IDs, the Source and Destination Availability Zones must be in the same Region.

  • metric (Optional[MetricType], default: None ) –

    The metric used for the enabled subscription.

  • statistic (Optional[StatisticType], default: None ) –

    The statistic used for the enabled subscription.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def enable_aws_network_performance_metric_subscription(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    source: Optional["capo_ec2.types.string.String"] = None,
    destination: Optional["capo_ec2.types.string.String"] = None,
    metric: Optional["capo_ec2.types.metric_type.MetricType"] = None,
    statistic: Optional["capo_ec2.types.statistic_type.StatisticType"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.enable_aws_network_performance_metric_subscription_result.EnableAwsNetworkPerformanceMetricSubscriptionResult":
    """<p>Enables Infrastructure Performance subscriptions.</p>

    Args:
        source: <p>The source Region (like <code>us-east-1</code>) or Availability Zone ID (like <code>use1-az1</code>) that the metric subscription is enabled for. If you use Availability Zone IDs, the Source and Destination Availability Zones must be in the same Region.</p>
        destination: <p>The target Region (like <code>us-east-2</code>) or Availability Zone ID (like <code>use2-az2</code>) that the metric subscription is enabled for. If you use Availability Zone IDs, the Source and Destination Availability Zones must be in the same Region.</p>
        metric: <p>The metric used for the enabled subscription.</p>
        statistic: <p>The statistic used for the enabled subscription.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.enable_aws_network_performance_metric_subscription_request.EnableAwsNetworkPerformanceMetricSubscriptionRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.enable_aws_network_performance_metric_subscription_result.EnableAwsNetworkPerformanceMetricSubscriptionResult"
    ]:
        import capo_ec2._operations.amazon_ec2.enable_aws_network_performance_metric_subscription

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.enable_aws_network_performance_metric_subscription.async_enable_aws_network_performance_metric_subscription(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("EnableAwsNetworkPerformanceMetricSubscription"),
    )
    input_: capo_ec2.types.enable_aws_network_performance_metric_subscription_request.EnableAwsNetworkPerformanceMetricSubscriptionRequest = {}
    if source is not None:
        input_["source"] = source
    if destination is not None:
        input_["destination"] = destination
    if metric is not None:
        input_["metric"] = metric
    if statistic is not None:
        input_["statistic"] = statistic
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output