codecraftai-credentials 1.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. ccai/credentials/__init__.py +13 -0
  2. ccai/credentials/apitokencredential.py +86 -0
  3. ccai/credentials/awsaccesskeycredential.py +105 -0
  4. ccai/credentials/azureclientsecretcredential.py +116 -0
  5. ccai/credentials/azuremanagedidentitycredential.py +131 -0
  6. ccai/credentials/azureserviceprincipalcredential.py +150 -0
  7. ccai/credentials/basecredential.py +187 -0
  8. ccai/credentials/basiccredential.py +104 -0
  9. ccai/credentials/coreweaveapicredential.py +130 -0
  10. ccai/credentials/credentialmanager.py +453 -0
  11. ccai/credentials/crusoeapikeycredential.py +131 -0
  12. ccai/credentials/digitaloceanapitokencredential.py +181 -0
  13. ccai/credentials/equinixmetalapitokencredential.py +113 -0
  14. ccai/credentials/gcpserviceaccountkeycredential.py +188 -0
  15. ccai/credentials/gcpworkloadidentitycredential.py +173 -0
  16. ccai/credentials/githubappcredential.py +167 -0
  17. ccai/credentials/githubtokencredential.py +106 -0
  18. ccai/credentials/hetznerapitokencredential.py +113 -0
  19. ccai/credentials/lambdalabsapikeycredential.py +113 -0
  20. ccai/credentials/linodeapitokencredential.py +113 -0
  21. ccai/credentials/nebiusserviceaccountcredential.py +113 -0
  22. ccai/credentials/nutanixprismcredential.py +161 -0
  23. ccai/credentials/oraclecloudapikeycredential.py +211 -0
  24. ccai/credentials/personalapitokencredential.py +101 -0
  25. ccai/credentials/proxmoxapitokencredential.py +145 -0
  26. ccai/credentials/publickeycredential.py +104 -0
  27. ccai/credentials/py.typed +0 -0
  28. ccai/credentials/runpodapikeycredential.py +113 -0
  29. ccai/credentials/secrettokencredential.py +103 -0
  30. ccai/credentials/sshcredential.py +221 -0
  31. ccai/credentials/tailscaleauthkeycredential.py +145 -0
  32. ccai/credentials/tailscaleoauthcredential.py +139 -0
  33. ccai/credentials/twingateserviceaccountcredential.py +146 -0
  34. ccai/credentials/venueregistry.py +89 -0
  35. ccai/credentials/vspherecredential.py +178 -0
  36. ccai/credentials/vultrapikeycredential.py +113 -0
  37. ccai/credentials/wellknown.py +160 -0
  38. ccai/credentials/wifichoicecredential.py +107 -0
  39. codecraftai_credentials-1.2.0.dist-info/METADATA +88 -0
  40. codecraftai_credentials-1.2.0.dist-info/RECORD +42 -0
  41. codecraftai_credentials-1.2.0.dist-info/WHEEL +4 -0
  42. codecraftai_credentials-1.2.0.dist-info/licenses/LICENSE.md +204 -0
