crc-pulp-service-client 20260107.2__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 crc-pulp-service-client might be problematic. Click here for more details.

Files changed (41) hide show
  1. crc_pulp_service_client-20260107.2.dist-info/METADATA +2727 -0
  2. crc_pulp_service_client-20260107.2.dist-info/RECORD +41 -0
  3. crc_pulp_service_client-20260107.2.dist-info/WHEEL +5 -0
  4. crc_pulp_service_client-20260107.2.dist-info/top_level.txt +1 -0
  5. pulpcore/__init__.py +2 -0
  6. pulpcore/client/__init__.py +2 -0
  7. pulpcore/client/pulp_service/__init__.py +59 -0
  8. pulpcore/client/pulp_service/api/__init__.py +13 -0
  9. pulpcore/client/pulp_service/api/api_create_domain_api.py +335 -0
  10. pulpcore/client/pulp_service/api/api_debug_auth_header_api.py +329 -0
  11. pulpcore/client/pulp_service/api/api_debug_database_triggers_api.py +329 -0
  12. pulpcore/client/pulp_service/api/api_rds_connection_tests_api.py +591 -0
  13. pulpcore/client/pulp_service/api/api_test_random_lock_tasks_api.py +326 -0
  14. pulpcore/client/pulp_service/api/api_test_tasks_api.py +326 -0
  15. pulpcore/client/pulp_service/api/contentguards_feature_api.py +3401 -0
  16. pulpcore/client/pulp_service/api/tasks_api.py +1469 -0
  17. pulpcore/client/pulp_service/api/vuln_report_service_api.py +1301 -0
  18. pulpcore/client/pulp_service/api_client.py +798 -0
  19. pulpcore/client/pulp_service/api_response.py +21 -0
  20. pulpcore/client/pulp_service/configuration.py +628 -0
  21. pulpcore/client/pulp_service/exceptions.py +200 -0
  22. pulpcore/client/pulp_service/models/__init__.py +34 -0
  23. pulpcore/client/pulp_service/models/async_operation_response.py +88 -0
  24. pulpcore/client/pulp_service/models/domain.py +114 -0
  25. pulpcore/client/pulp_service/models/domain_response.py +131 -0
  26. pulpcore/client/pulp_service/models/my_permissions_response.py +88 -0
  27. pulpcore/client/pulp_service/models/nested_role.py +93 -0
  28. pulpcore/client/pulp_service/models/nested_role_response.py +92 -0
  29. pulpcore/client/pulp_service/models/object_roles_response.py +96 -0
  30. pulpcore/client/pulp_service/models/paginated_task_response_list.py +112 -0
  31. pulpcore/client/pulp_service/models/paginatedservice_feature_content_guard_response_list.py +112 -0
  32. pulpcore/client/pulp_service/models/paginatedservice_vulnerability_report_response_list.py +112 -0
  33. pulpcore/client/pulp_service/models/patchedservice_feature_content_guard.py +107 -0
  34. pulpcore/client/pulp_service/models/progress_report_response.py +115 -0
  35. pulpcore/client/pulp_service/models/service_feature_content_guard.py +107 -0
  36. pulpcore/client/pulp_service/models/service_feature_content_guard_response.py +123 -0
  37. pulpcore/client/pulp_service/models/service_vulnerability_report_response.py +110 -0
  38. pulpcore/client/pulp_service/models/storage_class_enum.py +40 -0
  39. pulpcore/client/pulp_service/models/task_response.py +186 -0
  40. pulpcore/client/pulp_service/py.typed +0 -0
  41. pulpcore/client/pulp_service/rest.py +258 -0
