cribl-control-plane 0.0.26a1__py3-none-any.whl → 0.0.28__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.
Potentially problematic release.
This version of cribl-control-plane might be problematic. Click here for more details.
- cribl_control_plane/_hooks/clientcredentials.py +22 -7
- cribl_control_plane/_version.py +4 -4
- cribl_control_plane/acl.py +203 -0
- cribl_control_plane/auth_sdk.py +9 -176
- cribl_control_plane/branches.py +335 -0
- cribl_control_plane/commits.py +1141 -0
- cribl_control_plane/commits_files.py +371 -0
- cribl_control_plane/configs_versions.py +189 -0
- cribl_control_plane/destinations.py +18 -729
- cribl_control_plane/destinations_pq.py +359 -0
- cribl_control_plane/errors/__init__.py +3 -2
- cribl_control_plane/errors/healthstatus_error.py +1 -1
- cribl_control_plane/groups_configs.py +17 -0
- cribl_control_plane/groups_sdk.py +18 -551
- cribl_control_plane/{healthinfo.py → health.py} +3 -1
- cribl_control_plane/hectokens.py +479 -0
- cribl_control_plane/models/__init__.py +6 -37
- cribl_control_plane/models/healthstatus.py +3 -3
- cribl_control_plane/models/inputappscope.py +5 -5
- cribl_control_plane/models/inputcollection.py +2 -2
- cribl_control_plane/models/inputconfluentcloud.py +3 -3
- cribl_control_plane/models/inputcribl.py +5 -5
- cribl_control_plane/models/inputcriblhttp.py +3 -3
- cribl_control_plane/models/inputcribllakehttp.py +3 -3
- cribl_control_plane/models/inputcriblmetrics.py +5 -5
- cribl_control_plane/models/inputcribltcp.py +3 -3
- cribl_control_plane/models/inputdatadogagent.py +3 -3
- cribl_control_plane/models/inputedgeprometheus.py +3 -3
- cribl_control_plane/models/inputelastic.py +3 -3
- cribl_control_plane/models/inputeventhub.py +3 -3
- cribl_control_plane/models/inputfile.py +5 -5
- cribl_control_plane/models/inputfirehose.py +3 -3
- cribl_control_plane/models/inputgooglepubsub.py +3 -3
- cribl_control_plane/models/inputgrafana.py +6 -6
- cribl_control_plane/models/inputhttp.py +3 -3
- cribl_control_plane/models/inputhttpraw.py +3 -3
- cribl_control_plane/models/inputjournalfiles.py +3 -3
- cribl_control_plane/models/inputkafka.py +3 -3
- cribl_control_plane/models/inputkinesis.py +3 -3
- cribl_control_plane/models/inputkubeevents.py +5 -5
- cribl_control_plane/models/inputkubelogs.py +5 -5
- cribl_control_plane/models/inputkubemetrics.py +5 -5
- cribl_control_plane/models/inputloki.py +3 -3
- cribl_control_plane/models/inputmodeldriventelemetry.py +3 -3
- cribl_control_plane/models/inputmsk.py +3 -3
- cribl_control_plane/models/inputnetflow.py +3 -3
- cribl_control_plane/models/inputoffice365mgmt.py +3 -3
- cribl_control_plane/models/inputoffice365msgtrace.py +3 -3
- cribl_control_plane/models/inputoffice365service.py +3 -3
- cribl_control_plane/models/inputopentelemetry.py +3 -3
- cribl_control_plane/models/inputprometheus.py +3 -3
- cribl_control_plane/models/inputprometheusrw.py +3 -3
- cribl_control_plane/models/inputrawudp.py +3 -3
- cribl_control_plane/models/inputsnmp.py +3 -3
- cribl_control_plane/models/inputsplunk.py +3 -3
- cribl_control_plane/models/inputsplunkhec.py +3 -3
- cribl_control_plane/models/inputsplunksearch.py +3 -3
- cribl_control_plane/models/inputsqs.py +3 -3
- cribl_control_plane/models/inputsystemmetrics.py +5 -5
- cribl_control_plane/models/inputsystemstate.py +5 -5
- cribl_control_plane/models/inputtcp.py +3 -3
- cribl_control_plane/models/inputtcpjson.py +3 -3
- cribl_control_plane/models/inputwef.py +3 -3
- cribl_control_plane/models/inputwindowsmetrics.py +5 -5
- cribl_control_plane/models/inputwiz.py +3 -3
- cribl_control_plane/models/inputzscalerhec.py +3 -3
- cribl_control_plane/models/outputazureblob.py +3 -3
- cribl_control_plane/models/outputazuredataexplorer.py +3 -3
- cribl_control_plane/models/outputazureeventhub.py +3 -3
- cribl_control_plane/models/outputclickhouse.py +3 -3
- cribl_control_plane/models/outputcloudwatch.py +3 -3
- cribl_control_plane/models/outputconfluentcloud.py +3 -3
- cribl_control_plane/models/outputcriblhttp.py +5 -5
- cribl_control_plane/models/outputcribllake.py +5 -5
- cribl_control_plane/models/outputcribltcp.py +5 -5
- cribl_control_plane/models/outputcrowdstrikenextgensiem.py +3 -3
- cribl_control_plane/models/outputdatadog.py +5 -5
- cribl_control_plane/models/outputdataset.py +5 -5
- cribl_control_plane/models/outputdevnull.py +5 -5
- cribl_control_plane/models/outputdiskspool.py +5 -5
- cribl_control_plane/models/outputdls3.py +3 -3
- cribl_control_plane/models/outputdynatracehttp.py +3 -3
- cribl_control_plane/models/outputdynatraceotlp.py +3 -3
- cribl_control_plane/models/outputelasticcloud.py +3 -3
- cribl_control_plane/models/outputexabeam.py +3 -3
- cribl_control_plane/models/outputgooglecloudlogging.py +3 -3
- cribl_control_plane/models/outputgooglecloudstorage.py +3 -3
- cribl_control_plane/models/outputgrafanacloud.py +10 -10
- cribl_control_plane/models/outputgraphite.py +3 -3
- cribl_control_plane/models/outputhumiohec.py +3 -3
- cribl_control_plane/models/outputkafka.py +3 -3
- cribl_control_plane/models/outputkinesis.py +3 -3
- cribl_control_plane/models/outputminio.py +3 -3
- cribl_control_plane/models/outputmsk.py +3 -3
- cribl_control_plane/models/outputnewrelic.py +5 -5
- cribl_control_plane/models/outputnewrelicevents.py +3 -3
- cribl_control_plane/models/outputring.py +5 -5
- cribl_control_plane/models/outputs3.py +3 -3
- cribl_control_plane/models/outputsecuritylake.py +3 -3
- cribl_control_plane/models/outputsentinel.py +3 -3
- cribl_control_plane/models/outputsentineloneaisiem.py +3 -3
- cribl_control_plane/models/outputservicenow.py +3 -3
- cribl_control_plane/models/outputsns.py +3 -3
- cribl_control_plane/models/outputsplunk.py +3 -3
- cribl_control_plane/models/outputsplunkhec.py +5 -5
- cribl_control_plane/models/outputsqs.py +3 -3
- cribl_control_plane/models/outputstatsd.py +3 -3
- cribl_control_plane/models/outputstatsdext.py +3 -3
- cribl_control_plane/models/outputsyslog.py +5 -5
- cribl_control_plane/models/outputtcpjson.py +5 -5
- cribl_control_plane/models/outputwebhook.py +5 -5
- cribl_control_plane/models/outputxsiam.py +5 -5
- cribl_control_plane/models/schemeclientoauth.py +5 -0
- cribl_control_plane/nodes.py +90 -68
- cribl_control_plane/samples.py +391 -0
- cribl_control_plane/sdk.py +11 -17
- cribl_control_plane/sources.py +15 -469
- cribl_control_plane/{workers_sdk.py → statuses.py} +23 -25
- cribl_control_plane/{deployments.py → summaries.py} +3 -3
- cribl_control_plane/teams.py +201 -0
- cribl_control_plane/tokens.py +182 -0
- cribl_control_plane/utils/__init__.py +3 -2
- cribl_control_plane/utils/security.py +5 -0
- cribl_control_plane/versions.py +26 -0
- cribl_control_plane/versions_configs.py +171 -0
- {cribl_control_plane-0.0.26a1.dist-info → cribl_control_plane-0.0.28.dist-info}/METADATA +77 -38
- {cribl_control_plane-0.0.26a1.dist-info → cribl_control_plane-0.0.28.dist-info}/RECORD +128 -119
- cribl_control_plane/models/createversionsyncop.py +0 -23
- cribl_control_plane/models/restartresponse.py +0 -26
- cribl_control_plane/models/updateworkersrestartop.py +0 -24
- cribl_control_plane/versioning.py +0 -2309
- {cribl_control_plane-0.0.26a1.dist-info → cribl_control_plane-0.0.28.dist-info}/WHEEL +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
1
3
|
import hashlib
|
|
2
|
-
import os
|
|
3
4
|
import httpx
|
|
4
5
|
import time
|
|
5
6
|
from .types import (
|
|
@@ -20,13 +21,19 @@ class Credentials:
|
|
|
20
21
|
client_id: str
|
|
21
22
|
client_secret: str
|
|
22
23
|
token_url: str
|
|
23
|
-
|
|
24
|
+
additional_properties: Dict[str, str]
|
|
24
25
|
|
|
25
|
-
def __init__(
|
|
26
|
+
def __init__(
|
|
27
|
+
self,
|
|
28
|
+
client_id: str,
|
|
29
|
+
client_secret: str,
|
|
30
|
+
token_url: str,
|
|
31
|
+
additional_properties: Optional[Dict[str, str]] = None,
|
|
32
|
+
):
|
|
26
33
|
self.client_id = client_id
|
|
27
34
|
self.client_secret = client_secret
|
|
28
35
|
self.token_url = token_url
|
|
29
|
-
self.
|
|
36
|
+
self.additional_properties = additional_properties or {}
|
|
30
37
|
|
|
31
38
|
|
|
32
39
|
class Session:
|
|
@@ -135,10 +142,17 @@ class ClientCredentialsHook(SDKInitHook, BeforeRequestHook, AfterErrorHook):
|
|
|
135
142
|
if security is None or security.client_oauth is None:
|
|
136
143
|
return None
|
|
137
144
|
|
|
145
|
+
# Extract additional properties from security object
|
|
146
|
+
additional_properties = {}
|
|
147
|
+
for key, value in dict(security.client_oauth).items():
|
|
148
|
+
if key not in ["client_id", "client_secret", "token_url"]:
|
|
149
|
+
additional_properties[key] = value
|
|
150
|
+
|
|
138
151
|
return Credentials(
|
|
139
152
|
client_id=security.client_oauth.client_id,
|
|
140
153
|
client_secret=security.client_oauth.client_secret,
|
|
141
154
|
token_url=security.client_oauth.token_url,
|
|
155
|
+
additional_properties=additional_properties,
|
|
142
156
|
)
|
|
143
157
|
|
|
144
158
|
def do_token_request(
|
|
@@ -153,12 +167,13 @@ class ClientCredentialsHook(SDKInitHook, BeforeRequestHook, AfterErrorHook):
|
|
|
153
167
|
"client_secret": credentials.client_secret,
|
|
154
168
|
}
|
|
155
169
|
|
|
156
|
-
if credentials.audience is not None:
|
|
157
|
-
payload["audience"] = credentials.audience
|
|
158
|
-
|
|
159
170
|
if scopes is not None and len(scopes) > 0:
|
|
160
171
|
payload["scope"] = " ".join(scopes)
|
|
161
172
|
|
|
173
|
+
# Add additional properties to payload
|
|
174
|
+
for key, value in credentials.additional_properties.items():
|
|
175
|
+
payload[key] = value
|
|
176
|
+
|
|
162
177
|
token_url = credentials.token_url
|
|
163
178
|
if not bool(urlparse(credentials.token_url).netloc):
|
|
164
179
|
token_url = urljoin(hook_ctx.base_url, credentials.token_url)
|
cribl_control_plane/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "cribl-control-plane"
|
|
6
|
-
__version__: str = "0.0.
|
|
7
|
-
__openapi_doc_version__: str = "4.14.0-alpha.
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.0.
|
|
6
|
+
__version__: str = "0.0.28"
|
|
7
|
+
__openapi_doc_version__: str = "4.14.0-alpha.1755179421376-c4612cd3"
|
|
8
|
+
__gen_version__: str = "2.684.0"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.0.28 2.684.0 4.14.0-alpha.1755179421376-c4612cd3 cribl-control-plane"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from .sdkconfiguration import SDKConfiguration
|
|
5
|
+
from cribl_control_plane import errors, models, utils
|
|
6
|
+
from cribl_control_plane._hooks import HookContext
|
|
7
|
+
from cribl_control_plane.teams import Teams
|
|
8
|
+
from cribl_control_plane.types import OptionalNullable, UNSET
|
|
9
|
+
from cribl_control_plane.utils import get_security_from_env
|
|
10
|
+
from cribl_control_plane.utils.unmarshal_json_response import unmarshal_json_response
|
|
11
|
+
from typing import Any, Mapping, Optional
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ACL(BaseSDK):
|
|
15
|
+
teams: Teams
|
|
16
|
+
|
|
17
|
+
def __init__(self, sdk_config: SDKConfiguration) -> None:
|
|
18
|
+
BaseSDK.__init__(self, sdk_config)
|
|
19
|
+
self.sdk_configuration = sdk_config
|
|
20
|
+
self._init_sdks()
|
|
21
|
+
|
|
22
|
+
def _init_sdks(self):
|
|
23
|
+
self.teams = Teams(self.sdk_configuration)
|
|
24
|
+
|
|
25
|
+
def get(
|
|
26
|
+
self,
|
|
27
|
+
*,
|
|
28
|
+
id: str,
|
|
29
|
+
type_: Optional[models.GetGroupsACLByIDType] = None,
|
|
30
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
31
|
+
server_url: Optional[str] = None,
|
|
32
|
+
timeout_ms: Optional[int] = None,
|
|
33
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
34
|
+
) -> models.GetGroupsACLByIDResponse:
|
|
35
|
+
r"""Retrieve the Access Control List (ACL) for a Worker Group or Edge Fleet
|
|
36
|
+
|
|
37
|
+
ACL of members with permissions for resources in this Group
|
|
38
|
+
|
|
39
|
+
:param id: Group id
|
|
40
|
+
:param type: resource type by which to filter access levels
|
|
41
|
+
:param retries: Override the default retry configuration for this method
|
|
42
|
+
:param server_url: Override the default server URL for this method
|
|
43
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
44
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
45
|
+
"""
|
|
46
|
+
base_url = None
|
|
47
|
+
url_variables = None
|
|
48
|
+
if timeout_ms is None:
|
|
49
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
50
|
+
|
|
51
|
+
if server_url is not None:
|
|
52
|
+
base_url = server_url
|
|
53
|
+
else:
|
|
54
|
+
base_url = self._get_url(base_url, url_variables)
|
|
55
|
+
|
|
56
|
+
request = models.GetGroupsACLByIDRequest(
|
|
57
|
+
id=id,
|
|
58
|
+
type=type_,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
req = self._build_request(
|
|
62
|
+
method="GET",
|
|
63
|
+
path="/master/groups/{id}/acl",
|
|
64
|
+
base_url=base_url,
|
|
65
|
+
url_variables=url_variables,
|
|
66
|
+
request=request,
|
|
67
|
+
request_body_required=False,
|
|
68
|
+
request_has_path_params=True,
|
|
69
|
+
request_has_query_params=True,
|
|
70
|
+
user_agent_header="user-agent",
|
|
71
|
+
accept_header_value="application/json",
|
|
72
|
+
http_headers=http_headers,
|
|
73
|
+
security=self.sdk_configuration.security,
|
|
74
|
+
timeout_ms=timeout_ms,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
if retries == UNSET:
|
|
78
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
79
|
+
retries = self.sdk_configuration.retry_config
|
|
80
|
+
|
|
81
|
+
retry_config = None
|
|
82
|
+
if isinstance(retries, utils.RetryConfig):
|
|
83
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
84
|
+
|
|
85
|
+
http_res = self.do_request(
|
|
86
|
+
hook_ctx=HookContext(
|
|
87
|
+
config=self.sdk_configuration,
|
|
88
|
+
base_url=base_url or "",
|
|
89
|
+
operation_id="getGroupsAclById",
|
|
90
|
+
oauth2_scopes=[],
|
|
91
|
+
security_source=get_security_from_env(
|
|
92
|
+
self.sdk_configuration.security, models.Security
|
|
93
|
+
),
|
|
94
|
+
),
|
|
95
|
+
request=req,
|
|
96
|
+
error_status_codes=["401", "4XX", "500", "5XX"],
|
|
97
|
+
retry_config=retry_config,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
response_data: Any = None
|
|
101
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
102
|
+
return unmarshal_json_response(models.GetGroupsACLByIDResponse, http_res)
|
|
103
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
104
|
+
response_data = unmarshal_json_response(errors.ErrorData, http_res)
|
|
105
|
+
raise errors.Error(response_data, http_res)
|
|
106
|
+
if utils.match_response(http_res, ["401", "4XX"], "*"):
|
|
107
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
108
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
109
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
110
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
111
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
112
|
+
|
|
113
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
114
|
+
|
|
115
|
+
async def get_async(
|
|
116
|
+
self,
|
|
117
|
+
*,
|
|
118
|
+
id: str,
|
|
119
|
+
type_: Optional[models.GetGroupsACLByIDType] = None,
|
|
120
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
121
|
+
server_url: Optional[str] = None,
|
|
122
|
+
timeout_ms: Optional[int] = None,
|
|
123
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
124
|
+
) -> models.GetGroupsACLByIDResponse:
|
|
125
|
+
r"""Retrieve the Access Control List (ACL) for a Worker Group or Edge Fleet
|
|
126
|
+
|
|
127
|
+
ACL of members with permissions for resources in this Group
|
|
128
|
+
|
|
129
|
+
:param id: Group id
|
|
130
|
+
:param type: resource type by which to filter access levels
|
|
131
|
+
:param retries: Override the default retry configuration for this method
|
|
132
|
+
:param server_url: Override the default server URL for this method
|
|
133
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
134
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
135
|
+
"""
|
|
136
|
+
base_url = None
|
|
137
|
+
url_variables = None
|
|
138
|
+
if timeout_ms is None:
|
|
139
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
140
|
+
|
|
141
|
+
if server_url is not None:
|
|
142
|
+
base_url = server_url
|
|
143
|
+
else:
|
|
144
|
+
base_url = self._get_url(base_url, url_variables)
|
|
145
|
+
|
|
146
|
+
request = models.GetGroupsACLByIDRequest(
|
|
147
|
+
id=id,
|
|
148
|
+
type=type_,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
req = self._build_request_async(
|
|
152
|
+
method="GET",
|
|
153
|
+
path="/master/groups/{id}/acl",
|
|
154
|
+
base_url=base_url,
|
|
155
|
+
url_variables=url_variables,
|
|
156
|
+
request=request,
|
|
157
|
+
request_body_required=False,
|
|
158
|
+
request_has_path_params=True,
|
|
159
|
+
request_has_query_params=True,
|
|
160
|
+
user_agent_header="user-agent",
|
|
161
|
+
accept_header_value="application/json",
|
|
162
|
+
http_headers=http_headers,
|
|
163
|
+
security=self.sdk_configuration.security,
|
|
164
|
+
timeout_ms=timeout_ms,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
if retries == UNSET:
|
|
168
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
169
|
+
retries = self.sdk_configuration.retry_config
|
|
170
|
+
|
|
171
|
+
retry_config = None
|
|
172
|
+
if isinstance(retries, utils.RetryConfig):
|
|
173
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
174
|
+
|
|
175
|
+
http_res = await self.do_request_async(
|
|
176
|
+
hook_ctx=HookContext(
|
|
177
|
+
config=self.sdk_configuration,
|
|
178
|
+
base_url=base_url or "",
|
|
179
|
+
operation_id="getGroupsAclById",
|
|
180
|
+
oauth2_scopes=[],
|
|
181
|
+
security_source=get_security_from_env(
|
|
182
|
+
self.sdk_configuration.security, models.Security
|
|
183
|
+
),
|
|
184
|
+
),
|
|
185
|
+
request=req,
|
|
186
|
+
error_status_codes=["401", "4XX", "500", "5XX"],
|
|
187
|
+
retry_config=retry_config,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
response_data: Any = None
|
|
191
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
192
|
+
return unmarshal_json_response(models.GetGroupsACLByIDResponse, http_res)
|
|
193
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
194
|
+
response_data = unmarshal_json_response(errors.ErrorData, http_res)
|
|
195
|
+
raise errors.Error(response_data, http_res)
|
|
196
|
+
if utils.match_response(http_res, ["401", "4XX"], "*"):
|
|
197
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
198
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
199
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
200
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
201
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
202
|
+
|
|
203
|
+
raise errors.APIError("Unexpected response received", http_res)
|
cribl_control_plane/auth_sdk.py
CHANGED
|
@@ -1,184 +1,17 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
|
-
from
|
|
5
|
-
from cribl_control_plane.
|
|
6
|
-
from cribl_control_plane.types import OptionalNullable, UNSET
|
|
7
|
-
from cribl_control_plane.utils.unmarshal_json_response import unmarshal_json_response
|
|
8
|
-
from typing import Mapping, Optional
|
|
4
|
+
from .sdkconfiguration import SDKConfiguration
|
|
5
|
+
from cribl_control_plane.tokens import Tokens
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
class AuthSDK(BaseSDK):
|
|
12
|
-
|
|
9
|
+
tokens: Tokens
|
|
13
10
|
|
|
14
|
-
def
|
|
15
|
-
self,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
password: str,
|
|
19
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
20
|
-
server_url: Optional[str] = None,
|
|
21
|
-
timeout_ms: Optional[int] = None,
|
|
22
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
23
|
-
) -> models.AuthToken:
|
|
24
|
-
r"""Log in and fetch an authentication token
|
|
11
|
+
def __init__(self, sdk_config: SDKConfiguration) -> None:
|
|
12
|
+
BaseSDK.__init__(self, sdk_config)
|
|
13
|
+
self.sdk_configuration = sdk_config
|
|
14
|
+
self._init_sdks()
|
|
25
15
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
:param username:
|
|
29
|
-
:param password:
|
|
30
|
-
:param retries: Override the default retry configuration for this method
|
|
31
|
-
:param server_url: Override the default server URL for this method
|
|
32
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
33
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
34
|
-
"""
|
|
35
|
-
base_url = None
|
|
36
|
-
url_variables = None
|
|
37
|
-
if timeout_ms is None:
|
|
38
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
39
|
-
|
|
40
|
-
if server_url is not None:
|
|
41
|
-
base_url = server_url
|
|
42
|
-
else:
|
|
43
|
-
base_url = self._get_url(base_url, url_variables)
|
|
44
|
-
|
|
45
|
-
request = models.LoginInfo(
|
|
46
|
-
username=username,
|
|
47
|
-
password=password,
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
req = self._build_request(
|
|
51
|
-
method="POST",
|
|
52
|
-
path="/auth/login",
|
|
53
|
-
base_url=base_url,
|
|
54
|
-
url_variables=url_variables,
|
|
55
|
-
request=request,
|
|
56
|
-
request_body_required=True,
|
|
57
|
-
request_has_path_params=False,
|
|
58
|
-
request_has_query_params=False,
|
|
59
|
-
user_agent_header="user-agent",
|
|
60
|
-
accept_header_value="application/json",
|
|
61
|
-
http_headers=http_headers,
|
|
62
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
63
|
-
request, False, False, "json", models.LoginInfo
|
|
64
|
-
),
|
|
65
|
-
timeout_ms=timeout_ms,
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
if retries == UNSET:
|
|
69
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
70
|
-
retries = self.sdk_configuration.retry_config
|
|
71
|
-
|
|
72
|
-
retry_config = None
|
|
73
|
-
if isinstance(retries, utils.RetryConfig):
|
|
74
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
75
|
-
|
|
76
|
-
http_res = self.do_request(
|
|
77
|
-
hook_ctx=HookContext(
|
|
78
|
-
config=self.sdk_configuration,
|
|
79
|
-
base_url=base_url or "",
|
|
80
|
-
operation_id="login",
|
|
81
|
-
oauth2_scopes=[],
|
|
82
|
-
security_source=None,
|
|
83
|
-
),
|
|
84
|
-
request=req,
|
|
85
|
-
error_status_codes=["401", "403", "429", "4XX", "5XX"],
|
|
86
|
-
retry_config=retry_config,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
90
|
-
return unmarshal_json_response(models.AuthToken, http_res)
|
|
91
|
-
if utils.match_response(http_res, ["401", "403", "429", "4XX"], "*"):
|
|
92
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
93
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
94
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
95
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
96
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
97
|
-
|
|
98
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
99
|
-
|
|
100
|
-
async def fetch_token_async(
|
|
101
|
-
self,
|
|
102
|
-
*,
|
|
103
|
-
username: str,
|
|
104
|
-
password: str,
|
|
105
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
106
|
-
server_url: Optional[str] = None,
|
|
107
|
-
timeout_ms: Optional[int] = None,
|
|
108
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
109
|
-
) -> models.AuthToken:
|
|
110
|
-
r"""Log in and fetch an authentication token
|
|
111
|
-
|
|
112
|
-
This endpoint is unavailable on Cribl.Cloud. Instead, follow the instructions at https://docs.cribl.io/stream/api-tutorials/#criblcloud to get an Auth token for Cribl.Cloud.
|
|
113
|
-
|
|
114
|
-
:param username:
|
|
115
|
-
:param password:
|
|
116
|
-
:param retries: Override the default retry configuration for this method
|
|
117
|
-
:param server_url: Override the default server URL for this method
|
|
118
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
119
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
120
|
-
"""
|
|
121
|
-
base_url = None
|
|
122
|
-
url_variables = None
|
|
123
|
-
if timeout_ms is None:
|
|
124
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
125
|
-
|
|
126
|
-
if server_url is not None:
|
|
127
|
-
base_url = server_url
|
|
128
|
-
else:
|
|
129
|
-
base_url = self._get_url(base_url, url_variables)
|
|
130
|
-
|
|
131
|
-
request = models.LoginInfo(
|
|
132
|
-
username=username,
|
|
133
|
-
password=password,
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
req = self._build_request_async(
|
|
137
|
-
method="POST",
|
|
138
|
-
path="/auth/login",
|
|
139
|
-
base_url=base_url,
|
|
140
|
-
url_variables=url_variables,
|
|
141
|
-
request=request,
|
|
142
|
-
request_body_required=True,
|
|
143
|
-
request_has_path_params=False,
|
|
144
|
-
request_has_query_params=False,
|
|
145
|
-
user_agent_header="user-agent",
|
|
146
|
-
accept_header_value="application/json",
|
|
147
|
-
http_headers=http_headers,
|
|
148
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
149
|
-
request, False, False, "json", models.LoginInfo
|
|
150
|
-
),
|
|
151
|
-
timeout_ms=timeout_ms,
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
if retries == UNSET:
|
|
155
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
156
|
-
retries = self.sdk_configuration.retry_config
|
|
157
|
-
|
|
158
|
-
retry_config = None
|
|
159
|
-
if isinstance(retries, utils.RetryConfig):
|
|
160
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
161
|
-
|
|
162
|
-
http_res = await self.do_request_async(
|
|
163
|
-
hook_ctx=HookContext(
|
|
164
|
-
config=self.sdk_configuration,
|
|
165
|
-
base_url=base_url or "",
|
|
166
|
-
operation_id="login",
|
|
167
|
-
oauth2_scopes=[],
|
|
168
|
-
security_source=None,
|
|
169
|
-
),
|
|
170
|
-
request=req,
|
|
171
|
-
error_status_codes=["401", "403", "429", "4XX", "5XX"],
|
|
172
|
-
retry_config=retry_config,
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
176
|
-
return unmarshal_json_response(models.AuthToken, http_res)
|
|
177
|
-
if utils.match_response(http_res, ["401", "403", "429", "4XX"], "*"):
|
|
178
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
179
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
180
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
181
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
182
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
183
|
-
|
|
184
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
16
|
+
def _init_sdks(self):
|
|
17
|
+
self.tokens = Tokens(self.sdk_configuration)
|