diff --git a/docs/DynamicNetworkZone.md b/docs/DynamicNetworkZone.md index 14498f44..91429826 100644 --- a/docs/DynamicNetworkZone.md +++ b/docs/DynamicNetworkZone.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**asns** | [**DynamicNetworkZoneAllOfAsns**](DynamicNetworkZoneAllOfAsns.md) | | [optional] +**asns** | **List[str]** | An array of ASNs for a Network Zone | [optional] **proxy_type** | **str** | The proxy type used for a Dynamic Network Zone | [optional] -**locations** | [**DynamicNetworkZoneAllOfLocations**](DynamicNetworkZoneAllOfLocations.md) | | [optional] +**locations** | [**List[NetworkZoneLocation]**](NetworkZoneLocation.md) | An array of geolocations for a Dynamic Network Zone | [optional] ## Example diff --git a/docs/DynamicNetworkZoneAllOfAsns.md b/docs/DynamicNetworkZoneAllOfAsns.md deleted file mode 100644 index d5465152..00000000 --- a/docs/DynamicNetworkZoneAllOfAsns.md +++ /dev/null @@ -1,28 +0,0 @@ -# DynamicNetworkZoneAllOfAsns - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from okta.models.dynamic_network_zone_all_of_asns import DynamicNetworkZoneAllOfAsns - -# TODO update the JSON string below -json = "{}" -# create an instance of DynamicNetworkZoneAllOfAsns from a JSON string -dynamic_network_zone_all_of_asns_instance = DynamicNetworkZoneAllOfAsns.from_json(json) -# print the JSON string representation of the object -print(DynamicNetworkZoneAllOfAsns.to_json()) - -# convert the object into a dict -dynamic_network_zone_all_of_asns_dict = dynamic_network_zone_all_of_asns_instance.to_dict() -# create an instance of DynamicNetworkZoneAllOfAsns from a dict -dynamic_network_zone_all_of_asns_from_dict = DynamicNetworkZoneAllOfAsns.from_dict(dynamic_network_zone_all_of_asns_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/DynamicNetworkZoneAllOfLocations.md b/docs/DynamicNetworkZoneAllOfLocations.md deleted file mode 100644 index 76845ff4..00000000 --- a/docs/DynamicNetworkZoneAllOfLocations.md +++ /dev/null @@ -1,28 +0,0 @@ -# DynamicNetworkZoneAllOfLocations - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from okta.models.dynamic_network_zone_all_of_locations import DynamicNetworkZoneAllOfLocations - -# TODO update the JSON string below -json = "{}" -# create an instance of DynamicNetworkZoneAllOfLocations from a JSON string -dynamic_network_zone_all_of_locations_instance = DynamicNetworkZoneAllOfLocations.from_json(json) -# print the JSON string representation of the object -print(DynamicNetworkZoneAllOfLocations.to_json()) - -# convert the object into a dict -dynamic_network_zone_all_of_locations_dict = dynamic_network_zone_all_of_locations_instance.to_dict() -# create an instance of DynamicNetworkZoneAllOfLocations from a dict -dynamic_network_zone_all_of_locations_from_dict = DynamicNetworkZoneAllOfLocations.from_dict(dynamic_network_zone_all_of_locations_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/EnhancedDynamicNetworkZoneAllOfAsns.md b/docs/EnhancedDynamicNetworkZoneAllOfAsns.md index 1217bda1..272e0d3e 100644 --- a/docs/EnhancedDynamicNetworkZoneAllOfAsns.md +++ b/docs/EnhancedDynamicNetworkZoneAllOfAsns.md @@ -6,8 +6,8 @@ The list of ASNs associated with an Enhanced Dynamic Network Zone Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**include** | [**EnhancedDynamicNetworkZoneAllOfAsnsInclude**](EnhancedDynamicNetworkZoneAllOfAsnsInclude.md) | | [optional] -**exclude** | [**EnhancedDynamicNetworkZoneAllOfAsnsExclude**](EnhancedDynamicNetworkZoneAllOfAsnsExclude.md) | | [optional] +**include** | **List[str]** | An array of ASNs to include for an Enhanced Dynamic Network Zone | [optional] +**exclude** | **List[str]** | An array of ASNs to exclude for an Enhanced Dynamic Network Zone | [optional] ## Example diff --git a/docs/EnhancedDynamicNetworkZoneAllOfAsnsExclude.md b/docs/EnhancedDynamicNetworkZoneAllOfAsnsExclude.md deleted file mode 100644 index 82fb2f7a..00000000 --- a/docs/EnhancedDynamicNetworkZoneAllOfAsnsExclude.md +++ /dev/null @@ -1,28 +0,0 @@ -# EnhancedDynamicNetworkZoneAllOfAsnsExclude - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from okta.models.enhanced_dynamic_network_zone_all_of_asns_exclude import EnhancedDynamicNetworkZoneAllOfAsnsExclude - -# TODO update the JSON string below -json = "{}" -# create an instance of EnhancedDynamicNetworkZoneAllOfAsnsExclude from a JSON string -enhanced_dynamic_network_zone_all_of_asns_exclude_instance = EnhancedDynamicNetworkZoneAllOfAsnsExclude.from_json(json) -# print the JSON string representation of the object -print(EnhancedDynamicNetworkZoneAllOfAsnsExclude.to_json()) - -# convert the object into a dict -enhanced_dynamic_network_zone_all_of_asns_exclude_dict = enhanced_dynamic_network_zone_all_of_asns_exclude_instance.to_dict() -# create an instance of EnhancedDynamicNetworkZoneAllOfAsnsExclude from a dict -enhanced_dynamic_network_zone_all_of_asns_exclude_from_dict = EnhancedDynamicNetworkZoneAllOfAsnsExclude.from_dict(enhanced_dynamic_network_zone_all_of_asns_exclude_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/EnhancedDynamicNetworkZoneAllOfAsnsInclude.md b/docs/EnhancedDynamicNetworkZoneAllOfAsnsInclude.md deleted file mode 100644 index f9e1d1e5..00000000 --- a/docs/EnhancedDynamicNetworkZoneAllOfAsnsInclude.md +++ /dev/null @@ -1,28 +0,0 @@ -# EnhancedDynamicNetworkZoneAllOfAsnsInclude - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from okta.models.enhanced_dynamic_network_zone_all_of_asns_include import EnhancedDynamicNetworkZoneAllOfAsnsInclude - -# TODO update the JSON string below -json = "{}" -# create an instance of EnhancedDynamicNetworkZoneAllOfAsnsInclude from a JSON string -enhanced_dynamic_network_zone_all_of_asns_include_instance = EnhancedDynamicNetworkZoneAllOfAsnsInclude.from_json(json) -# print the JSON string representation of the object -print(EnhancedDynamicNetworkZoneAllOfAsnsInclude.to_json()) - -# convert the object into a dict -enhanced_dynamic_network_zone_all_of_asns_include_dict = enhanced_dynamic_network_zone_all_of_asns_include_instance.to_dict() -# create an instance of EnhancedDynamicNetworkZoneAllOfAsnsInclude from a dict -enhanced_dynamic_network_zone_all_of_asns_include_from_dict = EnhancedDynamicNetworkZoneAllOfAsnsInclude.from_dict(enhanced_dynamic_network_zone_all_of_asns_include_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/EnhancedDynamicNetworkZoneAllOfLocations.md b/docs/EnhancedDynamicNetworkZoneAllOfLocations.md index 9f255fcb..87fee20a 100644 --- a/docs/EnhancedDynamicNetworkZoneAllOfLocations.md +++ b/docs/EnhancedDynamicNetworkZoneAllOfLocations.md @@ -6,8 +6,8 @@ The list of geolocations to include or exclude for an Enhanced Dynamic Network Z Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**include** | [**EnhancedDynamicNetworkZoneAllOfLocationsInclude**](EnhancedDynamicNetworkZoneAllOfLocationsInclude.md) | | [optional] -**exclude** | [**EnhancedDynamicNetworkZoneAllOfLocationsExclude**](EnhancedDynamicNetworkZoneAllOfLocationsExclude.md) | | [optional] +**include** | [**List[NetworkZoneLocation]**](NetworkZoneLocation.md) | An array of geolocations to include for an Enhanced Dynamic Network Zone | [optional] +**exclude** | [**List[NetworkZoneLocation]**](NetworkZoneLocation.md) | An array of geolocations to exclude for an Enhanced Dynamic Network Zone | [optional] ## Example diff --git a/docs/EnhancedDynamicNetworkZoneAllOfLocationsExclude.md b/docs/EnhancedDynamicNetworkZoneAllOfLocationsExclude.md deleted file mode 100644 index 895956a0..00000000 --- a/docs/EnhancedDynamicNetworkZoneAllOfLocationsExclude.md +++ /dev/null @@ -1,28 +0,0 @@ -# EnhancedDynamicNetworkZoneAllOfLocationsExclude - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from okta.models.enhanced_dynamic_network_zone_all_of_locations_exclude import EnhancedDynamicNetworkZoneAllOfLocationsExclude - -# TODO update the JSON string below -json = "{}" -# create an instance of EnhancedDynamicNetworkZoneAllOfLocationsExclude from a JSON string -enhanced_dynamic_network_zone_all_of_locations_exclude_instance = EnhancedDynamicNetworkZoneAllOfLocationsExclude.from_json(json) -# print the JSON string representation of the object -print(EnhancedDynamicNetworkZoneAllOfLocationsExclude.to_json()) - -# convert the object into a dict -enhanced_dynamic_network_zone_all_of_locations_exclude_dict = enhanced_dynamic_network_zone_all_of_locations_exclude_instance.to_dict() -# create an instance of EnhancedDynamicNetworkZoneAllOfLocationsExclude from a dict -enhanced_dynamic_network_zone_all_of_locations_exclude_from_dict = EnhancedDynamicNetworkZoneAllOfLocationsExclude.from_dict(enhanced_dynamic_network_zone_all_of_locations_exclude_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/EnhancedDynamicNetworkZoneAllOfLocationsInclude.md b/docs/EnhancedDynamicNetworkZoneAllOfLocationsInclude.md deleted file mode 100644 index 38656fb2..00000000 --- a/docs/EnhancedDynamicNetworkZoneAllOfLocationsInclude.md +++ /dev/null @@ -1,28 +0,0 @@ -# EnhancedDynamicNetworkZoneAllOfLocationsInclude - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from okta.models.enhanced_dynamic_network_zone_all_of_locations_include import EnhancedDynamicNetworkZoneAllOfLocationsInclude - -# TODO update the JSON string below -json = "{}" -# create an instance of EnhancedDynamicNetworkZoneAllOfLocationsInclude from a JSON string -enhanced_dynamic_network_zone_all_of_locations_include_instance = EnhancedDynamicNetworkZoneAllOfLocationsInclude.from_json(json) -# print the JSON string representation of the object -print(EnhancedDynamicNetworkZoneAllOfLocationsInclude.to_json()) - -# convert the object into a dict -enhanced_dynamic_network_zone_all_of_locations_include_dict = enhanced_dynamic_network_zone_all_of_locations_include_instance.to_dict() -# create an instance of EnhancedDynamicNetworkZoneAllOfLocationsInclude from a dict -enhanced_dynamic_network_zone_all_of_locations_include_from_dict = EnhancedDynamicNetworkZoneAllOfLocationsInclude.from_dict(enhanced_dynamic_network_zone_all_of_locations_include_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/okta/DOC_GUIDE.md b/okta/DOC_GUIDE.md index c343f8dc..a4b0e20f 100644 --- a/okta/DOC_GUIDE.md +++ b/okta/DOC_GUIDE.md @@ -1184,8 +1184,6 @@ Class | Method | HTTP request | Description - [DomainValidationStatus](docs/DomainValidationStatus.md) - [Duration](docs/Duration.md) - [DynamicNetworkZone](docs/DynamicNetworkZone.md) - - [DynamicNetworkZoneAllOfAsns](docs/DynamicNetworkZoneAllOfAsns.md) - - [DynamicNetworkZoneAllOfLocations](docs/DynamicNetworkZoneAllOfLocations.md) - [ECKeyJWK](docs/ECKeyJWK.md) - [EmailContent](docs/EmailContent.md) - [EmailCustomization](docs/EmailCustomization.md) @@ -1218,12 +1216,8 @@ Class | Method | HTTP request | Description - [EndpointAuthMethod](docs/EndpointAuthMethod.md) - [EnhancedDynamicNetworkZone](docs/EnhancedDynamicNetworkZone.md) - [EnhancedDynamicNetworkZoneAllOfAsns](docs/EnhancedDynamicNetworkZoneAllOfAsns.md) - - [EnhancedDynamicNetworkZoneAllOfAsnsExclude](docs/EnhancedDynamicNetworkZoneAllOfAsnsExclude.md) - - [EnhancedDynamicNetworkZoneAllOfAsnsInclude](docs/EnhancedDynamicNetworkZoneAllOfAsnsInclude.md) - [EnhancedDynamicNetworkZoneAllOfIpServiceCategories](docs/EnhancedDynamicNetworkZoneAllOfIpServiceCategories.md) - [EnhancedDynamicNetworkZoneAllOfLocations](docs/EnhancedDynamicNetworkZoneAllOfLocations.md) - - [EnhancedDynamicNetworkZoneAllOfLocationsExclude](docs/EnhancedDynamicNetworkZoneAllOfLocationsExclude.md) - - [EnhancedDynamicNetworkZoneAllOfLocationsInclude](docs/EnhancedDynamicNetworkZoneAllOfLocationsInclude.md) - [EnrollmentActivationRequest](docs/EnrollmentActivationRequest.md) - [EnrollmentActivationResponse](docs/EnrollmentActivationResponse.md) - [EnrollmentInitializationRequest](docs/EnrollmentInitializationRequest.md) diff --git a/okta/__init__.py b/okta/__init__.py index 6696dbbb..388ec4be 100644 --- a/okta/__init__.py +++ b/okta/__init__.py @@ -639,8 +639,6 @@ "DomainValidationStatus": "okta.models.domain_validation_status", "Duration": "okta.models.duration", "DynamicNetworkZone": "okta.models.dynamic_network_zone", - "DynamicNetworkZoneAllOfAsns": "okta.models.dynamic_network_zone_all_of_asns", - "DynamicNetworkZoneAllOfLocations": "okta.models.dynamic_network_zone_all_of_locations", "ECKeyJWK": "okta.models.ec_key_jwk", "EmailContent": "okta.models.email_content", "EmailCustomization": "okta.models.email_customization", @@ -674,12 +672,8 @@ "EndpointAuthMethod": "okta.models.endpoint_auth_method", "EnhancedDynamicNetworkZone": "okta.models.enhanced_dynamic_network_zone", "EnhancedDynamicNetworkZoneAllOfAsns": "okta.models.enhanced_dynamic_network_zone_all_of_asns", - "EnhancedDynamicNetworkZoneAllOfAsnsExclude": "okta.models.enhanced_dynamic_network_zone_all_of_asns_exclude", - "EnhancedDynamicNetworkZoneAllOfAsnsInclude": "okta.models.enhanced_dynamic_network_zone_all_of_asns_include", "EnhancedDynamicNetworkZoneAllOfIpServiceCategories": "okta.models.enhanced_dynamic_network_zone_all_of_ip_service_categories", "EnhancedDynamicNetworkZoneAllOfLocations": "okta.models.enhanced_dynamic_network_zone_all_of_locations", - "EnhancedDynamicNetworkZoneAllOfLocationsExclude": "okta.models.enhanced_dynamic_network_zone_all_of_locations_exclude", - "EnhancedDynamicNetworkZoneAllOfLocationsInclude": "okta.models.enhanced_dynamic_network_zone_all_of_locations_include", "EnrollmentActivationRequest": "okta.models.enrollment_activation_request", "EnrollmentActivationResponse": "okta.models.enrollment_activation_response", "EnrollmentInitializationRequest": "okta.models.enrollment_initialization_request", diff --git a/okta/models/__init__.py b/okta/models/__init__.py index a8a88077..e1a82a68 100644 --- a/okta/models/__init__.py +++ b/okta/models/__init__.py @@ -841,8 +841,6 @@ "DomainValidationStatus": "okta.models.domain_validation_status", "Duration": "okta.models.duration", "DynamicNetworkZone": "okta.models.dynamic_network_zone", - "DynamicNetworkZoneAllOfAsns": "okta.models.dynamic_network_zone_all_of_asns", - "DynamicNetworkZoneAllOfLocations": "okta.models.dynamic_network_zone_all_of_locations", "ECKeyJWK": "okta.models.ec_key_jwk", "EmailContent": "okta.models.email_content", "EmailCustomization": "okta.models.email_customization", @@ -876,12 +874,8 @@ "EndpointAuthMethod": "okta.models.endpoint_auth_method", "EnhancedDynamicNetworkZone": "okta.models.enhanced_dynamic_network_zone", "EnhancedDynamicNetworkZoneAllOfAsns": "okta.models.enhanced_dynamic_network_zone_all_of_asns", - "EnhancedDynamicNetworkZoneAllOfAsnsExclude": "okta.models.enhanced_dynamic_network_zone_all_of_asns_exclude", - "EnhancedDynamicNetworkZoneAllOfAsnsInclude": "okta.models.enhanced_dynamic_network_zone_all_of_asns_include", "EnhancedDynamicNetworkZoneAllOfIpServiceCategories": "okta.models.enhanced_dynamic_network_zone_all_of_ip_service_categories", "EnhancedDynamicNetworkZoneAllOfLocations": "okta.models.enhanced_dynamic_network_zone_all_of_locations", - "EnhancedDynamicNetworkZoneAllOfLocationsExclude": "okta.models.enhanced_dynamic_network_zone_all_of_locations_exclude", - "EnhancedDynamicNetworkZoneAllOfLocationsInclude": "okta.models.enhanced_dynamic_network_zone_all_of_locations_include", "EnrollmentActivationRequest": "okta.models.enrollment_activation_request", "EnrollmentActivationResponse": "okta.models.enrollment_activation_response", "EnrollmentInitializationRequest": "okta.models.enrollment_initialization_request", diff --git a/okta/models/dynamic_network_zone.py b/okta/models/dynamic_network_zone.py index 383091ff..0153c934 100644 --- a/okta/models/dynamic_network_zone.py +++ b/okta/models/dynamic_network_zone.py @@ -31,12 +31,9 @@ from pydantic import ConfigDict, Field, StrictStr, field_validator from typing_extensions import Self -from okta.models.dynamic_network_zone_all_of_asns import DynamicNetworkZoneAllOfAsns -from okta.models.dynamic_network_zone_all_of_locations import ( - DynamicNetworkZoneAllOfLocations, -) from okta.models.links_self_and_lifecycle import LinksSelfAndLifecycle from okta.models.network_zone import NetworkZone +from okta.models.network_zone_location import NetworkZoneLocation class DynamicNetworkZone(NetworkZone): @@ -44,13 +41,17 @@ class DynamicNetworkZone(NetworkZone): DynamicNetworkZone """ # noqa: E501 - asns: Optional[DynamicNetworkZoneAllOfAsns] = None + asns: Optional[List[StrictStr]] = Field( + default=None, description="An array of ASNs for a Network Zone" + ) proxy_type: Optional[StrictStr] = Field( default=None, description="The proxy type used for a Dynamic Network Zone", alias="proxyType", ) - locations: Optional[DynamicNetworkZoneAllOfLocations] = None + locations: Optional[List[NetworkZoneLocation]] = Field( + default=None, description="An array of geolocations for a Dynamic Network Zone" + ) __properties: ClassVar[List[str]] = [ "created", "id", @@ -122,19 +123,17 @@ def to_dict(self) -> Dict[str, Any]: else: _dict["_links"] = self.links - # override the default output from pydantic by calling `to_dict()` of asns - if self.asns: - if not isinstance(self.asns, dict): - _dict["asns"] = self.asns.to_dict() - else: - _dict["asns"] = self.asns - - # override the default output from pydantic by calling `to_dict()` of locations + # override the default output from pydantic by calling `to_dict()` of each item in locations (list) + _items = [] if self.locations: - if not isinstance(self.locations, dict): - _dict["locations"] = self.locations.to_dict() - else: - _dict["locations"] = self.locations + for _item in self.locations: + if _item: + _items.append(_item.to_dict()) + _dict["locations"] = _items + # set to None if locations (nullable) is None + # and model_fields_set contains the field + if self.locations is None and "locations" in self.model_fields_set: + _dict["locations"] = None return _dict @@ -162,14 +161,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if obj.get("_links") is not None else None ), - "asns": ( - DynamicNetworkZoneAllOfAsns.from_dict(obj["asns"]) - if obj.get("asns") is not None - else None - ), + "asns": obj.get("asns"), "proxyType": obj.get("proxyType"), "locations": ( - DynamicNetworkZoneAllOfLocations.from_dict(obj["locations"]) + [NetworkZoneLocation.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None ), diff --git a/okta/models/dynamic_network_zone_all_of_asns.py b/okta/models/dynamic_network_zone_all_of_asns.py deleted file mode 100644 index 65cd20ba..00000000 --- a/okta/models/dynamic_network_zone_all_of_asns.py +++ /dev/null @@ -1,91 +0,0 @@ -# The Okta software accompanied by this notice is provided pursuant to the following terms: -# Copyright © 2025-Present, Okta, Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the -# License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS -# IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. -# coding: utf-8 - -""" -Okta Admin Management - -Allows customers to easily access the Okta Management APIs - -The version of the OpenAPI document: 5.1.0 -Contact: devex-public@okta.com -Generated by OpenAPI Generator (https://openapi-generator.tech) - -Do not edit the class manually. -""" # noqa: E501 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List -from typing import Optional, Set - -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - - -class DynamicNetworkZoneAllOfAsns(BaseModel): - """ - DynamicNetworkZoneAllOfAsns - """ # noqa: E501 - - __properties: ClassVar[List[str]] = [] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of DynamicNetworkZoneAllOfAsns from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of DynamicNetworkZoneAllOfAsns from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({}) - return _obj diff --git a/okta/models/dynamic_network_zone_all_of_locations.py b/okta/models/dynamic_network_zone_all_of_locations.py deleted file mode 100644 index 9e536342..00000000 --- a/okta/models/dynamic_network_zone_all_of_locations.py +++ /dev/null @@ -1,91 +0,0 @@ -# The Okta software accompanied by this notice is provided pursuant to the following terms: -# Copyright © 2025-Present, Okta, Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the -# License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS -# IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. -# coding: utf-8 - -""" -Okta Admin Management - -Allows customers to easily access the Okta Management APIs - -The version of the OpenAPI document: 5.1.0 -Contact: devex-public@okta.com -Generated by OpenAPI Generator (https://openapi-generator.tech) - -Do not edit the class manually. -""" # noqa: E501 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List -from typing import Optional, Set - -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - - -class DynamicNetworkZoneAllOfLocations(BaseModel): - """ - DynamicNetworkZoneAllOfLocations - """ # noqa: E501 - - __properties: ClassVar[List[str]] = [] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of DynamicNetworkZoneAllOfLocations from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of DynamicNetworkZoneAllOfLocations from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({}) - return _obj diff --git a/okta/models/enhanced_dynamic_network_zone_all_of_asns.py b/okta/models/enhanced_dynamic_network_zone_all_of_asns.py index 99727907..8e04ab5e 100644 --- a/okta/models/enhanced_dynamic_network_zone_all_of_asns.py +++ b/okta/models/enhanced_dynamic_network_zone_all_of_asns.py @@ -28,24 +28,23 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing_extensions import Self -from okta.models.enhanced_dynamic_network_zone_all_of_asns_exclude import ( - EnhancedDynamicNetworkZoneAllOfAsnsExclude, -) -from okta.models.enhanced_dynamic_network_zone_all_of_asns_include import ( - EnhancedDynamicNetworkZoneAllOfAsnsInclude, -) - class EnhancedDynamicNetworkZoneAllOfAsns(BaseModel): """ The list of ASNs associated with an Enhanced Dynamic Network Zone """ # noqa: E501 - include: Optional[EnhancedDynamicNetworkZoneAllOfAsnsInclude] = None - exclude: Optional[EnhancedDynamicNetworkZoneAllOfAsnsExclude] = None + include: Optional[List[StrictStr]] = Field( + default=None, + description="An array of ASNs to include for an Enhanced Dynamic Network Zone", + ) + exclude: Optional[List[StrictStr]] = Field( + default=None, + description="An array of ASNs to exclude for an Enhanced Dynamic Network Zone", + ) __properties: ClassVar[List[str]] = ["include", "exclude"] model_config = ConfigDict( @@ -85,20 +84,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of include - if self.include: - if not isinstance(self.include, dict): - _dict["include"] = self.include.to_dict() - else: - _dict["include"] = self.include - - # override the default output from pydantic by calling `to_dict()` of exclude - if self.exclude: - if not isinstance(self.exclude, dict): - _dict["exclude"] = self.exclude.to_dict() - else: - _dict["exclude"] = self.exclude - return _dict @classmethod @@ -111,17 +96,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate( - { - "include": ( - EnhancedDynamicNetworkZoneAllOfAsnsInclude.from_dict(obj["include"]) - if obj.get("include") is not None - else None - ), - "exclude": ( - EnhancedDynamicNetworkZoneAllOfAsnsExclude.from_dict(obj["exclude"]) - if obj.get("exclude") is not None - else None - ), - } + {"include": obj.get("include"), "exclude": obj.get("exclude")} ) return _obj diff --git a/okta/models/enhanced_dynamic_network_zone_all_of_asns_exclude.py b/okta/models/enhanced_dynamic_network_zone_all_of_asns_exclude.py deleted file mode 100644 index d730e161..00000000 --- a/okta/models/enhanced_dynamic_network_zone_all_of_asns_exclude.py +++ /dev/null @@ -1,91 +0,0 @@ -# The Okta software accompanied by this notice is provided pursuant to the following terms: -# Copyright © 2025-Present, Okta, Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the -# License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS -# IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. -# coding: utf-8 - -""" -Okta Admin Management - -Allows customers to easily access the Okta Management APIs - -The version of the OpenAPI document: 5.1.0 -Contact: devex-public@okta.com -Generated by OpenAPI Generator (https://openapi-generator.tech) - -Do not edit the class manually. -""" # noqa: E501 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List -from typing import Optional, Set - -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - - -class EnhancedDynamicNetworkZoneAllOfAsnsExclude(BaseModel): - """ - EnhancedDynamicNetworkZoneAllOfAsnsExclude - """ # noqa: E501 - - __properties: ClassVar[List[str]] = [] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EnhancedDynamicNetworkZoneAllOfAsnsExclude from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EnhancedDynamicNetworkZoneAllOfAsnsExclude from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({}) - return _obj diff --git a/okta/models/enhanced_dynamic_network_zone_all_of_asns_include.py b/okta/models/enhanced_dynamic_network_zone_all_of_asns_include.py deleted file mode 100644 index 989c837f..00000000 --- a/okta/models/enhanced_dynamic_network_zone_all_of_asns_include.py +++ /dev/null @@ -1,91 +0,0 @@ -# The Okta software accompanied by this notice is provided pursuant to the following terms: -# Copyright © 2025-Present, Okta, Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the -# License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS -# IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. -# coding: utf-8 - -""" -Okta Admin Management - -Allows customers to easily access the Okta Management APIs - -The version of the OpenAPI document: 5.1.0 -Contact: devex-public@okta.com -Generated by OpenAPI Generator (https://openapi-generator.tech) - -Do not edit the class manually. -""" # noqa: E501 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List -from typing import Optional, Set - -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - - -class EnhancedDynamicNetworkZoneAllOfAsnsInclude(BaseModel): - """ - EnhancedDynamicNetworkZoneAllOfAsnsInclude - """ # noqa: E501 - - __properties: ClassVar[List[str]] = [] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EnhancedDynamicNetworkZoneAllOfAsnsInclude from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EnhancedDynamicNetworkZoneAllOfAsnsInclude from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({}) - return _obj diff --git a/okta/models/enhanced_dynamic_network_zone_all_of_locations.py b/okta/models/enhanced_dynamic_network_zone_all_of_locations.py index d55f2a9c..8708b136 100644 --- a/okta/models/enhanced_dynamic_network_zone_all_of_locations.py +++ b/okta/models/enhanced_dynamic_network_zone_all_of_locations.py @@ -28,15 +28,10 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Self -from okta.models.enhanced_dynamic_network_zone_all_of_locations_exclude import ( - EnhancedDynamicNetworkZoneAllOfLocationsExclude, -) -from okta.models.enhanced_dynamic_network_zone_all_of_locations_include import ( - EnhancedDynamicNetworkZoneAllOfLocationsInclude, -) +from okta.models.network_zone_location import NetworkZoneLocation class EnhancedDynamicNetworkZoneAllOfLocations(BaseModel): @@ -44,8 +39,14 @@ class EnhancedDynamicNetworkZoneAllOfLocations(BaseModel): The list of geolocations to include or exclude for an Enhanced Dynamic Network Zone """ # noqa: E501 - include: Optional[EnhancedDynamicNetworkZoneAllOfLocationsInclude] = None - exclude: Optional[EnhancedDynamicNetworkZoneAllOfLocationsExclude] = None + include: Optional[List[NetworkZoneLocation]] = Field( + default=None, + description="An array of geolocations to include for an Enhanced Dynamic Network Zone", + ) + exclude: Optional[List[NetworkZoneLocation]] = Field( + default=None, + description="An array of geolocations to exclude for an Enhanced Dynamic Network Zone", + ) __properties: ClassVar[List[str]] = ["include", "exclude"] model_config = ConfigDict( @@ -85,19 +86,29 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of include + # override the default output from pydantic by calling `to_dict()` of each item in include (list) + _items = [] if self.include: - if not isinstance(self.include, dict): - _dict["include"] = self.include.to_dict() - else: - _dict["include"] = self.include - - # override the default output from pydantic by calling `to_dict()` of exclude + for _item in self.include: + if _item: + _items.append(_item.to_dict()) + _dict["include"] = _items + # override the default output from pydantic by calling `to_dict()` of each item in exclude (list) + _items = [] if self.exclude: - if not isinstance(self.exclude, dict): - _dict["exclude"] = self.exclude.to_dict() - else: - _dict["exclude"] = self.exclude + for _item in self.exclude: + if _item: + _items.append(_item.to_dict()) + _dict["exclude"] = _items + # set to None if include (nullable) is None + # and model_fields_set contains the field + if self.include is None and "include" in self.model_fields_set: + _dict["include"] = None + + # set to None if exclude (nullable) is None + # and model_fields_set contains the field + if self.exclude is None and "exclude" in self.model_fields_set: + _dict["exclude"] = None return _dict @@ -113,16 +124,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { "include": ( - EnhancedDynamicNetworkZoneAllOfLocationsInclude.from_dict( - obj["include"] - ) + [NetworkZoneLocation.from_dict(_item) for _item in obj["include"]] if obj.get("include") is not None else None ), "exclude": ( - EnhancedDynamicNetworkZoneAllOfLocationsExclude.from_dict( - obj["exclude"] - ) + [NetworkZoneLocation.from_dict(_item) for _item in obj["exclude"]] if obj.get("exclude") is not None else None ), diff --git a/okta/models/enhanced_dynamic_network_zone_all_of_locations_exclude.py b/okta/models/enhanced_dynamic_network_zone_all_of_locations_exclude.py deleted file mode 100644 index c27d3ac2..00000000 --- a/okta/models/enhanced_dynamic_network_zone_all_of_locations_exclude.py +++ /dev/null @@ -1,91 +0,0 @@ -# The Okta software accompanied by this notice is provided pursuant to the following terms: -# Copyright © 2025-Present, Okta, Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the -# License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS -# IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. -# coding: utf-8 - -""" -Okta Admin Management - -Allows customers to easily access the Okta Management APIs - -The version of the OpenAPI document: 5.1.0 -Contact: devex-public@okta.com -Generated by OpenAPI Generator (https://openapi-generator.tech) - -Do not edit the class manually. -""" # noqa: E501 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List -from typing import Optional, Set - -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - - -class EnhancedDynamicNetworkZoneAllOfLocationsExclude(BaseModel): - """ - EnhancedDynamicNetworkZoneAllOfLocationsExclude - """ # noqa: E501 - - __properties: ClassVar[List[str]] = [] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EnhancedDynamicNetworkZoneAllOfLocationsExclude from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EnhancedDynamicNetworkZoneAllOfLocationsExclude from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({}) - return _obj diff --git a/okta/models/enhanced_dynamic_network_zone_all_of_locations_include.py b/okta/models/enhanced_dynamic_network_zone_all_of_locations_include.py deleted file mode 100644 index b5f53210..00000000 --- a/okta/models/enhanced_dynamic_network_zone_all_of_locations_include.py +++ /dev/null @@ -1,91 +0,0 @@ -# The Okta software accompanied by this notice is provided pursuant to the following terms: -# Copyright © 2025-Present, Okta, Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the -# License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS -# IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. -# coding: utf-8 - -""" -Okta Admin Management - -Allows customers to easily access the Okta Management APIs - -The version of the OpenAPI document: 5.1.0 -Contact: devex-public@okta.com -Generated by OpenAPI Generator (https://openapi-generator.tech) - -Do not edit the class manually. -""" # noqa: E501 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List -from typing import Optional, Set - -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - - -class EnhancedDynamicNetworkZoneAllOfLocationsInclude(BaseModel): - """ - EnhancedDynamicNetworkZoneAllOfLocationsInclude - """ # noqa: E501 - - __properties: ClassVar[List[str]] = [] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EnhancedDynamicNetworkZoneAllOfLocationsInclude from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EnhancedDynamicNetworkZoneAllOfLocationsInclude from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({}) - return _obj diff --git a/openapi/api.yaml b/openapi/api.yaml index a8658750..246da4d9 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -64528,9 +64528,11 @@ components: - type: object properties: asns: - allOf: - - $ref: '#/components/schemas/NetworkZoneAsns' - - description: An array of ASNs for a Network Zone + type: array + description: An array of ASNs for a Network Zone + items: + type: string + maximum: 75 proxyType: type: string description: The proxy type used for a Dynamic Network Zone @@ -64545,9 +64547,12 @@ components: Tor: Use Tor Anonymizer proxy for the Dynamic Zone. NotTorAnonymizer: Use a non Tor Anonymizer proxy for the Dynamic Zone. locations: - allOf: - - $ref: '#/components/schemas/NetworkZoneLocationArray' - - description: An array of geolocations for a Dynamic Network Zone + type: array + description: An array of geolocations for a Dynamic Network Zone + items: + $ref: '#/components/schemas/NetworkZoneLocation' + maximum: 75 + nullable: true ECKeyJWK: description: Elliptic curve key in JSON Web Key (JWK) format. It's used during enrollment to encrypt fulfillment requests to Yubico, or during activation to verify Yubico's JWS (JSON Web Signature) objects in fulfillment responses. The currently agreed protocol uses P-384. type: object @@ -64925,13 +64930,17 @@ components: description: The list of ASNs associated with an Enhanced Dynamic Network Zone properties: include: - allOf: - - $ref: '#/components/schemas/NetworkZoneAsns' - - description: An array of ASNs to include for an Enhanced Dynamic Network Zone + type: array + description: An array of ASNs to include for an Enhanced Dynamic Network Zone + items: + type: string + maximum: 75 exclude: - allOf: - - $ref: '#/components/schemas/NetworkZoneAsns' - - description: An array of ASNs to exclude for an Enhanced Dynamic Network Zone + type: array + description: An array of ASNs to exclude for an Enhanced Dynamic Network Zone + items: + type: string + maximum: 75 locations: x-okta-lifecycle: lifecycle: GA @@ -64941,13 +64950,19 @@ components: description: The list of geolocations to include or exclude for an Enhanced Dynamic Network Zone properties: include: - allOf: - - $ref: '#/components/schemas/NetworkZoneLocationArray' - - description: An array of geolocations to include for an Enhanced Dynamic Network Zone + type: array + description: An array of geolocations to include for an Enhanced Dynamic Network Zone + items: + $ref: '#/components/schemas/NetworkZoneLocation' + maximum: 75 + nullable: true exclude: - allOf: - - $ref: '#/components/schemas/NetworkZoneLocationArray' - - description: An array of geolocations to exclude for an Enhanced Dynamic Network Zone + type: array + description: An array of geolocations to exclude for an Enhanced Dynamic Network Zone + items: + $ref: '#/components/schemas/NetworkZoneLocation' + maximum: 75 + nullable: true ipServiceCategories: x-okta-lifecycle: lifecycle: GA diff --git a/tests/test_network_zone_arrays.py b/tests/test_network_zone_arrays.py new file mode 100644 index 00000000..0cb304be --- /dev/null +++ b/tests/test_network_zone_arrays.py @@ -0,0 +1,328 @@ +# The Okta software accompanied by this notice is provided pursuant to the following terms: +# Copyright © 2025-Present, Okta, Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the +# License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under the License. +# coding: utf-8 + +""" +Unit tests for the array-typed `asns` / `locations` fields on the generated +DynamicNetworkZone and EnhancedDynamicNetworkZone models. + +These tests guard against regressions of the bug where api.yaml declared these fields +as `allOf: [$ref: , description: ...]`. OpenAPI Generator 7.7.0 treated +that wrapper as an object and generated empty, field-less models +(e.g. EnhancedDynamicNetworkZoneAllOfAsnsInclude), so any list returned by the API — +including the empty list `[]` — raised a pydantic ValidationError and broke +list_network_zones(). After the spec fix the fields are plain arrays: +`List[str]` for ASNs and `List[NetworkZoneLocation]` for locations. +""" + +import json + +from pydantic import ValidationError + +import pytest + +import okta.models +from okta.models.dynamic_network_zone import DynamicNetworkZone +from okta.models.enhanced_dynamic_network_zone import EnhancedDynamicNetworkZone +from okta.models.enhanced_dynamic_network_zone_all_of_asns import ( + EnhancedDynamicNetworkZoneAllOfAsns, +) +from okta.models.enhanced_dynamic_network_zone_all_of_locations import ( + EnhancedDynamicNetworkZoneAllOfLocations, +) +from okta.models.network_zone import NetworkZone +from okta.models.network_zone_location import NetworkZoneLocation + +BASE_ZONE = { + "id": "nzo1example0000000001", + "name": "Example Zone", + "status": "ACTIVE", + "usage": "BLOCKLIST", + "system": False, +} + +# Shape returned by the API for an Enhanced Dynamic Network Zone with nothing configured +EMPTY_EDNZ_PAYLOAD = { + **BASE_ZONE, + "type": "DYNAMIC_V2", + "asns": {"include": [], "exclude": []}, + "locations": {"include": [], "exclude": []}, + "ipServiceCategories": {"include": ["ALL_ANONYMIZERS"], "exclude": []}, +} + +FULL_EDNZ_PAYLOAD = { + **BASE_ZONE, + "type": "DYNAMIC_V2", + "asns": {"include": ["64496", "64497"], "exclude": ["64511"]}, + "locations": { + "include": [{"country": "US", "region": "US-CA"}, {"country": "DE"}], + "exclude": [{"country": "FR"}], + }, +} + +FULL_DNZ_PAYLOAD = { + **BASE_ZONE, + "type": "DYNAMIC", + "asns": ["64496", "64497"], + "locations": [{"country": "US", "region": "US-CA"}, {"country": "DE"}], +} + + +class TestEnhancedDynamicNetworkZoneFromDict: + """Deserialization of DYNAMIC_V2 zones from wire-format dicts.""" + + def test_from_dict_accepts_empty_asns_and_locations(self): + zone = EnhancedDynamicNetworkZone.from_dict(EMPTY_EDNZ_PAYLOAD) + + assert zone is not None + assert zone.asns.include == [] + assert zone.asns.exclude == [] + assert zone.locations.include == [] + assert zone.locations.exclude == [] + + def test_from_dict_preserves_asn_values(self): + zone = EnhancedDynamicNetworkZone.from_dict(FULL_EDNZ_PAYLOAD) + + assert zone.asns.include == ["64496", "64497"] + assert zone.asns.exclude == ["64511"] + + def test_from_dict_hydrates_locations_as_models(self): + zone = EnhancedDynamicNetworkZone.from_dict(FULL_EDNZ_PAYLOAD) + + assert all(isinstance(loc, NetworkZoneLocation) for loc in zone.locations.include) + assert zone.locations.include[0].country == "US" + assert zone.locations.include[0].region == "US-CA" + assert zone.locations.include[1].country == "DE" + assert zone.locations.include[1].region is None + assert zone.locations.exclude[0].country == "FR" + + def test_from_dict_ignores_missing_asns_and_locations(self): + zone = EnhancedDynamicNetworkZone.from_dict({**BASE_ZONE, "type": "DYNAMIC_V2"}) + + assert zone is not None + assert zone.asns is None + assert zone.locations is None + + def test_from_dict_accepts_null_location_lists(self): + locations = EnhancedDynamicNetworkZoneAllOfLocations.from_dict( + {"include": None, "exclude": None} + ) + + assert locations.include is None + assert locations.exclude is None + + def test_from_dict_rejects_non_string_asns(self): + with pytest.raises(ValidationError): + EnhancedDynamicNetworkZoneAllOfAsns.from_dict({"include": [64496]}) + + +class TestDynamicNetworkZoneFromDict: + """Deserialization of DYNAMIC zones, where asns/locations are top-level arrays.""" + + def test_from_dict_preserves_asns_and_locations(self): + zone = DynamicNetworkZone.from_dict(FULL_DNZ_PAYLOAD) + + assert zone is not None + assert zone.asns == ["64496", "64497"] + assert all(isinstance(loc, NetworkZoneLocation) for loc in zone.locations) + assert zone.locations[0].country == "US" + assert zone.locations[0].region == "US-CA" + + def test_from_dict_accepts_empty_arrays(self): + zone = DynamicNetworkZone.from_dict( + {**BASE_ZONE, "type": "DYNAMIC", "asns": [], "locations": []} + ) + + assert zone.asns == [] + assert zone.locations == [] + + def test_from_dict_rejects_non_string_asns(self): + with pytest.raises(ValidationError): + DynamicNetworkZone.from_dict({**BASE_ZONE, "type": "DYNAMIC", "asns": [64496]}) + + +class TestNetworkZoneDiscriminator: + """list_network_zones() deserializes through the NetworkZone base class.""" + + def test_dynamic_v2_with_empty_arrays_routes_to_enhanced_zone(self): + zone = NetworkZone.from_dict(EMPTY_EDNZ_PAYLOAD) + + assert isinstance(zone, EnhancedDynamicNetworkZone) + assert zone.asns.include == [] + assert zone.locations.include == [] + + def test_dynamic_routes_to_dynamic_zone(self): + zone = NetworkZone.from_dict(FULL_DNZ_PAYLOAD) + + assert isinstance(zone, DynamicNetworkZone) + assert zone.asns == ["64496", "64497"] + + +class TestNetworkZoneToDict: + """Serialization back to wire-format dicts keeps the array shape.""" + + def test_enhanced_zone_to_dict_preserves_array_shape(self): + out = EnhancedDynamicNetworkZone.from_dict(FULL_EDNZ_PAYLOAD).to_dict() + + assert out["asns"] == FULL_EDNZ_PAYLOAD["asns"] + assert out["locations"] == FULL_EDNZ_PAYLOAD["locations"] + + def test_enhanced_zone_to_dict_preserves_empty_arrays(self): + out = EnhancedDynamicNetworkZone.from_dict(EMPTY_EDNZ_PAYLOAD).to_dict() + + assert out["asns"] == {"include": [], "exclude": []} + assert out["locations"] == {"include": [], "exclude": []} + + def test_location_to_dict_keeps_explicit_null(self): + locations = EnhancedDynamicNetworkZoneAllOfLocations.from_dict( + {"include": None, "exclude": None} + ) + + # include/exclude are nullable, so a null set at init is emitted rather than dropped + assert locations.to_dict() == {"include": None, "exclude": None} + + def test_dynamic_zone_to_dict_preserves_array_shape(self): + out = DynamicNetworkZone.from_dict(FULL_DNZ_PAYLOAD).to_dict() + + assert out["asns"] == FULL_DNZ_PAYLOAD["asns"] + assert out["locations"] == FULL_DNZ_PAYLOAD["locations"] + + +class TestNetworkZoneJsonRoundtrip: + def test_enhanced_zone_round_trips_via_json(self): + zone = EnhancedDynamicNetworkZone.from_json(json.dumps(FULL_EDNZ_PAYLOAD)) + out = json.loads(zone.to_json()) + + assert out["asns"] == FULL_EDNZ_PAYLOAD["asns"] + assert out["locations"] == FULL_EDNZ_PAYLOAD["locations"] + + def test_dynamic_zone_round_trips_via_json(self): + zone = DynamicNetworkZone.from_json(json.dumps(FULL_DNZ_PAYLOAD)) + out = json.loads(zone.to_json()) + + assert out["asns"] == FULL_DNZ_PAYLOAD["asns"] + assert out["locations"] == FULL_DNZ_PAYLOAD["locations"] + + +class TestNetworkZoneEdgeCases: + """Remaining generated paths on the affected models: None / model-instance input, + string helpers, nested JSON helpers, _links, nullable locations and proxyType.""" + + ALL_MODELS = [ + DynamicNetworkZone, + EnhancedDynamicNetworkZone, + EnhancedDynamicNetworkZoneAllOfAsns, + EnhancedDynamicNetworkZoneAllOfLocations, + ] + + @pytest.mark.parametrize("model", ALL_MODELS) + def test_from_dict_returns_none_for_none_input(self, model): + assert model.from_dict(None) is None + + @pytest.mark.parametrize( + "model, payload", + [ + (DynamicNetworkZone, FULL_DNZ_PAYLOAD), + (EnhancedDynamicNetworkZone, FULL_EDNZ_PAYLOAD), + (EnhancedDynamicNetworkZoneAllOfAsns, FULL_EDNZ_PAYLOAD["asns"]), + (EnhancedDynamicNetworkZoneAllOfLocations, FULL_EDNZ_PAYLOAD["locations"]), + ], + ) + def test_from_dict_accepts_model_instance(self, model, payload): + instance = model.from_dict(payload) + + assert model.from_dict(instance) == instance + + @pytest.mark.parametrize( + "model, payload, expected", + [ + (DynamicNetworkZone, FULL_DNZ_PAYLOAD, "64496"), + (EnhancedDynamicNetworkZone, FULL_EDNZ_PAYLOAD, "64496"), + (EnhancedDynamicNetworkZoneAllOfAsns, FULL_EDNZ_PAYLOAD["asns"], "64496"), + (EnhancedDynamicNetworkZoneAllOfLocations, FULL_EDNZ_PAYLOAD["locations"], "US-CA"), + ], + ) + def test_to_str_includes_array_values(self, model, payload, expected): + assert expected in model.from_dict(payload).to_str() + + def test_asns_json_round_trip(self): + asns = EnhancedDynamicNetworkZoneAllOfAsns.from_json(json.dumps(FULL_EDNZ_PAYLOAD["asns"])) + + assert json.loads(asns.to_json()) == FULL_EDNZ_PAYLOAD["asns"] + + def test_locations_json_round_trip(self): + locations = EnhancedDynamicNetworkZoneAllOfLocations.from_json( + json.dumps(FULL_EDNZ_PAYLOAD["locations"]) + ) + + assert json.loads(locations.to_json()) == FULL_EDNZ_PAYLOAD["locations"] + + @pytest.mark.parametrize( + "model, payload", + [ + (DynamicNetworkZone, FULL_DNZ_PAYLOAD), + (EnhancedDynamicNetworkZone, FULL_EDNZ_PAYLOAD), + ], + ) + def test_to_dict_serializes_links_via_nested_to_dict(self, model, payload): + href = "https://example.okta.com/api/v1/zones/nzo1example0000000001" + zone = model.from_dict({**payload, "_links": {"self": {"href": href}}}) + + assert zone.to_dict()["_links"]["self"]["href"] == href + + def test_dynamic_zone_to_dict_keeps_explicit_null_locations(self): + zone = DynamicNetworkZone.from_dict({**BASE_ZONE, "type": "DYNAMIC", "locations": None}) + + # locations is nullable, so a null set at init is emitted rather than dropped + assert zone.to_dict()["locations"] is None + + def test_dynamic_zone_accepts_known_proxy_type(self): + zone = DynamicNetworkZone.from_dict({**FULL_DNZ_PAYLOAD, "proxyType": "Tor"}) + + assert zone.proxy_type == "Tor" + + def test_dynamic_zone_rejects_unknown_proxy_type(self): + with pytest.raises(ValidationError): + DynamicNetworkZone.from_dict({**FULL_DNZ_PAYLOAD, "proxyType": "NotAProxyType"}) + + +class TestRemovedWrapperModels: + """Regression guard for the api.yaml allOf-wrapper bug. + + The empty wrapper models generated from the old spec must no longer be exported, + and the affected fields must be declared as lists. + """ + + @pytest.mark.parametrize( + "name", + [ + "DynamicNetworkZoneAllOfAsns", + "DynamicNetworkZoneAllOfLocations", + "EnhancedDynamicNetworkZoneAllOfAsnsInclude", + "EnhancedDynamicNetworkZoneAllOfAsnsExclude", + "EnhancedDynamicNetworkZoneAllOfLocationsInclude", + "EnhancedDynamicNetworkZoneAllOfLocationsExclude", + ], + ) + def test_wrapper_model_is_not_exported(self, name): + assert name not in okta.models._LAZY_IMPORT_MAP + + @pytest.mark.parametrize( + "model, field", + [ + (DynamicNetworkZone, "asns"), + (DynamicNetworkZone, "locations"), + (EnhancedDynamicNetworkZoneAllOfAsns, "include"), + (EnhancedDynamicNetworkZoneAllOfAsns, "exclude"), + (EnhancedDynamicNetworkZoneAllOfLocations, "include"), + (EnhancedDynamicNetworkZoneAllOfLocations, "exclude"), + ], + ) + def test_field_is_declared_as_list(self, model, field): + assert "List[" in str(model.model_fields[field].annotation)