@@ -0,0 +1,21 @@
1
+ """API response object."""
2
+
3
+ from __future__ import annotations
4
+ from typing import Optional, Generic, Mapping, TypeVar
5
+ from pydantic import Field, StrictInt, StrictBytes, BaseModel
6
+
7
+ T = TypeVar("T")
8
+
9
+ class ApiResponse(BaseModel, Generic[T]):
10
+ """
11
+ API response object
12
+ """
13
+
14
+ status_code: StrictInt = Field(description="HTTP status code")
15
+ headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers")
16
+ data: T = Field(description="Deserialized data given the data type")
17
+ raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
18
+
19
+ model_config = {
20
+ "arbitrary_types_allowed": True
21
+ }
@@ -0,0 +1,628 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pulp 3 API
5
+
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
+
8
+ The version of the OpenAPI document: v3
9
+ Contact: pulp-list@redhat.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ import copy
17
+ import http.client as httplib
18
+ import logging
19
+ from logging import FileHandler
20
+ import multiprocessing
21
+ import sys
22
+ from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict
23
+ from typing_extensions import NotRequired, Self
24
+
25
+ import urllib3
26
+
27
+
28
+ JSON_SCHEMA_VALIDATION_KEYWORDS = {
29
+ 'multipleOf', 'maximum', 'exclusiveMaximum',
30
+ 'minimum', 'exclusiveMinimum', 'maxLength',
31
+ 'minLength', 'pattern', 'maxItems', 'minItems'
32
+ }
33
+
34
+ ServerVariablesT = Dict[str, str]
35
+
36
+ GenericAuthSetting = TypedDict(
37
+ "GenericAuthSetting",
38
+ {
39
+ "type": str,
40
+ "in": str,
41
+ "key": str,
42
+ "value": str,
43
+ },
44
+ )
45
+
46
+
47
+ OAuth2AuthSetting = TypedDict(
48
+ "OAuth2AuthSetting",
49
+ {
50
+ "type": Literal["oauth2"],
51
+ "in": Literal["header"],
52
+ "key": Literal["Authorization"],
53
+ "value": str,
54
+ },
55
+ )
56
+
57
+
58
+ APIKeyAuthSetting = TypedDict(
59
+ "APIKeyAuthSetting",
60
+ {
61
+ "type": Literal["api_key"],
62
+ "in": str,
63
+ "key": str,
64
+ "value": Optional[str],
65
+ },
66
+ )
67
+
68
+
69
+ BasicAuthSetting = TypedDict(
70
+ "BasicAuthSetting",
71
+ {
72
+ "type": Literal["basic"],
73
+ "in": Literal["header"],
74
+ "key": Literal["Authorization"],
75
+ "value": Optional[str],
76
+ },
77
+ )
78
+
79
+
80
+ BearerFormatAuthSetting = TypedDict(
81
+ "BearerFormatAuthSetting",
82
+ {
83
+ "type": Literal["bearer"],
84
+ "in": Literal["header"],
85
+ "format": Literal["JWT"],
86
+ "key": Literal["Authorization"],
87
+ "value": str,
88
+ },
89
+ )
90
+
91
+
92
+ BearerAuthSetting = TypedDict(
93
+ "BearerAuthSetting",
94
+ {
95
+ "type": Literal["bearer"],
96
+ "in": Literal["header"],
97
+ "key": Literal["Authorization"],
98
+ "value": str,
99
+ },
100
+ )
101
+
102
+
103
+ HTTPSignatureAuthSetting = TypedDict(
104
+ "HTTPSignatureAuthSetting",
105
+ {
106
+ "type": Literal["http-signature"],
107
+ "in": Literal["header"],
108
+ "key": Literal["Authorization"],
109
+ "value": None,
110
+ },
111
+ )
112
+
113
+
114
+ AuthSettings = TypedDict(
115
+ "AuthSettings",
116
+ {
117
+ "basicAuth": BasicAuthSetting,
118
+ "cookieAuth": APIKeyAuthSetting,
119
+ "json_header_remote_authentication": OAuth2AuthSetting,
120
+ },
121
+ total=False,
122
+ )
123
+
124
+
125
+ class HostSettingVariable(TypedDict):
126
+ description: str
127
+ default_value: str
128
+ enum_values: List[str]
129
+
130
+
131
+ class HostSetting(TypedDict):
132
+ url: str
133
+ description: str
134
+ variables: NotRequired[Dict[str, HostSettingVariable]]
135
+
136
+
137
+ class Configuration:
138
+ """This class contains various settings of the API client.
139
+
140
+ :param host: Base url.
141
+ :param ignore_operation_servers
142
+ Boolean to ignore operation servers for the API client.
143
+ Config will use `host` as the base url regardless of the operation servers.
144
+ :param api_key: Dict to store API key(s).
145
+ Each entry in the dict specifies an API key.
146
+ The dict key is the name of the security scheme in the OAS specification.
147
+ The dict value is the API key secret.
148
+ :param api_key_prefix: Dict to store API prefix (e.g. Bearer).
149
+ The dict key is the name of the security scheme in the OAS specification.
150
+ The dict value is an API key prefix when generating the auth data.
151
+ :param username: Username for HTTP basic authentication.
152
+ :param password: Password for HTTP basic authentication.
153
+ :param access_token: Access token.
154
+ :param server_index: Index to servers configuration.
155
+ :param server_variables: Mapping with string values to replace variables in
156
+ templated server configuration. The validation of enums is performed for
157
+ variables with defined enum values before.
158
+ :param server_operation_index: Mapping from operation ID to an index to server
159
+ configuration.
160
+ :param server_operation_variables: Mapping from operation ID to a mapping with
161
+ string values to replace variables in templated server configuration.
162
+ The validation of enums is performed for variables with defined enum
163
+ values before.
164
+ :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
165
+ in PEM format.
166
+ :param retries: Number of retries for API requests.
167
+
168
+ :Example:
169
+
170
+ API Key Authentication Example.
171
+ Given the following security scheme in the OpenAPI specification:
172
+ components:
173
+ securitySchemes:
174
+ cookieAuth: # name for the security scheme
175
+ type: apiKey
176
+ in: cookie
177
+ name: JSESSIONID # cookie name
178
+
179
+ You can programmatically set the cookie:
180
+
181
+ conf = pulpcore.client.pulp_service.Configuration(
182
+ api_key={'cookieAuth': 'abc123'}
183
+ api_key_prefix={'cookieAuth': 'JSESSIONID'}
184
+ )
185
+
186
+ The following cookie will be added to the HTTP request:
187
+ Cookie: JSESSIONID abc123
188
+
189
+ HTTP Basic Authentication Example.
190
+ Given the following security scheme in the OpenAPI specification:
191
+ components:
192
+ securitySchemes:
193
+ http_basic_auth:
194
+ type: http
195
+ scheme: basic
196
+
197
+ Configure API client with HTTP basic authentication:
198
+
199
+ conf = pulpcore.client.pulp_service.Configuration(
200
+ username='the-user',
201
+ password='the-password',
202
+ )
203
+
204
+ """
205
+
206
+ _default: ClassVar[Optional[Self]] = None
207
+
208
+ def __init__(
209
+ self,
210
+ host: Optional[str]=None,
211
+ api_key: Optional[Dict[str, str]]=None,
212
+ api_key_prefix: Optional[Dict[str, str]]=None,
213
+ username: Optional[str]=None,
214
+ password: Optional[str]=None,
215
+ access_token: Optional[str]=None,
216
+ server_index: Optional[int]=None,
217
+ server_variables: Optional[ServerVariablesT]=None,
218
+ server_operation_index: Optional[Dict[int, int]]=None,
219
+ server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
220
+ ignore_operation_servers: bool=False,
221
+ ssl_ca_cert: Optional[str]=None,
222
+ retries: Optional[int] = None,
223
+ *,
224
+ debug: Optional[bool] = None,
225
+ ) -> None:
226
+ """Constructor
227
+ """
228
+ self._base_path = "https://env-ephemeral-wd71us.apps.crc-eph.r9lp.p1.openshiftapps.com" if host is None else host
229
+ """Default Base url
230
+ """
231
+ self.server_index = 0 if server_index is None and host is None else server_index
232
+ self.server_operation_index = server_operation_index or {}
233
+ """Default server index
234
+ """
235
+ self.server_variables = server_variables or {}
236
+ self.server_operation_variables = server_operation_variables or {}
237
+ """Default server variables
238
+ """
239
+ self.ignore_operation_servers = ignore_operation_servers
240
+ """Ignore operation servers
241
+ """
242
+ self.temp_folder_path = None
243
+ """Temp file folder for downloading files
244
+ """
245
+ # Authentication Settings
246
+ self.api_key = {}
247
+ if api_key:
248
+ self.api_key = api_key
249
+ """dict to store API key(s)
250
+ """
251
+ self.api_key_prefix = {}
252
+ if api_key_prefix:
253
+ self.api_key_prefix = api_key_prefix
254
+ """dict to store API prefix (e.g. Bearer)
255
+ """
256
+ self.refresh_api_key_hook = None
257
+ """function hook to refresh API key if expired
258
+ """
259
+ self.username = username
260
+ """Username for HTTP basic authentication
261
+ """
262
+ self.password = password
263
+ """Password for HTTP basic authentication
264
+ """
265
+ self.access_token = access_token
266
+ """Access token
267
+ """
268
+ self.logger = {}
269
+ """Logging Settings
270
+ """
271
+ self.logger["package_logger"] = logging.getLogger("pulpcore.client.pulp_service")
272
+ self.logger["urllib3_logger"] = logging.getLogger("urllib3")
273
+ self.logger_format = '%(asctime)s %(levelname)s %(message)s'
274
+ """Log format
275
+ """
276
+ self.logger_stream_handler = None
277
+ """Log stream handler
278
+ """
279
+ self.logger_file_handler: Optional[FileHandler] = None
280
+ """Log file handler
281
+ """
282
+ self.logger_file = None
283
+ """Debug file location
284
+ """
285
+ if debug is not None:
286
+ self.debug = debug
287
+ else:
288
+ self.__debug = False
289
+ """Debug switch
290
+ """
291
+
292
+ self.verify_ssl = True
293
+ """SSL/TLS verification
294
+ Set this to false to skip verifying SSL certificate when calling API
295
+ from https server.
296
+ """
297
+ self.ssl_ca_cert = ssl_ca_cert
298
+ """Set this to customize the certificate file to verify the peer.
299
+ """
300
+ self.cert_file = None
301
+ """client certificate file
302
+ """
303
+ self.key_file = None
304
+ """client key file
305
+ """
306
+ self.assert_hostname = None
307
+ """Set this to True/False to enable/disable SSL hostname verification.
308
+ """
309
+ self.tls_server_name = None
310
+ """SSL/TLS Server Name Indication (SNI)
311
+ Set this to the SNI value expected by the server.
312
+ """
313
+
314
+ self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
315
+ """urllib3 connection pool's maximum number of connections saved
316
+ per pool. urllib3 uses 1 connection as default value, but this is
317
+ not the best value when you are making a lot of possibly parallel
318
+ requests to the same host, which is often the case here.
319
+ cpu_count * 5 is used as default value to increase performance.
320
+ """
321
+
322
+ self.proxy: Optional[str] = None
323
+ """Proxy URL
324
+ """
325
+ self.proxy_headers = None
326
+ """Proxy headers
327
+ """
328
+ self.safe_chars_for_path_param = '/'
329
+ """Safe chars for path_param
330
+ """
331
+ self.retries = retries
332
+ """Adding retries to override urllib3 default value 3
333
+ """
334
+ # Enable client side validation
335
+ self.client_side_validation = True
336
+
337
+ self.socket_options = None
338
+ """Options to pass down to the underlying urllib3 socket
339
+ """
340
+
341
+ self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
342
+ """datetime format
343
+ """
344
+
345
+ self.date_format = "%Y-%m-%d"
346
+ """date format
347
+ """
348
+
349
+ def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
350
+ cls = self.__class__
351
+ result = cls.__new__(cls)
352
+ memo[id(self)] = result
353
+ for k, v in self.__dict__.items():
354
+ if k not in ('logger', 'logger_file_handler'):
355
+ setattr(result, k, copy.deepcopy(v, memo))
356
+ # shallow copy of loggers
357
+ result.logger = copy.copy(self.logger)
358
+ # use setters to configure loggers
359
+ result.logger_file = self.logger_file
360
+ result.debug = self.debug
361
+ return result
362
+
363
+ def __setattr__(self, name: str, value: Any) -> None:
364
+ object.__setattr__(self, name, value)
365
+
366
+ @classmethod
367
+ def set_default(cls, default: Optional[Self]) -> None:
368
+ """Set default instance of configuration.
369
+
370
+ It stores default configuration, which can be
371
+ returned by get_default_copy method.
372
+
373
+ :param default: object of Configuration
374
+ """
375
+ cls._default = default
376
+
377
+ @classmethod
378
+ def get_default_copy(cls) -> Self:
379
+ """Deprecated. Please use `get_default` instead.
380
+
381
+ Deprecated. Please use `get_default` instead.
382
+
383
+ :return: The configuration object.
384
+ """
385
+ return cls.get_default()
386
+
387
+ @classmethod
388
+ def get_default(cls) -> Self:
389
+ """Return the default configuration.
390
+
391
+ This method returns newly created, based on default constructor,
392
+ object of Configuration class or returns a copy of default
393
+ configuration.
394
+
395
+ :return: The configuration object.
396
+ """
397
+ if cls._default is None:
398
+ cls._default = cls()
399
+ return cls._default
400
+
401
+ @property
402
+ def logger_file(self) -> Optional[str]:
403
+ """The logger file.
404
+
405
+ If the logger_file is None, then add stream handler and remove file
406
+ handler. Otherwise, add file handler and remove stream handler.
407
+
408
+ :param value: The logger_file path.
409
+ :type: str
410
+ """
411
+ return self.__logger_file
412
+
413
+ @logger_file.setter
414
+ def logger_file(self, value: Optional[str]) -> None:
415
+ """The logger file.
416
+
417
+ If the logger_file is None, then add stream handler and remove file
418
+ handler. Otherwise, add file handler and remove stream handler.
419
+
420
+ :param value: The logger_file path.
421
+ :type: str
422
+ """
423
+ self.__logger_file = value
424
+ if self.__logger_file:
425
+ # If set logging file,
426
+ # then add file handler and remove stream handler.
427
+ self.logger_file_handler = logging.FileHandler(self.__logger_file)
428
+ self.logger_file_handler.setFormatter(self.logger_formatter)
429
+ for _, logger in self.logger.items():
430
+ logger.addHandler(self.logger_file_handler)
431
+
432
+ @property
433
+ def debug(self) -> bool:
434
+ """Debug status
435
+
436
+ :param value: The debug status, True or False.
437
+ :type: bool
438
+ """
439
+ return self.__debug
440
+
441
+ @debug.setter
442
+ def debug(self, value: bool) -> None:
443
+ """Debug status
444
+
445
+ :param value: The debug status, True or False.
446
+ :type: bool
447
+ """
448
+ self.__debug = value
449
+ if self.__debug:
450
+ # if debug status is True, turn on debug logging
451
+ for _, logger in self.logger.items():
452
+ logger.setLevel(logging.DEBUG)
453
+ # turn on httplib debug
454
+ httplib.HTTPConnection.debuglevel = 1
455
+ else:
456
+ # if debug status is False, turn off debug logging,
457
+ # setting log level to default `logging.WARNING`
458
+ for _, logger in self.logger.items():
459
+ logger.setLevel(logging.WARNING)
460
+ # turn off httplib debug
461
+ httplib.HTTPConnection.debuglevel = 0
462
+
463
+ @property
464
+ def logger_format(self) -> str:
465
+ """The logger format.
466
+
467
+ The logger_formatter will be updated when sets logger_format.
468
+
469
+ :param value: The format string.
470
+ :type: str
471
+ """
472
+ return self.__logger_format
473
+
474
+ @logger_format.setter
475
+ def logger_format(self, value: str) -> None:
476
+ """The logger format.
477
+
478
+ The logger_formatter will be updated when sets logger_format.
479
+
480
+ :param value: The format string.
481
+ :type: str
482
+ """
483
+ self.__logger_format = value
484
+ self.logger_formatter = logging.Formatter(self.__logger_format)
485
+
486
+ def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
487
+ """Gets API key (with prefix if set).
488
+
489
+ :param identifier: The identifier of apiKey.
490
+ :param alias: The alternative identifier of apiKey.
491
+ :return: The token for api key authentication.
492
+ """
493
+ if self.refresh_api_key_hook is not None:
494
+ self.refresh_api_key_hook(self)
495
+ key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
496
+ if key:
497
+ prefix = self.api_key_prefix.get(identifier)
498
+ if prefix:
499
+ return "%s %s" % (prefix, key)
500
+ else:
501
+ return key
502
+
503
+ return None
504
+
505
+ def get_basic_auth_token(self) -> Optional[str]:
506
+ """Gets HTTP basic authentication header (string).
507
+
508
+ :return: The token for basic HTTP authentication.
509
+ """
510
+ username = ""
511
+ if self.username is not None:
512
+ username = self.username
513
+ password = ""
514
+ if self.password is not None:
515
+ password = self.password
516
+ return urllib3.util.make_headers(
517
+ basic_auth=username + ':' + password
518
+ ).get('authorization')
519
+
520
+ def auth_settings(self)-> AuthSettings:
521
+ """Gets Auth Settings dict for api client.
522
+
523
+ :return: The Auth Settings information dict.
524
+ """
525
+ auth: AuthSettings = {}
526
+ if self.username is not None and self.password is not None:
527
+ auth['basicAuth'] = {
528
+ 'type': 'basic',
529
+ 'in': 'header',
530
+ 'key': 'Authorization',
531
+ 'value': self.get_basic_auth_token()
532
+ }
533
+ if 'cookieAuth' in self.api_key:
534
+ auth['cookieAuth'] = {
535
+ 'type': 'api_key',
536
+ 'in': 'cookie',
537
+ 'key': 'sessionid',
538
+ 'value': self.get_api_key_with_prefix(
539
+ 'cookieAuth',
540
+ ),
541
+ }
542
+ if self.access_token is not None:
543
+ auth['json_header_remote_authentication'] = {
544
+ 'type': 'oauth2',
545
+ 'in': 'header',
546
+ 'key': 'Authorization',
547
+ 'value': 'Bearer ' + self.access_token
548
+ }
549
+ return auth
550
+
551
+ def to_debug_report(self) -> str:
552
+ """Gets the essential information for debugging.
553
+
554
+ :return: The report for debugging.
555
+ """
556
+ return "Python SDK Debug Report:\n"\
557
+ "OS: {env}\n"\
558
+ "Python Version: {pyversion}\n"\
559
+ "Version of the API: v3\n"\
560
+ "SDK Package Version: 20260107.2".\
561
+ format(env=sys.platform, pyversion=sys.version)
562
+
563
+ def get_host_settings(self) -> List[HostSetting]:
564
+ """Gets an array of host settings
565
+
566
+ :return: An array of host settings
567
+ """
568
+ return [
569
+ {
570
+ 'url': "https://env-ephemeral-wd71us.apps.crc-eph.r9lp.p1.openshiftapps.com",
571
+ 'description': "No description provided",
572
+ }
573
+ ]
574
+
575
+ def get_host_from_settings(
576
+ self,
577
+ index: Optional[int],
578
+ variables: Optional[ServerVariablesT]=None,
579
+ servers: Optional[List[HostSetting]]=None,
580
+ ) -> str:
581
+ """Gets host URL based on the index and variables
582
+ :param index: array index of the host settings
583
+ :param variables: hash of variable and the corresponding value
584
+ :param servers: an array of host settings or None
585
+ :return: URL based on host settings
586
+ """
587
+ if index is None:
588
+ return self._base_path
589
+
590
+ variables = {} if variables is None else variables
591
+ servers = self.get_host_settings() if servers is None else servers
592
+
593
+ try:
594
+ server = servers[index]
595
+ except IndexError:
596
+ raise ValueError(
597
+ "Invalid index {0} when selecting the host settings. "
598
+ "Must be less than {1}".format(index, len(servers)))
599
+
600
+ url = server['url']
601
+
602
+ # go through variables and replace placeholders
603
+ for variable_name, variable in server.get('variables', {}).items():
604
+ used_value = variables.get(
605
+ variable_name, variable['default_value'])
606
+
607
+ if 'enum_values' in variable \
608
+ and used_value not in variable['enum_values']:
609
+ raise ValueError(
610
+ "The variable `{0}` in the host URL has invalid value "
611
+ "{1}. Must be {2}.".format(
612
+ variable_name, variables[variable_name],
613
+ variable['enum_values']))
614
+
615
+ url = url.replace("{" + variable_name + "}", used_value)
616
+
617
+ return url
618
+
619
+ @property
620
+ def host(self) -> str:
621
+ """Return generated host."""
622
+ return self.get_host_from_settings(self.server_index, variables=self.server_variables)
623
+
624
+ @host.setter
625
+ def host(self, value: str) -> None:
626
+ """Fix base path."""
627
+ self._base_path = value
628
+ self.server_index = None