Coverage for mlos_bench/mlos_bench/services/types/authenticator_type.py: 100%
7 statements
« prev ^ index » next coverage.py v7.6.7, created at 2024-11-22 01:18 +0000
« prev ^ index » next coverage.py v7.6.7, created at 2024-11-22 01:18 +0000
1#
2# Copyright (c) Microsoft Corporation.
3# Licensed under the MIT License.
4#
5"""Protocol interface for authentication for the cloud services."""
7from typing import Protocol, TypeVar, runtime_checkable
9T_co = TypeVar("T_co", covariant=True)
12@runtime_checkable
13class SupportsAuth(Protocol[T_co]):
14 """Protocol interface for authentication for the cloud services."""
16 def get_access_token(self) -> str:
17 """
18 Get the access token for cloud services.
20 Returns
21 -------
22 access_token : str
23 Access token.
24 """
26 def get_auth_headers(self) -> dict:
27 """
28 Get the authorization part of HTTP headers for REST API calls.
30 Returns
31 -------
32 access_header : dict
33 HTTP header containing the access token.
34 """
36 def get_credential(self) -> T_co:
37 """
38 Get the credential object for cloud services.
40 Returns
41 -------
42 credential : T_co
43 Cloud-specific credential object.
44 """