@@ -0,0 +1,167 @@
1
+ """
2
+ .. module:: githubappcredential
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module that contains the :class:`GithubAppCredential` which represents
5
+ a GitHub application private key credential.
6
+
7
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+ """
9
+
10
+ __author__ = "Myron Walker"
11
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
12
+ __credits__ = []
13
+
14
+ from typing import Any, Dict, List, Optional, Tuple
15
+
16
+ import os
17
+
18
+ from ccai.errors.exceptions import ConfigurationError
19
+
20
+ from ccai.credentials.basecredential import BaseCredential
21
+
22
+
23
+ class GithubAppCredential(BaseCredential):
24
+ """
25
+ The :class:`GithubAppCredential` is a container object for GitHub application
26
+ credentials.
27
+
28
+ .. code:: yaml
29
+ "identifier": "github-app"
30
+ "category": "github-app"
31
+ "keyfiles": ["~/.config/github/app.pem"]
32
+ "keys": ["-----BEGIN PRIVATE KEY-----..."]
33
+ "keypasswd": ["password1"]
34
+ """
35
+
36
+ # 'keys' holds the raw PEM private-key strings and is not matched by the
37
+ # sensitive field-name heuristic; 'keypasswd' is already caught by it.
38
+ SECRET_FIELDS = ("keys",)
39
+
40
+ def __init__(self, *, identifier: str, categories: List[str],
41
+ keyfiles: Optional[List[str]] = None,
42
+ keys: Optional[List[str]] = None,
43
+ keypasswd: Optional[List[Optional[str]]] = None,
44
+ role: Optional[str] = "priv"):
45
+ """
46
+ Initializes a :class:`GithubAppCredential` instance.
47
+
48
+ :param identifier: The identifier that is used to reference this credential. (required)
49
+ :param categories: The categories of authentication that are supported by the credential
50
+ :param keyfiles: A list of private key files that can be used to authenticate with GitHub as an app
51
+ :param keys: A list of raw private keys that can be used to authenticate with GitHub
52
+ :param keypasswd: Optional list of passwords for the key files.
53
+ """
54
+ super().__init__(identifier=identifier, categories=categories, role=role)
55
+
56
+ if "github-app" not in categories:
57
+ raise ConfigurationError("The GithubAppCredential should only be given credentials of category 'github-app'.")
58
+
59
+ if (not keyfiles or len(keyfiles) == 0) and (not keys or len(keys) == 0):
60
+ raise ConfigurationError("The GithubAppCredential constructor requires either 'keyfiles' or 'keys' parameter be provided.")
61
+
62
+ self._keyfiles = keyfiles or []
63
+ self._explicit_keys = list(keys) if keys else []
64
+ self._loaded_keys = []
65
+ self._keypasswd = keypasswd
66
+
67
+ if keyfiles:
68
+ for kfile in keyfiles:
69
+ abs_kfile = os.path.abspath(os.path.expandvars(os.path.expanduser(kfile)))
70
+ if not os.path.exists(abs_kfile):
71
+ errmsg = f"GithubAppCredential keyfile '{abs_kfile}' does not exist."
72
+ raise ConfigurationError(errmsg)
73
+ with open(abs_kfile, "r") as rpf:
74
+ kdata = rpf.read()
75
+ self._loaded_keys.append(kdata)
76
+
77
+ return
78
+
79
+ @property
80
+ def keyfiles(self) -> List[str]:
81
+ """
82
+ Returns the list of key file paths used by this credential.
83
+
84
+ :returns: List of key file paths.
85
+ """
86
+ return self._keyfiles
87
+
88
+ @property
89
+ def keys(self) -> List[str]:
90
+ """
91
+ Returns the list of private keys associated with this credential.
92
+
93
+ :returns: List of private key strings.
94
+ """
95
+ rtnval = self._explicit_keys + self._loaded_keys
96
+ return rtnval
97
+
98
+ @property
99
+ def keypasswd(self) -> Optional[List[Optional[str]]]:
100
+ """
101
+ Returns the list of passwords associated with the key files if provided.
102
+
103
+ :returns: List of key file passwords or ``None``.
104
+ """
105
+ return self._keypasswd
106
+
107
+ @classmethod
108
+ def validate(cls, cred_info: Dict[str, Any]) -> Tuple[List[str], List[str]]:
109
+ """
110
+ Validates the dictionary describing a GitHub application credential.
111
+
112
+ :param cred_info: The credential information dictionary to validate.
113
+
114
+ :returns: A tuple of lists containing errors and warnings.
115
+ """
116
+ errors: List[str] = []
117
+ warnings: List[str] = []
118
+
119
+ has_keyfiles = False
120
+ if "keyfiles" in cred_info:
121
+ keyfiles = cred_info["keyfiles"]
122
+ if not isinstance(keyfiles, list):
123
+ errors.append("'keyfiles' must be a list in github-app credential.")
124
+ else:
125
+ has_keyfiles = len(keyfiles) > 0
126
+ for kfile in keyfiles:
127
+ path = os.path.abspath(os.path.expandvars(os.path.expanduser(kfile)))
128
+ if not os.path.exists(path):
129
+ errors.append(f"specified keyfile '{path}' not found.")
130
+
131
+ has_keys = False
132
+ if "keys" in cred_info:
133
+ keys = cred_info["keys"]
134
+ if not isinstance(keys, list):
135
+ errors.append("'keys' must be a list in github-app credential.")
136
+ else:
137
+ has_keys = len(keys) > 0
138
+
139
+ if not has_keyfiles and not has_keys:
140
+ errors.append("either 'keyfiles' or 'keys' must be provided in github-app credential.")
141
+
142
+ if has_keyfiles and "keypasswd" in cred_info:
143
+ keypasswd = cred_info["keypasswd"]
144
+ if not isinstance(keypasswd, list):
145
+ errors.append("'keypasswd' must be a list when 'keyfiles' are specified in github-app credential.")
146
+ elif len(keypasswd) != len(cred_info["keyfiles"]):
147
+ warnings.append("'keypasswd' length does not match 'keyfiles' length in github-app credential.")
148
+ elif has_keyfiles is False and "keypasswd" in cred_info:
149
+ warnings.append("'keypasswd' provided without 'keyfiles' in github-app credential.")
150
+
151
+ return errors, warnings
152
+
153
+ def as_dict(self) -> Dict[str, Any]:
154
+ """
155
+ Returns a dictionary representation of this credential object.
156
+ """
157
+ rtnval = super().as_dict()
158
+
159
+ if len(self._keyfiles) > 0:
160
+ rtnval["keyfiles"] = self._keyfiles
161
+
162
+ rtnval["keys"] = self._explicit_keys
163
+
164
+ if self._keypasswd is not None:
165
+ rtnval["keypasswd"] = self._keypasswd
166
+
167
+ return rtnval
@@ -0,0 +1,106 @@
1
+ """
2
+ .. module:: githubtokencredential
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module that contains the :class:`GithubTokenCredential` which represents
5
+ a GitHub personal access token credential.
6
+
7
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+ """
9
+
10
+ __author__ = "Myron Walker"
11
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
12
+ __credits__ = []
13
+
14
+
15
+ from typing import Any, Dict, List, Optional, Tuple
16
+
17
+ from ccai.errors.exceptions import ConfigurationError
18
+
19
+ from ccai.credentials.basecredential import BaseCredential
20
+
21
+
22
+ class GithubTokenCredential(BaseCredential):
23
+ """
24
+ The :class:`GithubTokenCredential` is a container object for a GitHub personal
25
+ access token. This credential can be used to authenticate GitHub REST API
26
+ requests by placing the token value in the ``Authorization`` header.
27
+
28
+ .. code:: yaml
29
+ "identifier": "gh-token"
30
+ "category": "github-token"
31
+ "token": "ghp_xxxxxxxxxxxxxxxxxxxxx"
32
+ "username": "git"
33
+
34
+ """
35
+
36
+ def __init__(self, *, identifier: str, categories: List[str], token: str,
37
+ username: str = "git", role: Optional[str] = "priv"):
38
+ """
39
+ Initializes a :class:`GithubTokenCredential` instance.
40
+
41
+ :param identifier: The identifier that is used to reference this credential. (required)
42
+ :param categories: The categories of authentication that are supported by the credential.
43
+ :param token: A GitHub personal access token used to authenticate REST API requests.
44
+ :param username: Optional username for logging and tracking purposes. GitHub does not
45
+ verify the username for personal access tokens. Defaults to ``'git'``.
46
+ """
47
+ super().__init__(identifier=identifier, categories=categories, role=role)
48
+
49
+ if "github-token" not in categories:
50
+ raise ConfigurationError(
51
+ "The GithubTokenCredential should only be given credentials of category 'github-token'."
52
+ )
53
+ if token is None or len(token) == 0:
54
+ raise ConfigurationError("The GithubTokenCredential constructor requires a 'token' parameter be provided.")
55
+
56
+ self._token = token
57
+ self._username = username
58
+ return
59
+
60
+ @property
61
+ def token(self) -> str:
62
+ """
63
+ Returns the GitHub personal access token.
64
+
65
+ :returns: The token string.
66
+ """
67
+ return self._token
68
+
69
+ @property
70
+ def username(self) -> str:
71
+ """
72
+ Returns the username associated with this credential.
73
+
74
+ :returns: The username string.
75
+ """
76
+ return self._username
77
+
78
+ @classmethod
79
+ def validate(cls, cred_info: Dict[str, Any]) -> Tuple[List[str], List[str]]:
80
+ """
81
+ Validates the dictionary describing a GitHub token credential.
82
+
83
+ :param cred_info: Credential definition dictionary to validate.
84
+
85
+ :returns: A tuple of lists containing errors and warnings.
86
+ """
87
+
88
+ errors: List[str] = []
89
+ warnings: List[str] = []
90
+
91
+ if "token" not in cred_info:
92
+ errors.append("missing 'token' in github token credential.")
93
+
94
+ return errors, warnings
95
+
96
+ def as_dict(self) -> Dict[str, Any]:
97
+ """
98
+ Returns a dictionary representation of this credential object.
99
+ """
100
+ rtnval = super().as_dict()
101
+
102
+ rtnval["token"] = self._token
103
+ rtnval["username"] = self._username
104
+
105
+ return rtnval
106
+
@@ -0,0 +1,113 @@
1
+ """
2
+ .. module:: hetznerapitokencredential
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module that contains the :class:`HetznerApiTokenCredential` which
5
+ wraps the Hetzner Cloud venue API-token authentication material.
6
+
7
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+ """
9
+
10
+ __author__ = "Myron Walker"
11
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
12
+ __credits__ = []
13
+
14
+
15
+ from typing import Any, Dict, List, Optional, Tuple
16
+
17
+ import os
18
+
19
+ from ccai.errors.exceptions import ConfigurationError
20
+
21
+ from ccai.credentials.basecredential import BaseCredential
22
+
23
+
24
+ class HetznerApiTokenCredential(BaseCredential):
25
+ """
26
+ The :class:`HetznerApiTokenCredential` is a container object that wraps the
27
+ Hetzner Cloud venue API-token authentication material.
28
+
29
+ .. code:: yaml
30
+ "identifier": "hetzner-token"
31
+ "category": "cloud-venue"
32
+ "provider": "hetzner"
33
+ "token": "..."
34
+
35
+ """
36
+
37
+ def __init__(self, *, identifier: str, categories: List[str], token: str,
38
+ role: Optional[str] = "priv") -> None:
39
+ """
40
+ Initializes a :class:`HetznerApiTokenCredential` instance.
41
+
42
+ :param identifier: The identifier that is used to reference this credential. (required)
43
+ :param categories: The categories of authentication that are supported by the credential.
44
+ :param token: The Hetzner Cloud API token value.
45
+ :param role: Identifies the role of the credential.
46
+
47
+ :raises: ConfigurationError
48
+ """
49
+ super().__init__(identifier=identifier, categories=categories, role=role)
50
+
51
+ if "cloud-venue" not in categories:
52
+ errmsg_lines = [
53
+ "The HetznerApiTokenCredential should be given credentials of category 'cloud-venue'.",
54
+ "MISSING CATEGORY: cloud-venue",
55
+ ]
56
+ errmsg = os.linesep.join(errmsg_lines)
57
+ raise ConfigurationError(errmsg)
58
+
59
+ if token is None or len(token) == 0:
60
+ raise ConfigurationError("The HetznerApiTokenCredential constructor requires a non-empty 'token' parameter be provided.")
61
+
62
+ self._token = token
63
+ return
64
+
65
+ @property
66
+ def token(self) -> str:
67
+ """
68
+ Returns the Hetzner Cloud API token value.
69
+
70
+ :returns: The API token string.
71
+ """
72
+ return self._token
73
+
74
+ @classmethod
75
+ def validate(cls, cred_info: Dict[str, Any]) -> Tuple[List[str], List[str]]:
76
+ """
77
+ Validates the dictionary describing a Hetzner Cloud API-token credential.
78
+
79
+ :param cred_info: Credential definition dictionary to validate.
80
+
81
+ :returns: A tuple of lists containing errors and warnings.
82
+ """
83
+
84
+ errors = []
85
+ warnings = []
86
+
87
+ if "token" not in cred_info:
88
+ errors.append("missing 'token' in hetzner-api-token credential.")
89
+
90
+ return errors, warnings
91
+
92
+ def as_dict(self) -> Dict[str, Any]:
93
+ """
94
+ Returns a dictionary representation of this credential object.
95
+ """
96
+ rtnval = super().as_dict()
97
+
98
+ rtnval["token"] = self._token
99
+
100
+ return rtnval
101
+
102
+ def __repr__(self) -> str:
103
+ """
104
+ Returns a debug representation of this credential with the token redacted.
105
+
106
+ :returns: A redacted string representation safe for logs.
107
+ """
108
+ rtnval = (
109
+ "HetznerApiTokenCredential("
110
+ "identifier={!r}, categories={!r}, token='***')"
111
+ ).format(self._identifier, self._categories)
112
+
113
+ return rtnval
@@ -0,0 +1,113 @@
1
+ """
2
+ .. module:: lambdalabsapikeycredential
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module that contains the :class:`LambdalabsApiKeyCredential` which
5
+ wraps the Lambda Labs venue API-key authentication material.
6
+
7
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+ """
9
+
10
+ __author__ = "Myron Walker"
11
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
12
+ __credits__ = []
13
+
14
+
15
+ from typing import Any, Dict, List, Optional, Tuple
16
+
17
+ import os
18
+
19
+ from ccai.errors.exceptions import ConfigurationError
20
+
21
+ from ccai.credentials.basecredential import BaseCredential
22
+
23
+
24
+ class LambdalabsApiKeyCredential(BaseCredential):
25
+ """
26
+ The :class:`LambdalabsApiKeyCredential` is a container object that wraps the
27
+ Lambda Labs venue API-key authentication material.
28
+
29
+ .. code:: yaml
30
+ "identifier": "lambdalabs-key"
31
+ "category": "hpc-venue"
32
+ "provider": "lambdalabs"
33
+ "token": "secret_..."
34
+
35
+ """
36
+
37
+ def __init__(self, *, identifier: str, categories: List[str], token: str,
38
+ role: Optional[str] = "priv") -> None:
39
+ """
40
+ Initializes a :class:`LambdalabsApiKeyCredential` instance.
41
+
42
+ :param identifier: The identifier that is used to reference this credential. (required)
43
+ :param categories: The categories of authentication that are supported by the credential.
44
+ :param token: The Lambda Labs API key value.
45
+ :param role: Identifies the role of the credential.
46
+
47
+ :raises: ConfigurationError
48
+ """
49
+ super().__init__(identifier=identifier, categories=categories, role=role)
50
+
51
+ if "hpc-venue" not in categories:
52
+ errmsg_lines = [
53
+ "The LambdalabsApiKeyCredential should be given credentials of category 'hpc-venue'.",
54
+ "MISSING CATEGORY: hpc-venue",
55
+ ]
56
+ errmsg = os.linesep.join(errmsg_lines)
57
+ raise ConfigurationError(errmsg)
58
+
59
+ if token is None or len(token) == 0:
60
+ raise ConfigurationError("The LambdalabsApiKeyCredential constructor requires a non-empty 'token' parameter be provided.")
61
+
62
+ self._token = token
63
+ return
64
+
65
+ @property
66
+ def token(self) -> str:
67
+ """
68
+ Returns the Lambda Labs API key value.
69
+
70
+ :returns: The API key token string.
71
+ """
72
+ return self._token
73
+
74
+ @classmethod
75
+ def validate(cls, cred_info: Dict[str, Any]) -> Tuple[List[str], List[str]]:
76
+ """
77
+ Validates the dictionary describing a Lambda Labs API-key credential.
78
+
79
+ :param cred_info: Credential definition dictionary to validate.
80
+
81
+ :returns: A tuple of lists containing errors and warnings.
82
+ """
83
+
84
+ errors = []
85
+ warnings = []
86
+
87
+ if "token" not in cred_info:
88
+ errors.append("missing 'token' in lambdalabs-api-key credential.")
89
+
90
+ return errors, warnings
91
+
92
+ def as_dict(self) -> Dict[str, Any]:
93
+ """
94
+ Returns a dictionary representation of this credential object.
95
+ """
96
+ rtnval = super().as_dict()
97
+
98
+ rtnval["token"] = self._token
99
+
100
+ return rtnval
101
+
102
+ def __repr__(self) -> str:
103
+ """
104
+ Returns a debug representation of this credential with the token redacted.
105
+
106
+ :returns: A redacted string representation safe for logs.
107
+ """
108
+ rtnval = (
109
+ "LambdalabsApiKeyCredential("
110
+ "identifier={!r}, categories={!r}, token='***')"
111
+ ).format(self._identifier, self._categories)
112
+
113
+ return rtnval
@@ -0,0 +1,113 @@
1
+ """
2
+ .. module:: linodeapitokencredential
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module that contains the :class:`LinodeApiTokenCredential` which
5
+ wraps the Linode venue API-token authentication material.
6
+
7
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+ """
9
+
10
+ __author__ = "Myron Walker"
11
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
12
+ __credits__ = []
13
+
14
+
15
+ from typing import Any, Dict, List, Optional, Tuple
16
+
17
+ import os
18
+
19
+ from ccai.errors.exceptions import ConfigurationError
20
+
21
+ from ccai.credentials.basecredential import BaseCredential
22
+
23
+
24
+ class LinodeApiTokenCredential(BaseCredential):
25
+ """
26
+ The :class:`LinodeApiTokenCredential` is a container object that wraps the
27
+ Linode venue API-token authentication material.
28
+
29
+ .. code:: yaml
30
+ "identifier": "linode-token"
31
+ "category": "cloud-venue"
32
+ "provider": "linode"
33
+ "token": "..."
34
+
35
+ """
36
+
37
+ def __init__(self, *, identifier: str, categories: List[str], token: str,
38
+ role: Optional[str] = "priv") -> None:
39
+ """
40
+ Initializes a :class:`LinodeApiTokenCredential` instance.
41
+
42
+ :param identifier: The identifier that is used to reference this credential. (required)
43
+ :param categories: The categories of authentication that are supported by the credential.
44
+ :param token: The Linode API token value.
45
+ :param role: Identifies the role of the credential.
46
+
47
+ :raises: ConfigurationError
48
+ """
49
+ super().__init__(identifier=identifier, categories=categories, role=role)
50
+
51
+ if "cloud-venue" not in categories:
52
+ errmsg_lines = [
53
+ "The LinodeApiTokenCredential should be given credentials of category 'cloud-venue'.",
54
+ "MISSING CATEGORY: cloud-venue",
55
+ ]
56
+ errmsg = os.linesep.join(errmsg_lines)
57
+ raise ConfigurationError(errmsg)
58
+
59
+ if token is None or len(token) == 0:
60
+ raise ConfigurationError("The LinodeApiTokenCredential constructor requires a non-empty 'token' parameter be provided.")
61
+
62
+ self._token = token
63
+ return
64
+
65
+ @property
66
+ def token(self) -> str:
67
+ """
68
+ Returns the Linode API token value.
69
+
70
+ :returns: The API token string.
71
+ """
72
+ return self._token
73
+
74
+ @classmethod
75
+ def validate(cls, cred_info: Dict[str, Any]) -> Tuple[List[str], List[str]]:
76
+ """
77
+ Validates the dictionary describing a Linode API-token credential.
78
+
79
+ :param cred_info: Credential definition dictionary to validate.
80
+
81
+ :returns: A tuple of lists containing errors and warnings.
82
+ """
83
+
84
+ errors = []
85
+ warnings = []
86
+
87
+ if "token" not in cred_info:
88
+ errors.append("missing 'token' in linode-api-token credential.")
89
+
90
+ return errors, warnings
91
+
92
+ def as_dict(self) -> Dict[str, Any]:
93
+ """
94
+ Returns a dictionary representation of this credential object.
95
+ """
96
+ rtnval = super().as_dict()
97
+
98
+ rtnval["token"] = self._token
99
+
100
+ return rtnval
101
+
102
+ def __repr__(self) -> str:
103
+ """
104
+ Returns a debug representation of this credential with the token redacted.
105
+
106
+ :returns: A redacted string representation safe for logs.
107
+ """
108
+ rtnval = (
109
+ "LinodeApiTokenCredential("
110
+ "identifier={!r}, categories={!r}, token='***')"
111
+ ).format(self._identifier, self._categories)
112
+
113
+ return rtnval