Skip to content

modify_client_vpn_endpoint_authorization_policy async

modify_client_vpn_endpoint_authorization_policy(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    client_vpn_endpoint_id: Optional[ClientVpnEndpointId] = None,
    policy_document: Optional[String] = None,
    description: Optional[String] = None,
    shadow_mode: Optional[ClientVpnAuthorizationPolicyShadowMode] = None,
    client_token: Optional[String] = None,
    dry_run: Optional[Boolean] = None,
) -> ModifyClientVpnEndpointAuthorizationPolicyResult

Creates or updates the authorization policy for a Client VPN endpoint. A Client VPN endpoint can have one authorization policy. If a policy already exists for the endpoint, the values that you specify replace the corresponding values in the existing policy, and values that you do not specify remain unchanged.

Parameters:

  • client_vpn_endpoint_id (Optional[ClientVpnEndpointId], default: None ) –

    The ID of the Client VPN endpoint.

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

    The authorization policy document, written in the Cedar policy language. This parameter is required when you create the authorization policy for a Client VPN endpoint that does not already have one.

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

    A brief description of the authorization policy.

  • shadow_mode (Optional[ClientVpnAuthorizationPolicyShadowMode], default: None ) –

    Specifies whether the authorization policy is evaluated in shadow mode. Possible values include:

    • enabled - The authorization policy is evaluated and the results are logged, but access is not enforced.

    • disabled - The authorization policy is enforced.

    The default value is disabled.

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

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.

  • 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 modify_client_vpn_endpoint_authorization_policy(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    client_vpn_endpoint_id: Optional[
        "capo_ec2.types.client_vpn_endpoint_id.ClientVpnEndpointId"
    ] = None,
    policy_document: Optional["capo_ec2.types.string.String"] = None,
    description: Optional["capo_ec2.types.string.String"] = None,
    shadow_mode: Optional[
        "capo_ec2.types.client_vpn_authorization_policy_shadow_mode.ClientVpnAuthorizationPolicyShadowMode"
    ] = None,
    client_token: Optional["capo_ec2.types.string.String"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.modify_client_vpn_endpoint_authorization_policy_result.ModifyClientVpnEndpointAuthorizationPolicyResult":
    """<p>Creates or updates the authorization policy for a Client VPN endpoint. A Client VPN endpoint can have one authorization policy. If a policy already exists for the endpoint, the values that you specify replace the corresponding values in the existing policy, and values that you do not specify remain unchanged.</p>

    Args:
        client_vpn_endpoint_id: <p>The ID of the Client VPN endpoint.</p>
        policy_document: <p>The authorization policy document, written in the Cedar policy language. This parameter is required when you create the authorization policy for a Client VPN endpoint that does not already have one.</p>
        description: <p>A brief description of the authorization policy.</p>
        shadow_mode: <p>Specifies whether the authorization policy is evaluated in shadow mode. Possible values include:</p> <ul> <li> <p> <code>enabled</code> - The authorization policy is evaluated and the results are logged, but access is not enforced.</p> </li> <li> <p> <code>disabled</code> - The authorization policy is enforced.</p> </li> </ul> <p>The default value is <code>disabled</code>.</p>
        client_token: <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</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.modify_client_vpn_endpoint_authorization_policy_request.ModifyClientVpnEndpointAuthorizationPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.modify_client_vpn_endpoint_authorization_policy_result.ModifyClientVpnEndpointAuthorizationPolicyResult"
    ]:
        import capo_ec2._operations.amazon_ec2.modify_client_vpn_endpoint_authorization_policy

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

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ModifyClientVpnEndpointAuthorizationPolicy"),
    )
    input_: capo_ec2.types.modify_client_vpn_endpoint_authorization_policy_request.ModifyClientVpnEndpointAuthorizationPolicyRequest = {}
    if client_vpn_endpoint_id is not None:
        input_["client_vpn_endpoint_id"] = client_vpn_endpoint_id
    if policy_document is not None:
        input_["policy_document"] = policy_document
    if description is not None:
        input_["description"] = description
    if shadow_mode is not None:
        input_["shadow_mode"] = shadow_mode
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    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