Skip to content

authorize_ip_rules async

authorize_ip_rules(
    group_id: IpGroupId,
    user_rules: IpRuleList,
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> AuthorizeIpRulesResult

Adds one or more rules to the specified IP access control group.

This action gives users permission to access their WorkSpaces from the CIDR address ranges specified in the rules.

Parameters:

  • group_id (IpGroupId) –

    The identifier of the group.

  • user_rules (IpRuleList) –

    The rules to add to the group.

Raises:

Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
async def authorize_ip_rules(
    self,
    group_id: "capo_workspaces.types.ip_group_id.IpGroupId",
    user_rules: "capo_workspaces.types.ip_rule_list.IpRuleList",
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> "capo_workspaces.types.authorize_ip_rules_result.AuthorizeIpRulesResult":
    """<p>Adds one or more rules to the specified IP access control group.</p> <p>This action gives users permission to access their WorkSpaces from the CIDR address ranges specified in the rules.</p>

    Args:
        group_id: <p>The identifier of the group.</p>
        user_rules: <p>The rules to add to the group.</p>

    Raises:
        capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
        capo_workspaces.errors.invalid_parameter_values_exception.InvalidParameterValuesException: <p>One or more parameter values are not valid.</p>
        capo_workspaces.errors.invalid_resource_state_exception.InvalidResourceStateException: <p>The state of the resource is not valid for this operation.</p>
        capo_workspaces.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>Your resource limits have been exceeded.</p>
        capo_workspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workspaces.types.authorize_ip_rules_request.AuthorizeIpRulesRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces.types.authorize_ip_rules_result.AuthorizeIpRulesResult"
    ]:
        import capo_workspaces._operations.workspaces_service.authorize_ip_rules

        (
            output,
            http_response,
        ) = await capo_workspaces._operations.workspaces_service.authorize_ip_rules.async_authorize_ip_rules(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AuthorizeIpRules")
    )
    input_: capo_workspaces.types.authorize_ip_rules_request.AuthorizeIpRulesRequest = {
        "group_id": group_id,
        "user_rules": user_rules,
    }

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