Skip to content

update_attachment_nat_configuration

update_attachment_nat_configuration(
    attachment_id: AttachmentId,
    *,
    config_overrides: Optional[NetworkManagerClientConfig] = None,
    nat_gateway_support: Optional[NatGatewaySupportValue] = None,
    nat_system_route_support: Optional[BoxedBoolean] = None,
    nat_gateway_rules: Optional[NatRuleRequestList] = None,
    client_token: Optional[ClientToken] = None,
) -> UpdateAttachmentNatConfigurationResponse

Updates the NAT configuration of a core network attachment. You can enable or disable NAT gateway support, specify whether the core network installs system routes for the NAT CIDR blocks, and replace the NAT rules of the attachment. Specify at least one of NatGatewaySupport, NatSystemRouteSupport, or NatGatewayRules.

Only the core network owner can update the NAT configuration of an attachment. The attachment must be in the AVAILABLE, PENDING_ATTACHMENT_ACCEPTANCE, or PENDING_TAG_ACCEPTANCE state. Changes are applied asynchronously, and the attachment is in the UPDATING state while they are applied. If the attachment is pending acceptance, the NAT configuration is stored and is applied after the attachment is accepted.

Parameters:

  • attachment_id (AttachmentId) –

    The ID of the attachment to update the NAT configuration for.

  • nat_gateway_support (Optional[NatGatewaySupportValue], default: None ) –

    Specifies whether to enable or disable NAT gateway support on the attachment. When you disable NAT gateway support, the attachment keeps its NAT rules but doesn't apply them. To enable NAT gateway support, the attachment must have at least one NAT rule, either specified in this request or already configured on the attachment. If you omit this parameter, NAT gateway support is unchanged.

  • nat_system_route_support (Optional[BoxedBoolean], default: None ) –

    Specifies whether the core network installs system routes for the NAT CIDR blocks of the attachment's NAT rules. System routes have a route type of SYSTEM. NAT is applied to traffic whether or not this option is enabled. If you omit this parameter, the current value is unchanged.

  • nat_gateway_rules (Optional[NatRuleRequestList], default: None ) –

    The complete set of NAT rules for the attachment, up to 50 rules. The rules that you specify replace the existing rules of the attachment, matched by rule number. Existing rules that aren't included in the request are deleted. To delete all NAT rules, specify an empty list. You can delete all NAT rules only when NAT gateway support is disabled, or when you disable it in the same request. If you omit this parameter, the existing rules are unchanged.

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

    The client token associated with the request.

Raises:

Source code in docs_src/capo_networkmanager/_services/network_manager.py
def update_attachment_nat_configuration(
    self,
    attachment_id: "capo_networkmanager.types.attachment_id.AttachmentId",
    *,
    config_overrides: Optional[NetworkManagerClientConfig] = None,
    nat_gateway_support: Optional[
        "capo_networkmanager.types.nat_gateway_support_value.NatGatewaySupportValue"
    ] = None,
    nat_system_route_support: Optional[
        "capo_networkmanager.types.boxed_boolean.BoxedBoolean"
    ] = None,
    nat_gateway_rules: Optional[
        "capo_networkmanager.types.nat_rule_request_list.NatRuleRequestList"
    ] = None,
    client_token: Optional[
        "capo_networkmanager.types.client_token.ClientToken"
    ] = None,
) -> "capo_networkmanager.types.update_attachment_nat_configuration_response.UpdateAttachmentNatConfigurationResponse":
    """<p>Updates the NAT configuration of a core network attachment. You can enable or disable NAT gateway support, specify whether the core network installs system routes for the NAT CIDR blocks, and replace the NAT rules of the attachment. Specify at least one of <code>NatGatewaySupport</code>, <code>NatSystemRouteSupport</code>, or <code>NatGatewayRules</code>.</p> <p>Only the core network owner can update the NAT configuration of an attachment. The attachment must be in the <code>AVAILABLE</code>, <code>PENDING_ATTACHMENT_ACCEPTANCE</code>, or <code>PENDING_TAG_ACCEPTANCE</code> state. Changes are applied asynchronously, and the attachment is in the <code>UPDATING</code> state while they are applied. If the attachment is pending acceptance, the NAT configuration is stored and is applied after the attachment is accepted.</p>

    Args:
        attachment_id: <p>The ID of the attachment to update the NAT configuration for.</p>
        nat_gateway_support: <p>Specifies whether to enable or disable NAT gateway support on the attachment. When you disable NAT gateway support, the attachment keeps its NAT rules but doesn't apply them. To enable NAT gateway support, the attachment must have at least one NAT rule, either specified in this request or already configured on the attachment. If you omit this parameter, NAT gateway support is unchanged.</p>
        nat_system_route_support: <p>Specifies whether the core network installs system routes for the NAT CIDR blocks of the attachment's NAT rules. System routes have a route type of <code>SYSTEM</code>. NAT is applied to traffic whether or not this option is enabled. If you omit this parameter, the current value is unchanged.</p>
        nat_gateway_rules: <p>The complete set of NAT rules for the attachment, up to 50 rules. The rules that you specify replace the existing rules of the attachment, matched by rule number. Existing rules that aren't included in the request are deleted. To delete all NAT rules, specify an empty list. You can delete all NAT rules only when NAT gateway support is disabled, or when you disable it in the same request. If you omit this parameter, the existing rules are unchanged.</p>
        client_token: <p>The client token associated with the request.</p>

    Raises:
        capo_networkmanager.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_networkmanager.errors.conflict_exception.ConflictException: <p>There was a conflict processing the request. Updating or deleting the resource can cause an inconsistent state.</p>
        capo_networkmanager.errors.internal_server_exception.InternalServerException: <p>The request has failed due to an internal error.</p>
        capo_networkmanager.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource could not be found.</p>
        capo_networkmanager.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>A service limit was exceeded.</p>
        capo_networkmanager.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_networkmanager.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints.</p>
        capo_networkmanager.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_networkmanager.types.update_attachment_nat_configuration_request.UpdateAttachmentNatConfigurationRequest]",
    ) -> OperationResponse[
        "capo_networkmanager.types.update_attachment_nat_configuration_response.UpdateAttachmentNatConfigurationResponse"
    ]:
        import capo_networkmanager._operations.network_manager.update_attachment_nat_configuration

        output, http_response = (
            capo_networkmanager._operations.network_manager.update_attachment_nat_configuration.update_attachment_nat_configuration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateAttachmentNatConfiguration")
    )
    input_: capo_networkmanager.types.update_attachment_nat_configuration_request.UpdateAttachmentNatConfigurationRequest = {
        "attachment_id": attachment_id
    }
    if nat_gateway_support is not None:
        input_["nat_gateway_support"] = nat_gateway_support
    if nat_system_route_support is not None:
        input_["nat_system_route_support"] = nat_system_route_support
    if nat_gateway_rules is not None:
        input_["nat_gateway_rules"] = nat_gateway_rules
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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