Beispiel #1
0
def build_healthapi_get_health_status_request(
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    """Get service health status.

    Get service health status.

    See https://aka.ms/azsdk/python/llcwiki for how to incorporate this request builder into your code flow.

    :keyword api_version: Api Version.
    :paramtype api_version: str
    :return: Returns an :class:`~azure.messaging.webpubsubservice.core.rest.HttpRequest` that you will pass to the client's `send_request` method.
     See https://aka.ms/azsdk/python/llcwiki for how to incorporate this response into your code flow.
    :rtype: ~azure.messaging.webpubsubservice.core.rest.HttpRequest
    """
    api_version = kwargs.pop('api_version',
                             "2021-05-01-preview")  # type: Optional[str]

    # Construct URL
    url = kwargs.pop("template_url", '/api/health')

    # Construct parameters
    query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
    if api_version is not None:
        query_parameters['api-version'] = _SERIALIZER.query(
            "api_version", api_version, 'str')

    return HttpRequest(method="HEAD",
                       url=url,
                       params=query_parameters,
                       **kwargs)
Beispiel #2
0
def build_remove_connection_from_group_request(
        hub,  # type: str
        group,  # type: str
        connection_id,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    """Remove a connection from the target group.

    Remove a connection from the target group.

    See https://aka.ms/azsdk/python/llcwiki for how to incorporate this request builder into your code flow.

    :param hub: Target hub name, which should start with alphabetic characters and only contain
     alpha-numeric characters or underscore.
    :type hub: str
    :param group: Target group name, which length should be greater than 0 and less than 1025.
    :type group: str
    :param connection_id: Target connection Id.
    :type connection_id: str
    :keyword api_version: Api Version.
    :paramtype api_version: str
    :return: Returns an :class:`~azure.messaging.webpubsubservice.core.rest.HttpRequest` that you will pass to the client's `send_request` method.
     See https://aka.ms/azsdk/python/llcwiki for how to incorporate this response into your code flow.
    :rtype: ~azure.messaging.webpubsubservice.core.rest.HttpRequest
    """
    api_version = kwargs.pop('api_version',
                             "2021-05-01-preview")  # type: Optional[str]

    # Construct URL
    url = kwargs.pop(
        "template_url",
        '/api/hubs/{hub}/groups/{group}/connections/{connectionId}')
    path_format_arguments = {
        'hub':
        _SERIALIZER.url("hub",
                        hub,
                        'str',
                        pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'),
        'group':
        _SERIALIZER.url("group", group, 'str', max_length=1024, min_length=1),
        'connectionId':
        _SERIALIZER.url("connection_id", connection_id, 'str', min_length=1),
    }
    url = _format_url_section(url, **path_format_arguments)

    # Construct parameters
    query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
    if api_version is not None:
        query_parameters['api-version'] = _SERIALIZER.query(
            "api_version", api_version, 'str')

    return HttpRequest(method="DELETE",
                       url=url,
                       params=query_parameters,
                       **kwargs)
Beispiel #3
0
def build_user_exists_request(
        hub,  # type: str
        user_id,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    """Check if there are any client connections connected for the given user.

    Check if there are any client connections connected for the given user.

    See https://aka.ms/azsdk/python/llcwiki for how to incorporate this request builder into your code flow.

    :param hub: Target hub name, which should start with alphabetic characters and only contain
     alpha-numeric characters or underscore.
    :type hub: str
    :param user_id: Target user Id.
    :type user_id: str
    :keyword api_version: Api Version.
    :paramtype api_version: str
    :return: Returns an :class:`~azure.messaging.webpubsubservice.core.rest.HttpRequest` that you will pass to the client's `send_request` method.
     See https://aka.ms/azsdk/python/llcwiki for how to incorporate this response into your code flow.
    :rtype: ~azure.messaging.webpubsubservice.core.rest.HttpRequest
    """
    api_version = kwargs.pop('api_version',
                             "2021-05-01-preview")  # type: Optional[str]

    # Construct URL
    url = kwargs.pop("template_url", '/api/hubs/{hub}/users/{userId}')
    path_format_arguments = {
        'hub':
        _SERIALIZER.url("hub",
                        hub,
                        'str',
                        pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'),
        'userId':
        _SERIALIZER.url("user_id", user_id, 'str', min_length=1),
    }
    url = _format_url_section(url, **path_format_arguments)

    # Construct parameters
    query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
    if api_version is not None:
        query_parameters['api-version'] = _SERIALIZER.query(
            "api_version", api_version, 'str')

    return HttpRequest(method="HEAD",
                       url=url,
                       params=query_parameters,
                       **kwargs)
Beispiel #4
0
def build_check_permission_request(
        hub,  # type: str
        permission,  # type: Permissions
        connection_id,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    """Check if a connection has permission to the specified action.

    Check if a connection has permission to the specified action.

    See https://aka.ms/azsdk/python/llcwiki for how to incorporate this request builder into your code flow.

    :param hub: Target hub name, which should start with alphabetic characters and only contain
     alpha-numeric characters or underscore.
    :type hub: str
    :param permission: The permission: current supported actions are joinLeaveGroup and
     sendToGroup.
    :type permission: ~Permissions
    :param connection_id: Target connection Id.
    :type connection_id: str
    :keyword target_name: Optional. If not set, get the permission for all targets. If set, get the
     permission for the specific target. The meaning of the target depends on the specific
     permission.
    :paramtype target_name: str
    :keyword api_version: Api Version.
    :paramtype api_version: str
    :return: Returns an :class:`~azure.messaging.webpubsubservice.core.rest.HttpRequest` that you will pass to the client's `send_request` method.
     See https://aka.ms/azsdk/python/llcwiki for how to incorporate this response into your code flow.
    :rtype: ~azure.messaging.webpubsubservice.core.rest.HttpRequest
    """
    target_name = kwargs.pop('target_name', None)  # type: Optional[str]
    api_version = kwargs.pop('api_version',
                             "2021-05-01-preview")  # type: Optional[str]

    # Construct URL
    url = kwargs.pop(
        "template_url",
        '/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}')
    path_format_arguments = {
        'hub':
        _SERIALIZER.url("hub",
                        hub,
                        'str',
                        pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'),
        'permission':
        _SERIALIZER.url("permission", permission, 'str'),
        'connectionId':
        _SERIALIZER.url("connection_id", connection_id, 'str', min_length=1),
    }
    url = _format_url_section(url, **path_format_arguments)

    # Construct parameters
    query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
    if target_name is not None:
        query_parameters['targetName'] = _SERIALIZER.query(
            "target_name", target_name, 'str')
    if api_version is not None:
        query_parameters['api-version'] = _SERIALIZER.query(
            "api_version", api_version, 'str')

    return HttpRequest(method="HEAD",
                       url=url,
                       params=query_parameters,
                       **kwargs)
Beispiel #5
0
def build_send_to_all_request(
        hub,  # type: str
        **kwargs  # type: Any
):
    # type: (...) -> HttpRequest
    """Broadcast content inside request body to all the connected client connections.

    Broadcast content inside request body to all the connected client connections.

    See https://aka.ms/azsdk/python/llcwiki for how to incorporate this request builder into your code flow.

    :param hub: Target hub name, which should start with alphabetic characters and only contain
     alpha-numeric characters or underscore.
    :type hub: str
    :keyword json: The payload body.
    :paramtype json: Any
    :keyword content: The payload body.
    :paramtype content: IO
    :keyword excluded: Excluded connection Ids.
    :paramtype excluded: list[str]
    :keyword api_version: Api Version.
    :paramtype api_version: str
    :return: Returns an :class:`~azure.messaging.webpubsubservice.core.rest.HttpRequest` that you will pass to the client's `send_request` method.
     See https://aka.ms/azsdk/python/llcwiki for how to incorporate this response into your code flow.
    :rtype: ~azure.messaging.webpubsubservice.core.rest.HttpRequest

    Example:
        .. code-block:: python

            # JSON input template you can fill out and use as your `json` input.
            json = "Any (optional)"
    """
    excluded = kwargs.pop('excluded', None)  # type: Optional[List[str]]
    api_version = kwargs.pop('api_version',
                             "2021-05-01-preview")  # type: Optional[str]
    content_type = kwargs.pop("content_type", None)

    # Construct URL
    url = kwargs.pop("template_url", '/api/hubs/{hub}/:send')
    path_format_arguments = {
        'hub':
        _SERIALIZER.url("hub",
                        hub,
                        'str',
                        pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'),
    }
    url = _format_url_section(url, **path_format_arguments)

    # Construct parameters
    query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
    if excluded is not None:
        query_parameters['excluded'] = [
            _SERIALIZER.query("excluded", q, 'str') if q is not None else ''
            for q in excluded
        ]
    if api_version is not None:
        query_parameters['api-version'] = _SERIALIZER.query(
            "api_version", api_version, 'str')

    # Construct headers
    header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
    if content_type is not None:
        header_parameters['Content-Type'] = _SERIALIZER.header(
            "content_type", content_type, 'str')

    return HttpRequest(method="POST",
                       url=url,
                       params=query_parameters,
                       headers=header_parameters,
                       **kwargs)